/* =========================================
   1. ZMIENNE I BAZA (THEME CONFIG)
   ========================================= */
:root {
    /* Kolory podstawowe (nadpisywane przez PHP, ale tutaj fallback) */
    --cphp-def: #b0b0b0;
    --cphp-act: #fe5b3e;
    
    /* System kolorów UI */
    --cphp-white: #ffffff;
    --cphp-dark: #1a1a1a;
    --cphp-gray-light: #f4f6f8;
    --cphp-gray-text: #637381;
    --cphp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --cphp-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --cphp-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.15);
    --cphp-radius: 12px;
    --cphp-radius-round: 50px;
    --cphp-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Kontener główny - unikanie konfliktów z motywem */
.cphp-container {
    position: absolute;
    z-index: 99; /* Zawsze nad zdjęciem */
    display: flex;
    gap: 10px;
    pointer-events: none; /* Klikalne są tylko przyciski wewnątrz */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Pozycjonowanie na zdjęciach */
.cphp-pos-top-left { top: 12px; left: 12px; }
.cphp-pos-top-right { top: 12px; right: 12px; }
.cphp-pos-bottom-left { bottom: 12px; left: 12px; }
.cphp-pos-bottom-right { bottom: 12px; right: 12px; }


/* =========================================
   2. PRZYCISK SERCA (THE HEART)
   ========================================= */
.cphp-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px); /* Efekt szkła */
    border-radius: var(--cphp-radius-round);
    padding: 0 14px;
    height: 36px; /* Idealna wysokość dotykowa */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--cphp-shadow-sm);
    transition: var(--cphp-transition);
    border: 1px solid rgba(0,0,0,0.04);
    min-width: 36px;
}

/* Hover Effect */
.cphp-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--cphp-shadow-md);
    background: #fff;
}

/* Ikona serca */
.cphp-btn i {
    font-size: 17px;
    color: var(--cphp-def);
    transition: color 0.2s ease;
    margin-top: 1px; /* Optyczne wyrównanie */
}

/* Stan aktywny (Polubione) */
.cphp-btn.is-active {
    background: #fff;
    border-color: rgba(254, 91, 62, 0.2);
}

.cphp-btn.is-active i {
    color: var(--cphp-act);
    filter: drop-shadow(0 2px 4px rgba(254, 91, 62, 0.3)); /* Lekka poświata koloru */
}

/* Licznik obok serca */
.cphp-count {
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
    color: var(--cphp-dark);
    letter-spacing: -0.02em;
}

/* Animacja bicia serca (Pulse) */
.cphp-animate i {
    animation: cphp-heartbeat 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cphp-heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

/* =========================================
   3. PRZYCISK SHARE (GALERIA)
   ========================================= */
.cphp-share {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--cphp-shadow-sm);
    color: var(--cphp-gray-text);
    transition: var(--cphp-transition);
    border: 1px solid rgba(0,0,0,0.04);
}

.cphp-share:hover {
    background: #fff;
    color: var(--cphp-dark);
    transform: translateY(-2px);
    box-shadow: var(--cphp-shadow-md);
}
.cphp-share i { font-size: 16px; }


/* =========================================
   4. GRID OGŁOSZEŃ (SHORTCODES & WIDGETS)
   ========================================= */
.cphp-fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin: 30px 0;
    width: 100%;
}

/* Karta ogłoszenia - PRO Look */
.cphp-fav-item {
    background: var(--cphp-white);
    border-radius: var(--cphp-radius);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--cphp-shadow-sm);
    transition: var(--cphp-transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.cphp-fav-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--cphp-shadow-hover);
    border-color: rgba(0,0,0,0.0);
}

/* Zdjęcie w karcie */
.cphp-fav-img {
    height: 180px;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #f0f0f0;
}

/* Overlay na link */
.cphp-img-link {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Przycisk usuwania (X) */
.cphp-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #ff4d4f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
}

.cphp-remove-btn:hover {
    background: #ff4d4f;
    color: #fff;
    transform: rotate(90deg);
}

/* Badge z liczbą polubień (Top List) */
.cphp-likes-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--cphp-act);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
}

/* Treść karty */
.cphp-fav-content {
    padding: 16px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cphp-fav-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--cphp-dark);
}

.cphp-fav-content h3 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.cphp-fav-content h3 a:hover {
    color: var(--cphp-act);
}

.cphp-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--cphp-act);
    display: block;
    margin-top: auto; /* Dopycha cenę na dół jeśli opisy są różne */
}

/* Alert Box (np. brak ulubionych) */
.cphp-alert {
    padding: 20px;
    background: #fff;
    border-left: 4px solid var(--cphp-act);
    box-shadow: var(--cphp-shadow-sm);
    border-radius: 4px;
    font-size: 15px;
    color: #555;
    margin: 20px 0;
}

/* =========================================
   5. ADMIN DASHBOARD & TABLES (BACKEND)
   ========================================= */
/* Poprawki dla tabeli w adminie WordPressa, żeby wyglądała nowocześnie */
.wrap .widefat {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.wrap .widefat thead th {
    background: #f8f9fa;
    color: #444;
    font-weight: 600;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.wrap .widefat td {
    padding: 15px;
    vertical-align: middle;
    color: #555;
}

.wrap .widefat tr:hover td {
    background: #fdfdfd;
}

/* Stylizacja przycisku w tabeli */
.button.button-small {
    border-radius: 4px;
    font-weight: 500;
}

/* =========================================
   6. RESPONSYWNOŚĆ (MOBILE)
   ========================================= */
@media (max-width: 768px) {
    .cphp-fav-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); /* Pełna szerokość na mobile */
        gap: 16px;
    }
    
    .cphp-fav-img {
        height: 200px;
    }

    .cphp-btn {
        height: 32px;
        min-width: 32px;
        padding: 0 10px;
    }
    
    .cphp-btn i {
        font-size: 14px;
    }
    
    .cphp-count {
        font-size: 11px;
        margin-left: 6px;
    }
    
    .cphp-share {
        width: 32px;
        height: 32px;
    }
}

/* =========================================
   7. POWIADOMIENIA (TOAST NOTIFICATIONS)
   ========================================= */
.cphp-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 12px 20px;
    border-radius: 50px; /* Tabletka */
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    border: 1px solid rgba(0,0,0,0.05);
}

.cphp-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.cphp-toast i {
    font-size: 18px;
}

/* Kolory powiadomień */
.cphp-toast-success i { color: #2ecc71; }
.cphp-toast-info i { color: #3498db; }
.cphp-toast-error i { color: #e74c3c; }

/* Mobile: na dole ekranu */
@media (max-width: 600px) {
    .cphp-toast {
        top: auto;
        bottom: 30px;
        right: 50%;
        transform: translate(50%, 20px) scale(0.9);
        white-space: nowrap;
    }
    .cphp-toast.is-visible {
        transform: translate(50%, 0) scale(1);
    }
}