/* =========================================
   CP HEART PRO - PROFESSIONAL STYLES v7.1
   (Wersja z pancerną ochroną przed motywami)
   ========================================= */

:root {
    --cphp-act: #fe5b3e; /* Kolor aktywny (nadpisywany z panelu admina) */
    --cphp-dark: #002f34; /* Kolor tekstu a'la OLX */
    --cphp-gray: #7f9799;
    --cphp-bg: #f2f4f5;
    --cphp-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* --- KONTENER PRZYCISKÓW (Zawsze na wierzchu) --- */
.cphp-container {
    position: absolute !important; 
    z-index: 999999 !important; /* Ekstremalnie wysoki z-index */
    display: flex !important; 
    gap: 8px; 
    pointer-events: none !important; /* Zapobiega blokowaniu kliknięć w tło */
}

.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; }

/* Przyciski (Serce i Share) - Odporne na ukrywanie */
.cphp-btn, .cphp-share {
    pointer-events: auto !important; /* Przywracamy klikalność tylko dla przycisku */
    background: #fff !important;
    border-radius: 50% !important;
    width: 40px !important; 
    height: 40px !important;
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; /* Mocniejszy cień, by się odcinał */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s !important;
    cursor: pointer !important;
    border: none !important;
    opacity: 1 !important; /* Blokujemy motywom przezroczystość */
    visibility: visible !important; /* Wymuszenie widoczności */
}

.cphp-btn:hover, .cphp-share:hover { 
    transform: scale(1.1) !important; 
}

/* Dostępność: widoczny focus przy używaniu klawiatury */
.cphp-btn:focus-visible, .cphp-share:focus-visible, .cphp-card-remove:focus-visible {
    outline: 2px solid var(--cphp-act);
    outline-offset: 2px;
}

.cphp-btn svg, .cphp-share svg { 
    width: 22px !important; 
    height: 22px !important; 
    fill: #555; 
    transition: fill 0.3s ease;
}

.cphp-btn.is-active svg { 
    fill: var(--cphp-act) !important; 
}

/* Animacja bicia serca przy kliknięciu */
@keyframes cphpHeartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cphp-btn.cphp-animate svg {
    animation: cphpHeartbeat 0.3s ease-out;
}

/* Wskaźnik ładowania (AJAX) */
.cphp-btn.load {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

/* --- GRID MOJE ULUBIONE (Shortcode) --- */
.cphp-fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin: 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Karta Ogłoszenia */
.cphp-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #eaeaea;
}

.cphp-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* Sekcja Zdjęcia (4:3 Aspect Ratio) */
.cphp-card-img-wrap {
    display: block;
    position: relative;
    width: 100%;
    padding-top: 75%; /* Aspect Ratio 4:3 */
    background: #f5f5f5;
    overflow: hidden;
}

.cphp-card-img-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; 
    height: 100%;
    object-fit: cover; 
    transition: transform 0.4s ease;
}

.cphp-card:hover .cphp-card-img-wrap img {
    transform: scale(1.05);
}

/* Cena na dole zdjęcia (Gradient tła dla czytelności) */
.cphp-card-price {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    padding: 24px 12px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Przycisk Usuń (X) */
.cphp-card-remove {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 10;
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    opacity: 0; /* Pokazuje się dopiero po najechaniu kartą (czystszy design) */
    transition: all 0.2s ease;
}

.cphp-card:hover .cphp-card-remove {
    opacity: 1;
}

.cphp-card-remove:hover { 
    transform: scale(1.1); 
    background: #fff; 
}

.cphp-card-remove svg { 
    width: 16px; 
    height: 16px; 
    fill: #e74c3c; 
}

/* Treść karty */
.cphp-card-body {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cphp-card-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--cphp-dark);
}

.cphp-card-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.cphp-card-title a:hover { 
    color: var(--cphp-act); 
}

.cphp-card-meta {
    margin-top: auto;
    font-size: 12px;
    color: var(--cphp-gray);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cphp-card-loc {
    display: flex; 
    align-items: center; 
    gap: 6px;
}

.cphp-card-loc svg { 
    width: 14px; 
    height: 14px; 
    fill: var(--cphp-gray); 
}

.cphp-card-date {
    font-size: 11px;
    opacity: 0.8;
}

/* Pusty stan */
.cphp-alert-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

.cphp-alert-empty svg { 
    width: 50px; 
    height: 50px; 
    fill: #cbd5e1; 
    margin-bottom: 16px; 
}

.cphp-alert-empty h3 { 
    margin: 0 0 8px; 
    color: var(--cphp-dark); 
    font-size: 18px;
}

.cphp-alert-empty p { 
    color: var(--cphp-gray); 
    margin: 0; 
}

/* TOAST (Powiadomienia) */
.cphp-toast {
    position: fixed; 
    top: 20px; 
    right: 20px; 
    z-index: 999999;
    background: #fff; 
    padding: 14px 20px; 
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex; 
    align-items: center; 
    gap: 12px;
    font-weight: 600; 
    font-size: 14px; 
    color: var(--cphp-dark);
    transform: translateY(-20px) scale(0.95); 
    opacity: 0; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid #2ecc71; /* Zielony pasek po lewej */
}

.cphp-toast.is-visible { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
}

/* --- AGRESYWNE FIXY CLASSIPRESS --- */
/* Wymuszamy, aby tło/zdjęcie nie obcinało nakładek i miało kontekst pozycjonowania */
.item-cover, 
.slide-cover, 
.entry-cover,
article figure,
.post-block figure,
.listing-item figure { 
    position: relative !important; 
    overflow: visible !important; 
    z-index: 1 !important;
}

/* RWD - Urządzenia Mobilne */
@media (max-width: 576px) {
    .cphp-fav-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); /* Dwie mniejsze kolumny na tel */
        gap: 12px;
    }
    
    .cphp-card-title {
        font-size: 14px;
    }
    
    .cphp-card-price {
        font-size: 14px;
        padding: 16px 10px 8px 10px;
    }

    /* Pokazuj "X" od razu na telefonach (bo nie ma hovera) */
    .cphp-card-remove {
        opacity: 0.9;
    }
}