/* ========================================
   HEADER.CSS — LE VESTIAIRE DES PRONOS
   Emplacement conseillé :
   /assets/css/components/header.css

   Ce fichier remplace les anciennes versions
   présentes dans "layout" et "components".
======================================== */

/* ========================================
   STRUCTURE DU HEADER
======================================== */

.header,
header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 25px;
    color: #ffffff;
    background: linear-gradient(180deg, #020617, #0f172a);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.25);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
}

/* ========================================
   LOGO
======================================== */

.logo-link {
    color: inherit;
    text-decoration: none;
}

.logo-box {
    width: 300px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-box-title {
    display: flex;
    flex-direction: column;
}

.logo-box h1 {
    margin: 0;
    padding-top: 10px;
    font-family: "Bebas Neue", sans-serif;
    font-size: 30px;
    font-weight: 300;
    line-height: 30px;
    letter-spacing: 2px;
}

.logo-box h2 {
    margin: 0;
    font-family: "Bebas Neue", sans-serif;
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 2px;
}

.header img,
header img {
    width: 100px;
    height: 100px;
}

/* ========================================
   NAVIGATION PRINCIPALE
======================================== */

.nav {
    margin-left: auto;
    margin-right: 35px;
}

.nav ul {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav li {
    list-style: none;
}

.nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 2px;
    background-color: #a3e635;
    transition: width 0.3s ease;
}

.nav a:hover,
.nav a.active {
    color: #a3e635;
}

.nav a:hover::after,
.nav a.active::after {
    width: 100%;
}

/* ========================================
   BOUTON CONNEXION / DÉCONNEXION
======================================== */

.connect-btn {
    flex: 0 0 auto;
    margin-right: 25px;
    padding: 12px 28px;
    border: 1px solid #a3e635;
    border-radius: 12px;
    color: #a3e635;
    background: transparent;
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

.connect-btn:hover {
    color: #020617;
    background-color: #a3e635;
    box-shadow: 0 0 15px rgba(163, 230, 53, 0.4);
    transform: translateY(-2px);
}

/* ========================================
   MENUS DÉROULANTS
======================================== */

.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    z-index: 1000;

    min-width: 180px;
    padding: 10px;
    margin: 0;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;

    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(12px);

    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(163, 230, 53, 0.05);
    backdrop-filter: blur(14px);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0.2s ease;
}

.dropdown-content li {
    width: 100%;
}

.dropdown-content a {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 14px;
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    box-sizing: border-box;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.dropdown-content a::after {
    display: none;
}

.dropdown-content a:hover {
    color: #a3e635;
    background: rgba(163, 230, 53, 0.1);
    transform: translateX(4px);
}

.dropdown:hover>.dropdown-content,
.dropdown:focus-within>.dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   SOUS-MENU DES COMPÉTITIONS
======================================== */

.competition-dropdown-content {
    min-width: 290px;
    max-width: 360px;
    max-height: 420px;
    overflow-y: auto;
}

/*
   Structure recommandée dans header.php :

   <a class="competition-menu-link">
       <span class="competition-menu-text">
           <span class="competition-menu-name">Ligue 1</span>
           <span class="competition-menu-season">2026-2027</span>
       </span>
       <span class="competition-menu-preview">Aperçu</span>
   </a>
*/

.competition-dropdown-content .competition-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.competition-menu-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.competition-menu-name {
    max-width: 220px;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.competition-menu-season {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.competition-menu-preview {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 999px;
    color: #fde047;
    background: rgba(250, 204, 21, 0.1);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.competition-menu-link:hover .competition-menu-name {
    color: #a3e635;
}

.competition-menu-link:hover .competition-menu-season {
    color: #bef264;
}

.competition-menu-link:hover .competition-menu-preview {
    color: #fef08a;
    border-color: rgba(250, 204, 21, 0.45);
}

/*
   Compatibilité temporaire avec l'ancien HTML :
   nom en texte brut + <span class="competition-menu-meta">...</span>
*/
.competition-dropdown-content a:not(.competition-menu-link) {
    justify-content: space-between;
    gap: 12px;
    white-space: nowrap;
}

.competition-menu-meta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin-left: auto;
}

/* ========================================
   ALERTE ÉVENTUELLE DU SITE
======================================== */

.site-alert {
    max-width: 1100px;
    margin: 18px auto;
    padding: 14px 18px;
    border: 1px solid rgba(250, 204, 21, 0.35);
    border-radius: 12px;
    color: #fde68a;
    background: rgba(250, 204, 21, 0.12);
    text-align: center;
    font-weight: 600;
}

/* ========================================
   RESPONSIVE MOBILE — CORRECTION DU HEADER
======================================== */

@media (max-width: 900px) {

    /*
       Sur mobile, le header ne doit plus être fixed :
       il reste dans le flux de la page et ne masque plus le contenu.
    */
    .header,
    header {
        position: relative;
        top: auto;
        left: auto;

        flex-direction: column;
        justify-content: flex-start;
        gap: 14px;

        padding: 16px;
    }

    .logo-link {
        align-self: center;
    }

    .logo-box {
        width: auto;
        justify-content: center;
        gap: 12px;
    }

    .header img,
    header img {
        width: 72px;
        height: 72px;
    }

    .logo-box h1 {
        padding-top: 0;
        font-size: 25px;
        line-height: 1;
    }

    .logo-box h2 {
        font-size: 16px;
    }

    .nav {
        width: 100%;
        margin: 0;
    }

    /*
       Les liens sont répartis en trois colonnes compactes
       pour éviter un header de plusieurs centaines de pixels.
    */
    .nav>ul {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .nav>ul>li {
        min-width: 0;
    }

    .nav>ul>li>a {
        width: 100%;
        min-height: 40px;

        justify-content: center;
        padding: 8px 4px;

        border-radius: 10px;
        background: rgba(255, 255, 255, 0.025);

        font-size: 13px;
        line-height: 1.2;
        text-align: center;
        box-sizing: border-box;
    }

    .nav>ul>li>a::after {
        left: 20%;
        bottom: 2px;
    }

    .nav>ul>li>a:hover::after,
    .nav>ul>li>a.active::after {
        width: 60%;
    }

    .connect-btn {
        margin: 0;
        padding: 10px 26px;
        border-radius: 999px;
        font-size: 15px;
    }

    .dropdown-content {
        top: calc(100% + 8px);
        min-width: 220px;
        max-width: calc(100vw - 24px);
    }

    .competition-dropdown-content {
        min-width: min(290px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 420px) {

    .header,
    header {
        gap: 12px;
        padding: 14px 10px;
    }

    .header img,
    header img {
        width: 64px;
        height: 64px;
    }

    .logo-box h1 {
        font-size: 22px;
    }

    .logo-box h2 {
        font-size: 14px;
    }

    .nav>ul {
        gap: 6px;
    }

    .nav>ul>li>a {
        min-height: 38px;
        padding: 7px 3px;
        font-size: 12px;
    }

    .connect-btn {
        padding: 9px 23px;
        font-size: 14px;
    }
}

/* ========================================
   MENU MONDIAL 2026 REGROUPÉ
======================================== */

.world-cup-dropdown-content {
    min-width: 235px;
}

.dropdown-section-title {
    width: 100%;

    padding: 9px 13px 5px;

    color: #64748b;

    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    line-height: 1.2;
    text-transform: uppercase;

    box-sizing: border-box;
}

.dropdown-section-title:not(:first-child) {
    margin-top: 5px;
    padding-top: 11px;

    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.dropdown-content a.active {
    color: #a3e635;
    background: rgba(163, 230, 53, 0.1);
}

.dropdown-content a.active:hover {
    transform: none;
}

/*
 * Le menu principal contient désormais moins de liens.
 * On conserve néanmoins un espacement adaptatif afin d'éviter
 * les chevauchements sur les écrans intermédiaires.
 */
@media screen and (max-width: 1250px) and (min-width: 901px) {
    .nav ul {
        gap: 20px;
    }

    .nav {
        margin-right: 22px;
    }

    .nav a {
        font-size: 14px;
    }

    .connect-btn {
        margin-right: 18px;
        padding-right: 20px;
        padding-left: 20px;
    }
}

@media screen and (max-width: 900px) {
    .world-cup-dropdown-content {
        min-width: min(245px, calc(100vw - 24px));
    }

    .dropdown-section-title {
        text-align: left;
    }
}

/* ========================================
   SOUS-MENUS SUR MOBILE
======================================== */

@media screen and (max-width: 900px) {

    /*
     * Le header est relatif sur mobile.
     * Les menus déroulants se placent donc par rapport à l'ensemble
     * du header, et non plus par rapport à leur petite case de navigation.
     */
    .header,
    header {
        overflow: visible;
    }

    .nav {
        position: static;
    }

    .nav .dropdown {
        position: static;
    }

    .nav .dropdown-content {
        position: absolute;
        top: calc(100% + 8px);
        right: 12px;
        left: 12px;

        width: auto;
        min-width: 0;
        max-width: none;
        max-height: min(60vh, 420px);

        overflow-x: hidden;
        overflow-y: auto;

        transform: translateY(10px);
    }

    .nav .competition-dropdown-content,
    .nav .world-cup-dropdown-content {
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .nav .dropdown:hover > .dropdown-content,
    .nav .dropdown:focus-within > .dropdown-content {
        transform: translateY(0);
    }

    .nav .dropdown-content a {
        justify-content: flex-start;

        min-height: 46px;
        padding: 12px 14px;

        text-align: left;
    }

    .nav .competition-dropdown-content .competition-menu-link {
        justify-content: space-between;
    }
}

@media screen and (max-width: 420px) {

    .nav .dropdown-content {
        right: 8px;
        left: 8px;
    }
}

/* ========================================
   FERMETURE AU TOUCHER HORS DU MENU
======================================== */

@media screen and (max-width: 900px) {

    /*
     * Sur les écrans tactiles, :hover et :focus-within peuvent
     * rester actifs après un toucher. L'ouverture est donc pilotée
     * uniquement par la classe .is-open ajoutée par le header.
     */
    .nav .dropdown:hover > .dropdown-content,
    .nav .dropdown:focus-within > .dropdown-content {
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
    }

    .nav .dropdown.is-open > .dropdown-content,
    .nav .dropdown.is-open:hover > .dropdown-content,
    .nav .dropdown.is-open:focus-within > .dropdown-content {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

