/* ================================================================
   public/css/header.css
   Styles du header — thème clair & sombre
   ================================================================ */

@import '../globals/navbutton.css';

/* ── HEADER ────────────────────────────────────────────────────── */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 72px;
    padding: 0 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1.5rem;

    background: var(--nav-bg-light);
    backdrop-filter: blur(var(--blur-sm)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur-sm)) saturate(1.4);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--duration-slow) ease, border-color var(--duration-slow) ease;
}
[data-theme="dark"] header {
    background: var(--nav-bg-dark);
    border-bottom-color: var(--border-dark);
}

/* ── GROUPE GAUCHE : logo + nav ────────────────────────────────── */
.header-left {
    display: flex !important;
    align-items: center !important;
    gap: 1.25rem;
    flex-shrink: 0;
}

/* ── LOGO ──────────────────────────────────────────────────────── */
.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    flex-shrink: 0;
    height: 40px;
}

.logo img {
    height: 100%;
    width: auto;
    transition: opacity var(--duration-slow) ease, display var(--duration-slow) ease;
}

/* Afficher le logo clair par défaut, masquer le logo sombre */
.logo .logo-light {
    opacity: 1;
}
.logo .logo-dark {
    opacity: 0;
    display: none;
}

/* En mode sombre, afficher le logo sombre et masquer le logo clair */
[data-theme="dark"] .logo .logo-light {
    opacity: 0;
    display: none;
}
[data-theme="dark"] .logo .logo-dark {
    opacity: 1;
    display: block;
}

/* Hover effect */
.logo:hover {
    transform: scale(1.05);
}
.logo:hover img {
    filter: drop-shadow(0 0 8px var(--violet-glow));
}

/* ── NAVIGATION ────────────────────────────────────────────────── */
header nav {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    flex-wrap: nowrap;
}

/* ── LIENS DROPDOWN ─────────── */
header .header-dropdown .dropdown-link {
    all: unset;

    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;

    /* Dimensions */
    padding: 0.55rem 1.1rem !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-light) !important;
    background: transparent !important;

    /* Typographie */
    font-family: 'Syne', sans-serif !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
    color: var(--muted-light) !important;

    transition:
        color var(--duration-normal) ease,
        background var(--duration-normal) ease,
        border-color var(--duration-normal) ease,
        box-shadow var(--duration-normal) ease,
        transform var(--duration-fast) ease !important;
}

[data-theme="dark"] header .header-dropdown .dropdown-link {
    border-color: var(--border-dark) !important;
    color: var(--muted-dark) !important;
}

/* Hover */
header .header-dropdown .dropdown-link:hover {
    color: var(--violet) !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-1px) !important;
    box-shadow: none !important;
}
[data-theme="dark"] header .header-dropdown .dropdown-link:hover {
    color: var(--violet-light) !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Actif — fond violet léger + bordure violet */
header .header-dropdown .dropdown-link.active {
    color: var(--violet) !important;
    background: var(--pill-bg-light) !important;
    border-color: rgba(124, 58, 237, 0.30) !important;
    font-weight: 700 !important;
}
[data-theme="dark"] header .header-dropdown .dropdown-link.active {
    color: var(--violet-light) !important;
    background: var(--pill-bg-dark) !important;
    border-color: rgba(167, 139, 250, 0.30) !important;
}

/* Actif + hover — glow subtil */
header .header-dropdown .dropdown-link.active:hover {
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.20) !important;
}

/* Pas de pseudo-élément soulignement */
header .header-dropdown .dropdown-link::before,
header .header-dropdown .dropdown-link::after { display: none !important; }

/* ── ACTIONS (droite) ──────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ── BOUTON THÈME ──────────────────────────────────────────────── */
.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-light);
    transition: color var(--duration-medium) ease, background var(--duration-medium) ease, border-color var(--duration-medium) ease, transform var(--duration-slow) ease;
}
[data-theme="dark"] .theme-btn {
    border-color: var(--border-dark);
    color: var(--muted-dark);
}
.theme-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--violet);
    transform: rotate(20deg);
}
[data-theme="dark"] .theme-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--violet-light);
}

.icon-sun  { display: block; }
.icon-moon { display: none;  }
[data-theme="dark"] .icon-sun  { display: none;  }
[data-theme="dark"] .icon-moon { display: block; }

/* ── BOUTON CONNEXION ──────────────────────────────────────────── */
.login-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-light);
    text-decoration: none;
    transition: background var(--duration-normal) ease, border-color var(--duration-normal) ease, color var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}
[data-theme="dark"] .login-btn {
    border-color: var(--border-dark);
    color: var(--text-dark);
}
.login-btn:hover {
    background: var(--violet);
    border-color: var(--violet);
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

/* ── DROPDOWN CONNEXION ────────────────────────────────────────── */
.header-wrapper { position: relative; }

.header-dropdown {
    z-index: 100;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--nav-bg-light-so);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    animation: dropdown-in var(--duration-normal) ease;
}
[data-theme="dark"] .header-dropdown {
    background: var(--nav-bg-dark-so);
    border-color: var(--border-dark);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.header-dropdown.open { display: flex; }

@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── FORMULAIRE DANS LE DROPDOWN ───────────────────────────────── */
.dropdown-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-light);
}
[data-theme="dark"] .dropdown-title { color: var(--text-dark); }

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.form-field label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-light);
}
[data-theme="dark"] .form-field label { color: var(--muted-dark); }

.form-field input {
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.03);
    padding: 0 0.75rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    color: var(--text-light);
    outline: none;
    transition: border-color var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}
[data-theme="dark"] .form-field input {
    border-color: var(--border-dark);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dark);
}
.form-field input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px var(--violet-glow);
}

.submit-btn {
    width: 100%;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: var(--violet);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--duration-normal) ease, box-shadow var(--duration-normal) ease, transform var(--duration-fast) ease;
}
.submit-btn:hover {
    background: #6d28d9;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

/* ── PHOTO DE PROFIL ───────────────────────────────────────────── */
.profile-pic {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;          /* crop centré, pas d'étirement */
    object-position: center;
    border: 1.5px solid var(--border-light);
    background: rgba(0, 0, 0, 0.06); /* fallback si l'image met du temps */
    flex-shrink: 0;
    display: block;
    transition: border-color var(--duration-normal) ease;
}
[data-theme="dark"] .profile-pic {
    border-color: var(--border-dark);
}
/* Légère surbrillance au hover du bouton parent */
.login-btn:hover .profile-pic {
    border-color: rgba(255, 255, 255, 0.5);
}

/* ── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    header nav   { display: none !important; }
    header       { padding: 0 1rem !important; }
    .header-left { gap: 0; }
}

/* ── MESSAGE D'ERREUR DANS LE DROPDOWN ─────────────────────────── */
.login-error {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.login-error .alert-danger {
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #dc3545;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    font-size: 0.813rem;
    font-weight: 500;
}

[data-theme="dark"] .login-error .alert-danger {
    border-color: #ff6b7a;
    background: rgba(255, 107, 122, 0.15);
    color: #ff8a9b;
}
