/* ============================================================
   HEADER - FindLoc
   Fond blanc, accents colorés par rôle
   ============================================================ */

/* ─── VARIABLES PAR RÔLE ─────────────────────────────────── */

.site-header.theme-visiteur {
    --role-color:       #1d4ed8;
    --role-color-light: #eff6ff;
    --role-color-mid:   #bfdbfe;
}

.site-header.theme-locataire {
    --role-color:       #059669;
    --role-color-light: #ecfdf5;
    --role-color-mid:   #a7f3d0;
}

.site-header.theme-proprietaire {
    --role-color:       #7c3aed;
    --role-color-light: #f5f3ff;
    --role-color-mid:   #ddd6fe;
}

/* ─── BASE ───────────────────────────────────────────────── */

.site-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 3px solid var(--role-color);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

/* ─── INNER ──────────────────────────────────────────────── */

.site-header__inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 68px;
    padding: 0 36px;
    display: grid;
    grid-template-columns: 200px 1fr 300px;
    align-items: center;
    gap: 16px;
}

/* ─── ZONES ──────────────────────────────────────────────── */

.site-header__left  { display: flex; align-items: center; }
.site-header__center { display: flex; align-items: center; justify-content: center; }
.site-header__right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ─── LOGO ───────────────────────────────────────────────── */

.site-header__logo-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.site-header__logo-img {
    height: 56px;
    width: auto;
    display: block;
}

.site-header__logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--role-color);
    letter-spacing: 0.3px;
    transition: opacity 0.15s ease;
}

.site-header__logo-link:hover .site-header__logo-text {
    opacity: 0.8;
}

/* ─── TITRE CONNECTÉ ─────────────────────────────────────── */

.site-header__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #374151;
    text-align: center;
}

/* ─── NAV VISITEUR ───────────────────────────────────────── */

.site-header__visitor-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.site-header__visitor-link {
    color: #4b5563;
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: default;
}

.site-header__visitor-link:hover {
    background: var(--role-color-light);
    color: var(--role-color);
}

/* ─── PROFIL CONNECTÉ ────────────────────────────────────── */

.site-header__profile {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    background: var(--role-color-light);
    border: 1.5px solid var(--role-color-mid);
    border-radius: 999px;
    padding: 5px 14px 5px 5px;
    transition: background 0.15s ease, transform 0.15s ease;
}

.site-header__profile:hover {
    background: var(--role-color-mid);
    transform: translateY(-1px);
}

.site-header__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--role-color-mid);
    background: var(--role-color-light);
    flex-shrink: 0;
}

.site-header__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--role-color);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── NOTIFICATION MESSAGERIE ────────────────────────────── */

.site-header__notif {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.site-header__notif svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.site-header__notif:hover {
    border-color: var(--role-color-mid);
    color: var(--role-color);
    background: var(--role-color-light);
}

.site-header__notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid #ffffff;
    pointer-events: none;
}

/* ─── DÉCONNEXION ────────────────────────────────────────── */

.site-header__logout {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.87rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.site-header__logout:hover {
    border-color: #f87171;
    color: #dc2626;
    background: #fff5f5;
}

/* ─── BOUTONS VISITEUR ───────────────────────────────────── */

.site-header__auth-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 8px 16px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    color: #374151;
    border: 1.5px solid transparent;
}

.site-header__auth-link:hover {
    background: var(--role-color-light);
    color: var(--role-color);
    transform: translateY(-1px);
}

.site-header__auth-link--button {
    background: var(--role-color);
    color: #ffffff;
    border-color: var(--role-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.site-header__auth-link--button:hover {
    background: var(--role-color);
    color: #ffffff;
    opacity: 0.88;
}

/* ─── HAMBURGER (caché sur desktop) ─────────────────────── */

.site-header__burger {
    display: none;
}

/* ─── MENU MOBILE (caché par défaut) ────────────────────── */

.site-header__mobile-menu {
    display: none;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 768px) {

    /* Barre du haut : logo à gauche, hamburger à droite */
    .site-header__inner {
        height: 58px;
        grid-template-columns: 1fr auto;
        grid-template-rows: 1fr;
        padding: 0 16px;
        gap: 0;
    }

    /* Cache le centre et la droite desktop */
    .site-header__center,
    .site-header__right {
        display: none;
    }

    /* Logo aligné à gauche */
    .site-header__left {
        justify-content: flex-start;
    }

    .site-header__logo-img {
        height: 42px;
    }

    .site-header__logo-text {
        font-size: 1.4rem;
    }

    /* ── Bouton hamburger ── */
    .site-header__burger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        background: none;
        border: 1.5px solid #e5e7eb;
        border-radius: 10px;
        cursor: pointer;
        padding: 0;
        transition: border-color 0.15s ease, background 0.15s ease;
        flex-shrink: 0;
    }

    .site-header__burger:hover {
        border-color: var(--role-color-mid);
        background: var(--role-color-light);
    }

    .site-header__burger-bar {
        display: block;
        width: 20px;
        height: 2px;
        background: #374151;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.25s ease;
        transform-origin: center;
    }

    /* Animation croix quand ouvert */
    .site-header__burger.is-open .site-header__burger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .site-header__burger.is-open .site-header__burger-bar:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .site-header__burger.is-open .site-header__burger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* ── Menu mobile déroulant ── */
    .site-header__mobile-menu {
        display: none;
        flex-direction: column;
        background: #ffffff;
        border-top: 1px solid #f3f4f6;
        padding: 12px 16px 20px;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }

    .site-header__mobile-menu.is-open {
        display: flex;
    }

    /* Profil en haut du menu (utilisateur connecté) */
    .site-header__mobile-profile {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 12px 16px;
        border-bottom: 1px solid #f3f4f6;
        margin-bottom: 8px;
    }

    .site-header__mobile-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--role-color-mid);
        flex-shrink: 0;
    }

    .site-header__mobile-name {
        font-weight: 700;
        font-size: 0.97rem;
        color: #111827;
    }

    /* Liens du menu mobile */
    .site-header__mobile-link {
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: #374151;
        font-size: 0.97rem;
        font-weight: 600;
        padding: 12px 12px;
        border-radius: 10px;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .site-header__mobile-link svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        color: #9ca3af;
        transition: color 0.15s ease;
    }

    .site-header__mobile-link:hover {
        background: var(--role-color-light);
        color: var(--role-color);
    }

    .site-header__mobile-link:hover svg {
        color: var(--role-color);
    }

    .site-header__mobile-link--logout {
        color: #dc2626;
        margin-top: 8px;
        border-top: 1px solid #f3f4f6;
        padding-top: 16px;
        border-radius: 0;
    }

    .site-header__mobile-link--logout:hover {
        background: #fff5f5;
        color: #dc2626;
    }

    .site-header__mobile-link--logout svg {
        color: #dc2626;
    }

    /* Badge non lu dans le menu mobile */
    .site-header__mobile-badge {
        margin-left: auto;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 999px;
        background: #ef4444;
        color: #ffffff;
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 20px;
        text-align: center;
    }

    /* Boutons Se connecter / S'inscrire dans le menu visiteur */
    .site-header__mobile-auth {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f3f4f6;
    }

    .site-header__mobile-auth-link {
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 700;
        border-radius: 10px;
        padding: 12px 20px;
        border: 1.5px solid #e5e7eb;
        color: #374151;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .site-header__mobile-auth-link:hover {
        background: var(--role-color-light);
        color: var(--role-color);
        border-color: var(--role-color-mid);
    }

    .site-header__mobile-auth-link--button {
        background: var(--role-color);
        color: #ffffff;
        border-color: var(--role-color);
    }

    .site-header__mobile-auth-link--button:hover {
        opacity: 0.88;
        color: #ffffff;
    }
}
