/* ==========================================================
   KRILIH.MA
   css/favoris.css
   VERSION V3 — CARTES FAVORIS PREMIUM
   ----------------------------------------------------------
   Compatible avec js/favoris.js V4
   - grille marketplace
   - une seule carte ne s'étire pas
   - image uniforme
   - localisation + vues sur la même ligne
   - actions alignées
   - responsive
   ========================================================== */


/* ==========================================================
   PAGE
   ========================================================== */

.favoris-container {
    width: min(1320px, calc(100% - 48px));
    min-height: 75vh;
    margin: 0 auto;
    padding: 54px 0 90px;
}


/* ==========================================================
   EN-TÊTE
   ========================================================== */

.favoris-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 30px;
    padding: 28px 32px;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            rgba(22, 128, 75, .09),
            rgba(249, 115, 22, .08)
        );
    border: 1px solid rgba(22, 128, 75, .14);
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(18, 60, 43, .06);
}

.favoris-header::before {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    top: -150px;
    right: 80px;
    border-radius: 50%;
    background:
        radial-gradient(
            circle,
            rgba(42, 207, 186, .22),
            transparent 68%
        );
    pointer-events: none;
}

.favoris-header-copy,
.favoris-count-card {
    position: relative;
    z-index: 1;
}

.favoris-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #16804b;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.favoris-kicker i {
    color: #ef4444;
}

.favoris-header h1 {
    margin: 0 0 7px;
    color: #17231d;
    font-size: clamp(27px, 3vw, 40px);
    line-height: 1.1;
    font-weight: 850;
}

.favoris-header p {
    max-width: 680px;
    margin: 0;
    color: #718078;
    font-size: 15px;
    line-height: 1.6;
}

.favoris-count-card {
    min-width: 108px;
    padding: 14px 18px;
    text-align: center;
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 18px;
    box-shadow: 0 9px 24px rgba(18, 60, 43, .08);
    backdrop-filter: blur(12px);
}

.favoris-count-card strong {
    display: block;
    color: #16804b;
    font-size: 27px;
    line-height: 1;
}

.favoris-count-card span {
    display: block;
    margin-top: 5px;
    color: #718078;
    font-size: 12px;
    font-weight: 700;
}


/* ==========================================================
   GRILLE
   ========================================================== */

.favoris-grid {
    width: 100%;
    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(290px, 380px)
        );
    justify-content: start;
    align-items: stretch;
    gap: 24px;
}


/* ==========================================================
   CARTE
   ========================================================== */

.favori-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    min-width: 0;
    overflow: hidden;
    background:
        linear-gradient(
            155deg,
            #ffffff 0%,
            #ffffff 64%,
            rgba(234, 248, 240, .72) 100%
        );
    border: 1px solid #e3e9e5;
    border-radius: 22px;
    box-shadow:
        0 11px 32px rgba(18, 60, 43, .08);
    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease;
}

.favori-card:hover {
    transform: translateY(-5px);
    border-color: rgba(22, 128, 75, .24);
    box-shadow:
        0 20px 42px rgba(18, 60, 43, .13);
}


/* ==========================================================
   IMAGE
   ========================================================== */

.favori-image {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            #f6faf7,
            #edf5f1
        );
    text-decoration: none;
}

.favori-card-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition:
        transform .35s ease;
}

.favori-card:hover .favori-card-image {
    transform: scale(1.035);
}

.favorite-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 12px;
    color: #b42318;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 999px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, .12);
    backdrop-filter: blur(10px);
    font-size: 12px;
    font-weight: 800;
}

.favorite-badge i {
    color: #ef4444;
}


/* ==========================================================
   CONTENU
   ========================================================== */

.favori-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 20px;
}

.favori-title {
    margin: 0 0 11px;
    min-height: 48px;
    color: #17231d;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 850;
}

.favori-title a {
    display: -webkit-box;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.favori-title a:hover {
    color: #16804b;
}


/* ==========================================================
   LOCALISATION + VUES
   ========================================================== */

.favori-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 14px;
    color: #718078;
    font-size: 13px;
}

.favori-city,
.favori-views {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.favori-city {
    max-width: calc(100% - 68px);
}

.favori-city i {
    color: #16804b;
}

.favori-views i {
    color: #718078;
}

.favori-city {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================
   PRIX
   ========================================================== */

.favori-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    margin-bottom: 18px;
}

.favori-price strong {
    color: #16804b;
    font-size: 23px;
    line-height: 1;
    font-weight: 900;
}

.favori-price span {
    color: #718078;
    font-size: 13px;
    font-weight: 700;
}


/* ==========================================================
   ACTIONS
   ========================================================== */

.favori-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: auto;
}

.favori-actions .btn-view,
.favori-actions .btn-remove {
    position: relative;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    overflow: hidden;
    border-radius: 13px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
}

.favori-actions .btn-view {
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            #1da66a,
            #16804b
        );
    border: 1px solid rgba(255, 255, 255, .30);
    box-shadow:
        0 5px 0 #0f6840,
        0 10px 20px rgba(22, 128, 75, .20),
        inset 0 1px 0 rgba(255, 255, 255, .28);
}

.favori-actions .btn-remove {
    color: #b42318;
    background:
        linear-gradient(
            135deg,
            #fff7f5,
            #ffe9e5
        );
    border: 1px solid #ffd0c8;
    box-shadow:
        0 5px 0 #efb0a6,
        0 10px 20px rgba(180, 35, 24, .10),
        inset 0 1px 0 rgba(255, 255, 255, .85);
}

.favori-actions .btn-view:hover,
.favori-actions .btn-remove:hover {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

.favori-actions .btn-view:active,
.favori-actions .btn-remove:active {
    transform: translateY(3px);
    box-shadow: none;
}

.favori-actions .btn-remove:disabled {
    cursor: wait;
    opacity: .6;
    transform: none;
}


/* ==========================================================
   SUPPRESSION
   ========================================================== */

.favori-card.removing {
    opacity: 0;
    transform:
        scale(.96)
        translateY(8px);
    pointer-events: none;
}


/* ==========================================================
   LOADING / EMPTY / ERROR
   ========================================================== */

.loading,
.empty-favoris,
.error-message {
    grid-column: 1 / -1;
}

.loading {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #718078;
}

.spinner {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border: 5px solid rgba(22, 128, 75, .13);
    border-top-color: #16804b;
    border-radius: 50%;
    animation: favorisSpin .8s linear infinite;
}

@keyframes favorisSpin {
    to {
        transform: rotate(360deg);
    }
}

.empty-favoris,
.error-message {
    width: min(620px, 100%);
    padding: 50px 28px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e3e9e5;
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(18, 60, 43, .06);
}

.empty-icon {
    width: 66px;
    height: 66px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    color: #ef4444;
    background: #fff1f0;
    border-radius: 50%;
    font-size: 27px;
}

.empty-favoris h3,
.error-message h3 {
    margin: 0 0 9px;
    color: #17231d;
    font-size: 22px;
}

.empty-favoris p,
.error-message p {
    margin: 0 0 20px;
    color: #718078;
}

.empty-favoris a,
.error-message button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    color: #ffffff;
    background: #16804b;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}


/* ==========================================================
   FOOTER
   ========================================================== */

footer {
    margin-top: auto;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 1050px) {

    .favoris-container {
        width: min(94%, 900px);
    }

    .favoris-grid {
        grid-template-columns:
            repeat(
                auto-fill,
                minmax(280px, 1fr)
            );
    }

    .favori-card {
        max-width: none;
    }

}

@media (max-width: 700px) {

    .favoris-container {
        width: min(94%, 600px);
        padding: 34px 0 70px;
    }

    .favoris-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px;
    }

    .favoris-count-card {
        min-width: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }

    .favoris-count-card strong,
    .favoris-count-card span {
        display: inline;
        margin: 0;
    }

    .favoris-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .favori-card {
        max-width: none;
    }

}

@media (max-width: 430px) {

    .favori-actions {
        grid-template-columns: 1fr;
    }

}


/* ==========================================================
   DARK MODE
   ========================================================== */

[data-theme="dark"] .favoris-header,
[data-theme="dark"] .favori-card,
[data-theme="dark"] .empty-favoris,
[data-theme="dark"] .error-message {
    background: #17231d;
    border-color: rgba(255, 255, 255, .08);
}

[data-theme="dark"] .favoris-header h1,
[data-theme="dark"] .favori-title,
[data-theme="dark"] .empty-favoris h3,
[data-theme="dark"] .error-message h3 {
    color: #f8faf9;
}

[data-theme="dark"] .favoris-header p,
[data-theme="dark"] .favori-meta,
[data-theme="dark"] .favori-price span,
[data-theme="dark"] .empty-favoris p,
[data-theme="dark"] .error-message p {
    color: #aab7b0;
}

[data-theme="dark"] .favoris-count-card {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .08);
}


/* ==========================================================
   ACCESSIBILITÉ
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    .favori-card,
    .favori-card-image,
    .favori-actions .btn-view,
    .favori-actions .btn-remove {
        transition: none !important;
    }

    .spinner {
        animation: none !important;
    }

}
