@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700;800&display=swap");

/* AfriDeals Market — styles du header uniquement. */
#afrideals-header,
#afrideals-header * { box-sizing: border-box; }

#afrideals-header {
    --header-blue: #123f70;
    --header-hover: #0b5ed7;
    --header-transition: .2s ease;
    position: relative;
    z-index: 999;
    width: 100%;
    color: #142d4d;
    background: #fff;
    font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
    box-shadow: 0 2px 15px rgba(0,0,0,.06);
}

#afrideals-header .header-container {
    width: min(96%, 1400px);
    margin-inline: auto;
}

#afrideals-header .header-top {
    padding: 10px 0;
    background: #fff;
    border-bottom: 1px solid #edf2f7;
}

#afrideals-header .header-flex {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#afrideals-header .logo { display: flex; align-items: center; flex: 0 0 auto; }
#afrideals-header .logo a { display: flex; align-items: center; }
#afrideals-header .logo img {
    display: block;
    width: auto;
    height: 58px;
    max-width: 190px;
    object-fit: contain;
    transition: transform var(--header-transition);
}
#afrideals-header .logo a:hover img { transform: scale(1.02); }

#afrideals-header .auth-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    min-width: 0;
}

#afrideals-header .header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 15px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    transition: background var(--header-transition), color var(--header-transition), transform var(--header-transition);
}
#afrideals-header .btn-login,
#afrideals-header .btn-dashboard { background: #13a3b8; }
#afrideals-header .btn-register { background: #ffc107; color: #102b4e; }
#afrideals-header .btn-logout { background: #e53245; }
#afrideals-header .btn-create { background: #ffc107; color: #102b4e; font-weight: 800; }

#afrideals-header .header-btn:hover,
#afrideals-header .header-btn:focus-visible {
    background: var(--header-hover);
    color: #fff;
    border-color: var(--header-hover);
    transform: translateY(-1px);
    outline: none;
}

#afrideals-header .menu {
    display: block;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #edf2f7;
}
#afrideals-header .menu-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 8px;
    padding-bottom: 8px;
}
#afrideals-header .menu-flex > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #142d4d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    transition: background var(--header-transition), color var(--header-transition), transform var(--header-transition);
}
#afrideals-header .menu-flex > a:hover,
#afrideals-header .menu-flex > a:focus-visible {
    background: #0b5ed7;
    color: #fff;
    border-color: #0b5ed7;
    transform: translateY(-1px);
    outline: none;
}

#afrideals-header .lang-switch { position: relative; display: inline-block; }
#afrideals-header .lang-title { display: none; }
#afrideals-header .lang-current {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    background: #f3f4f6;
    color: #26364b;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--header-transition), color var(--header-transition);
}
#afrideals-header .lang-current:hover,
#afrideals-header .lang-current:focus-visible {
    background: #0b5ed7;
    color: #fff;
    outline: none;
}
#afrideals-header .lang-arrow { font-size: 9px; transition: transform var(--header-transition); }
#afrideals-header .lang-switch.open .lang-arrow { transform: rotate(180deg); }
#afrideals-header .lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 1001;
    min-width: 170px;
    padding: 6px;
    border: 1px solid #edf2f7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
#afrideals-header .lang-switch.open .lang-dropdown { display: block; }
#afrideals-header .lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #26364b;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}
#afrideals-header .lang-option:hover,
#afrideals-header .lang-option:focus-visible { background: #0b5ed7; color: #fff; outline: none; }
#afrideals-header .lang-option.active { background: #eef4ff; color: #123f70; font-weight: 700; }
#afrideals-header .lang-option-name { flex: 1; }
#afrideals-header .lang-check { color: #13a3b8; font-weight: 800; }
#afrideals-header .flag { width: 18px; height: 18px; flex: 0 0 18px; object-fit: cover; border-radius: 50%; }

#afrideals-header .menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f3f4f6;
    color: #123f70;
    font-size: 23px;
    cursor: pointer;
}
#afrideals-header .menu-toggle:hover,
#afrideals-header .menu-toggle:focus-visible { background: #0b5ed7; color: #fff; outline: none; }

@media (max-width: 1050px) {
    #afrideals-header .menu-flex { gap: 2px; }
    #afrideals-header .menu-flex > a { padding: 9px 9px; font-size: 13px; }
}

@media (max-width: 768px) {
    #afrideals-header .header-container { width: calc(100% - 24px); }

    /* En-tête mobile : même identité visuelle que la version ordinateur. */
    #afrideals-header .header-top {
        padding: 8px 0 10px;
        background: #fff;
        border-bottom: 1px solid #e6edf5;
    }
    #afrideals-header .header-flex {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 46px;
        grid-template-areas: "logo toggle" "auth auth";
        gap: 10px 12px;
        padding: 3px 0 0;
    }
    #afrideals-header .logo { grid-area: logo; min-width: 0; }
    #afrideals-header .logo img { height: 48px; max-width: 165px; }

    #afrideals-header .menu-toggle {
        grid-area: toggle;
        display: inline-flex;
        width: 46px;
        height: 46px;
        border: 0;
        border-radius: 11px;
        background: #123f70;
        color: #fff;
        box-shadow: 0 3px 9px rgba(18,63,112,.18);
    }
    #afrideals-header .menu-toggle:hover,
    #afrideals-header .menu-toggle:focus-visible {
        background: #ffc107;
        color: #123f70;
    }

    #afrideals-header .auth-buttons {
        grid-area: auth;
        width: 100%;
        justify-content: flex-start;
        gap: 7px;
        flex-wrap: wrap;
    }
    #afrideals-header .header-btn {
        min-height: 38px;
        padding: 9px 12px;
        border-radius: 9px;
        font-size: 12px;
    }
    #afrideals-header .desktop-only { display: none; }

    /* Le panneau mobile reprend les couleurs et les contrastes du menu desktop. */
    #afrideals-header .menu {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        background: #fff;
        border-top: 1px solid #edf2f7;
        transform: translateY(-5px);
        transition: max-height .3s ease, opacity .2s ease, transform .3s ease;
    }
    #afrideals-header .menu.show {
        max-height: 1600px;
        opacity: 1;
        overflow: visible;
        transform: translateY(0);
    }
    #afrideals-header .menu-flex {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 5px 0 12px;
    }
    #afrideals-header .menu-flex > a {
        position: relative;
        width: 100%;
        min-height: 45px;
        justify-content: flex-start;
        padding: 12px 15px;
        border: 0;
        border-bottom: 1px solid #edf2f7;
        border-radius: 0;
        background: #fff;
        color: #142d4d;
        text-align: left;
        font-size: 14px;
    }
    #afrideals-header .menu-flex > a:hover,
    #afrideals-header .menu-flex > a:focus-visible {
        background: #eef4ff;
        color: #0b5ed7;
        border-color: #dce8fa;
        transform: none;
    }

    /* Liste des langues : grille régulière, lisible et sans défilement horizontal. */
    #afrideals-header .lang-switch {
        display: block;
        width: 100%;
        padding: 14px 12px 8px;
        border-bottom: 1px solid #edf2f7;
        background: #f8fafd;
    }
    #afrideals-header .lang-title {
        display: block;
        margin: 0 0 10px;
        color: #123f70;
        font-size: 12px;
        font-weight: 800;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
    #afrideals-header .lang-current { display: none; }
    #afrideals-header .lang-dropdown {
        position: static;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
        min-width: 0;
        padding: 0 0 5px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    #afrideals-header .lang-option {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
        min-height: 43px;
        gap: 9px;
        padding: 8px 10px;
        border: 1px solid #dfe7f0;
        border-radius: 10px;
        background: #fff;
        color: #26364b;
        font-size: 13px;
        font-weight: 600;
        white-space: normal;
        transition: background .2s ease, border-color .2s ease, color .2s ease;
    }
    #afrideals-header .lang-option:hover,
    #afrideals-header .lang-option:focus-visible {
        background: #eef4ff;
        border-color: #9dbbe4;
        color: #123f70;
    }
    #afrideals-header .lang-option.active {
        background: #eaf2ff;
        border: 1.5px solid #123f70;
        color: #123f70;
        font-weight: 800;
    }
    #afrideals-header .lang-option-name {
        flex: 1 1 auto;
        min-width: 0;
    }
    #afrideals-header .lang-check {
        margin-left: auto;
        color: #13a3b8;
        font-size: 15px;
    }
    #afrideals-header .flag {
        width: 23px;
        height: 23px;
        flex: 0 0 23px;
        object-fit: cover;
        border: 1px solid rgba(18,63,112,.12);
        border-radius: 50%;
    }
}

@media (max-width: 380px) {
    #afrideals-header .auth-buttons { gap: 5px; }
    #afrideals-header .header-btn { padding: 8px 9px; font-size: 11px; }
    #afrideals-header .logo img { max-width: 145px; }
    #afrideals-header .lang-dropdown { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    #afrideals-header .lang-option { padding: 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    #afrideals-header *, #afrideals-header *::before, #afrideals-header *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
