/* SPHAERO - Responsive Design */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; background: #f5f5f5; }
img { max-width: 100%; height: auto; }

/* NAVBAR FIXE */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255,255,255,1);
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    display: flex;
    align-items: center;
    padding: 0 30px;
    height: 70px;
    gap: 16px;
}

/* Compensation navbar fixe */
body { padding-top: 70px; }

/* Logo */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}
.navbar-logo img { height: 48px; width: 48px; object-fit: contain; }
.navbar-nom { font-size: 1.3em; font-weight: 800; color: #C8860A; letter-spacing: 2px; white-space: nowrap; }

/* Barre de recherche */
.navbar-search {
    flex: 1;
    max-width: 420px;
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 6px 16px;
    gap: 8px;
    border: 1.5px solid transparent;
    transition: border-color 0.2s;
}
.navbar-search:focus-within { background: #fff; border-color: #C8860A; }
.navbar-search input { border: none; background: transparent; outline: none; font-size: 0.88em; width: 100%; font-family: inherit; }
.navbar-search button { border: none; background: none; cursor: pointer; color: #C8860A; font-size: 1em; padding: 0; }

/* Liens navbar */
.navbar-liens { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.navbar-lien-texte { color: #555; text-decoration: none; font-size: 0.9em; font-weight: 500; }
.navbar-lien-texte:hover { color: #1B4B91; }
.btn-connexion { background: #1B4B91; color: white; padding: 7px 16px; border-radius: 20px; font-weight: 700; font-size: 0.85em; text-decoration: none; white-space: nowrap; }
.btn-connexion:hover { background: #2C7BE5; }
.btn-inscrire, .btn-abonner { background: #C8860A; color: white; padding: 7px 16px; border-radius: 20px; font-weight: 700; font-size: 0.85em; text-decoration: none; white-space: nowrap; }
.btn-inscrire:hover, .btn-abonner:hover { background: #F0A500; }
.langue-form { display: flex; gap: 4px; }
.langue-btn { border: 1.5px solid transparent; background: transparent; font-size: 0.78em; font-weight: 700; letter-spacing: 0.3px; cursor: pointer; color: #999; font-family: inherit; padding: 4px 7px; border-radius: 6px; }
.langue-btn:hover { color: #1B4B91; }
.langue-btn.actif { color: #1B4B91; border-color: #e0e0e0; background: #f5f5f5; }

/* Navigation principale (Lot G) : visible en permanence sur desktop/laptop,
   masquee des la tablette au profit du menu burger (voir media queries). */
.navbar-nav-desktop { display: flex; align-items: center; gap: 22px; margin-left: 8px; flex-shrink: 0; }
.navbar-nav-desktop a { color: #1B4B91; text-decoration: none; font-weight: 600; font-size: 0.9em; white-space: nowrap; }
.navbar-nav-desktop a:hover { color: #C8860A; }

/* Burger (Lot G) : reserve au mobile/tablette (<=768px), masque par
   defaut sur desktop/laptop ou la barre de navigation ci-dessus prend
   le relais - voir media query 768px pour le remettre visible. */
.menu-burger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; width: 40px; height: 40px; border: none; background: none; cursor: pointer; border-radius: 8px; padding: 6px; }
.menu-burger:hover { background: #f0f0f0; }
.menu-burger span { display: block; width: 22px; height: 2px; background: #333; border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.menu-burger.ouvert span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-burger.ouvert span:nth-child(2) { opacity: 0; }
.menu-burger.ouvert span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu dropdown */
.menu-dropdown { display: none; position: fixed; top: 70px; right: 16px; width: 240px; background: white; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); z-index: 10000; overflow: hidden; }
.menu-dropdown.actif { display: block; }
.menu-search-mobile { display: none; padding: 12px; border-bottom: 1px solid #f5f5f5; gap: 8px; align-items: center; background: #f8f8f8; }
.menu-search-mobile input { flex: 1; border: 1px solid #e0e0e0; border-radius: 20px; padding: 7px 14px; font-size: 0.85em; outline: none; font-family: inherit; }
.menu-search-mobile button { border: none; background: #C8860A; color: white; padding: 7px 12px; border-radius: 20px; cursor: pointer; }
.menu-dropdown-liens a { display: flex; align-items: center; gap: 10px; padding: 13px 20px; color: #333; text-decoration: none; font-size: 0.92em; font-weight: 500; border-bottom: 1px solid #f5f5f5; transition: background 0.15s; }
.menu-dropdown-liens a:last-child { border-bottom: none; }
.menu-dropdown-liens a:hover { background: #fff8e1; color: #C8860A; }
.menu-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 9998; }
.menu-overlay.actif { display: block; }

/* Messages */
.messages-container { position: fixed; top: 80px; right: 16px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; max-width: 360px; width: calc(100% - 32px); }
.message { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 10px; font-size: 0.9em; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.message-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.message-error, .message-danger { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.message-warning { background: #fff3e0; color: #e65100; border-left: 4px solid #e65100; }
.message-info { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }
.message-close { border: none; background: none; cursor: pointer; color: inherit; opacity: 0.6; font-size: 1em; padding: 0; }

/* Layouts sidebar */
.ep-layout, .bo-layout, .inst-layout { display: grid; min-height: calc(100vh - 70px); }
.ep-layout { grid-template-columns: 250px 1fr; }
.bo-layout { grid-template-columns: 260px 1fr; }
.inst-layout { grid-template-columns: 240px 1fr; }

/* KPI grilles */
.kpi-grid, .stats-grid { display: grid; gap: 15px; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.stats-grid { grid-template-columns: repeat(4, 1fr); }

/* Footer */
.footer-principal { background: #1B4B91; color: rgba(255,255,255,0.85); }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; max-width: 1200px; margin: 0 auto; padding: 50px 30px 30px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-logo { font-size: 1.6em; font-weight: 800; color: #C8860A; letter-spacing: 2px; }
.footer-col p { font-size: 0.85em; line-height: 1.7; opacity: 0.75; margin: 0; }
.footer-col h4 { font-size: 0.82em; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #C8860A; margin: 0 0 4px; }
.footer-col a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 0.88em; }
.footer-col a:hover { color: white; }
.footer-bas { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto; padding: 16px 30px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.82em; opacity: 0.7; flex-wrap: wrap; gap: 10px; }
.footer-badges { display: flex; gap: 8px; }
.badge-oa, .badge-doi, .badge-oai { padding: 3px 10px; border-radius: 10px; font-size: 0.8em; font-weight: 700; border: 1px solid rgba(255,255,255,0.3); }

/* LAPTOP (768-1024px) */
@media (max-width: 1024px) {
    .navbar { padding: 0 20px; }
    .navbar-search { max-width: 300px; }
    .navbar-nav-desktop { gap: 14px; margin-left: 4px; }
    .navbar-nav-desktop a { font-size: 0.84em; }
    .ep-layout { grid-template-columns: 220px 1fr; }
    .bo-layout { grid-template-columns: 230px 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
    .footer-brand { grid-column: 1 / -1; }
}

/* TABLETTE (576-768px) */
@media (max-width: 768px) {
    body { padding-top: 120px; overflow-x: hidden; }
    .navbar { padding: 0 12px; height: auto; min-height: 60px; flex-wrap: wrap; }
    .navbar-logo img { height: 40px; width: 40px; }
    .navbar-nom { font-size: 1em; letter-spacing: 1px; }
    .navbar-search { display: none; }
    .navbar-nav-desktop { display: none; }
    /* 02-03/09/2026 (Severine) : Login et S'inscrire doivent rester visibles
       sur mobile (premier contact majoritairement par telephone) - ni l'un
       ni l'autre ne doit disparaitre sous le menu burger comme avant.
       03/09/2026 (suite) : les deux doivent avoir le meme style sobre et
       compact que le selecteur de langue FR/EN (texte simple, pas de bouton
       colore qui mettrait S'inscrire en avant par rapport a Connexion). */
    .btn-inscrire, .navbar-lien-texte {
        background: transparent !important;
        color: #999 !important;
        padding: 4px 7px !important;
        border-radius: 6px !important;
        font-weight: 700 !important;
        font-size: 0.78em !important;
        border: 1.5px solid transparent !important;
        margin-right: 4px !important;
        white-space: nowrap;
    }
    .btn-inscrire:hover, .navbar-lien-texte:hover { color: #1B4B91 !important; }
    /* 03/09/2026 (Severine) : sur un ecran etroit ou avec un agrandissement
       de police active (accessibilite Android), Connexion/S'inscrire en
       francais (plus longs qu'en anglais) pouvaient deborder hors du cadre
       du menu et devenir invisibles (caches par overflow-x:hidden sur le
       body) au lieu de passer a la ligne - navbar-liens ne wrappait pas en
       interne, seul .navbar le faisait au niveau de ses propres enfants
       directs. flex-wrap ici garantit qu'en cas de manque de place, ces
       elements restent visibles sur une deuxieme ligne plutot que de
       disparaitre silencieusement. */
    .navbar-liens { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
    .menu-burger { display: flex; }
    .menu-dropdown { top: 60px; right: 0; left: 0; width: 100%; border-radius: 0 0 14px 14px; }
    .menu-search-mobile { display: flex; }
    .ep-layout, .bo-layout, .inst-layout { grid-template-columns: 1fr; }
    .ep-sidebar, .bo-sidebar, .inst-sidebar { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; padding: 30px 20px 20px; }
    .footer-brand { grid-column: 1 / -1; }
    table { display: block; overflow-x: auto; }
}

/* MOBILE (<576px) */
@media (max-width: 576px) {
    body { padding-top: 115px; }
    .navbar { padding: 0 10px; min-height: 56px; }
    .navbar-logo img { height: 36px; width: 36px; }
    .navbar-nom { font-size: 0.95em; }
    .btn-abonner { padding: 5px 10px; font-size: 0.78em; }
    .btn-connexion { padding: 5px 10px; font-size: 0.78em; }
    .btn-inscrire, .navbar-lien-texte { padding: 4px 5px !important; font-size: 0.74em !important; }
    .langue-btn { padding: 4px 5px; font-size: 0.74em; }
    .menu-dropdown { top: 56px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .footer-inner { grid-template-columns: 1fr; padding: 24px 16px 16px; }
    .footer-bas { flex-direction: column; align-items: flex-start; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; min-height: 44px; }
    .menu-dropdown-liens a { padding: 16px 20px; }
    .btn-connexion, .btn-inscrire, .btn-abonner { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Impression */
@media print {
    .navbar, .menu-dropdown, .menu-overlay, .messages-container, footer { display: none; }
    body { background: white; padding-top: 0; }
}
.stat-item {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
}
.stat-item {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
}

/* ── Sidebar drawer mobile (genere par sphaero.js sur .ep-sidebar /
   .bo-sidebar / .inst-sidebar) — CSS manquant jusqu'ici : le drawer,
   l'overlay et le bouton toggle s'affichaient en flux normal sur
   toutes les pages, desktop compris. ── */
.sidebar-drawer,
.sidebar-overlay,
.sidebar-toggle {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-drawer {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        bottom: 0;
        width: min(85vw, 300px);
        z-index: 900;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.25);
    }
    .sidebar-drawer.ouvert {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.45);
        z-index: 899;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease;
    }
    .sidebar-overlay.actif {
        opacity: 1;
        visibility: visible;
    }
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: #1B4B91;
        color: white;
        border: none;
        font-size: 1.3em;
        box-shadow: 0 4px 14px rgba(0,0,0,0.3);
        z-index: 901;
        cursor: pointer;
    }
    .sidebar-close {
        position: absolute;
        top: 14px;
        right: 14px;
        background: rgba(255,255,255,0.15);
        color: white;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        font-size: 1em;
        cursor: pointer;
    }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar-drawer, .sidebar-overlay { transition: none; }
}
