/**
 * Styles CSS pour la barre de navigation unifiée
 * Site SNT & Techno
 */

/* ========================================
   NAVBAR PRINCIPALE - PLEINE LARGEUR
   ======================================== */

.course-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 24px;
    height: 56px;
    background: var(--surface, #ffffff);
    border-bottom: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    font-family: var(--font-sans, 'DM Sans', system-ui, sans-serif);
    font-size: 0.9rem;
    transition: background 0.3s, border-color 0.3s;
}

/* Espace pour la navbar fixe - appliqué au body */
html {
    padding-top: 56px;
}

/* Le spacer n'est plus nécessaire mais on le garde invisible */
.navbar-spacer {
    display: none;
}

/* ========================================
   CONTENEUR PRINCIPAL CENTRÉ
   ======================================== */

.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

/* Pour les pages de cours (format impression A4) */
.course-content {
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px 24px;
}

main {
    display: block;
}

@media print {
    .course-content {
        max-width: none;
        padding: 0;
        margin: 0;
    }
}

/* Logo / Accueil */
.course-menu .nav-home {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-right: 8px;
    color: var(--text, #1e293b);
    text-decoration: none;
    font-weight: 700;
    border-radius: var(--radius-sm, 8px);
    transition: all 0.2s;
}

.course-menu .nav-home:hover {
    background: var(--bg-alt, #f1f5f9);
    text-decoration: none;
}

.course-menu .nav-logo {
    font-size: 1.3rem;
}

.course-menu .nav-title {
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .course-menu .nav-title {
        display: none;
    }
}

/* ========================================
   DROPDOWNS
   ======================================== */

.dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown > button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm, 8px);
    transition: all 0.2s;
}

.dropdown > button::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-light, #94a3b8);
    transition: transform 0.2s;
}

.dropdown:hover > button,
.dropdown:focus-within > button {
    background: var(--bg-alt, #f1f5f9);
    color: var(--blue, #4f46e5);
}

.dropdown:hover > button::after,
.dropdown:focus-within > button::after {
    border-top-color: var(--blue, #4f46e5);
    transform: rotate(180deg);
}

/* Menu déroulant */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 0 0 var(--radius-sm, 8px) var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.12));
    padding: 8px;
    display: none;
    z-index: 1001;
    animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dropdown-menu li {
    position: relative;
}

.dropdown-menu a,
.dropdown-menu .submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: var(--text, #1e293b);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-xs, 4px);
    transition: all 0.15s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-menu a:hover,
.dropdown-menu .submenu-toggle:hover {
    background: var(--bg-alt, #f1f5f9);
    color: var(--blue, #4f46e5);
    text-decoration: none;
}

/* ========================================
   SOUS-MENUS
   ======================================== */

.submenu-toggle::after {
    content: '›';
    font-size: 1.3em;
    line-height: 1;
    color: var(--text-light, #94a3b8);
    margin-left: 8px;
}

.submenu {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 180px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-sm, 8px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.12));
    padding: 8px;
    display: none;
    z-index: 1002;
    margin-left: 4px;
}

/* ========================================
   ACTIONS (droite)
   ======================================== */

.course-menu .action {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle thème */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #ffffff);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--blue, #4f46e5);
    background: var(--bg-alt, #f1f5f9);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    line-height: 1;
}

/* Bouton imprimer */
.print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #ffffff);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.print-btn:hover {
    border-color: var(--blue, #4f46e5);
    background: var(--bg-alt, #f1f5f9);
}

/* Lien Prof */
.nav-link.prof {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--blue-light, #eef2ff);
    color: var(--blue, #4f46e5);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm, 8px);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.nav-link.prof:hover {
    border-color: var(--blue, #4f46e5);
    text-decoration: none;
}

/* ========================================
   FIL D'ARIANE
   ======================================== */

.breadcrumb-nav,
nav[aria-label="Fil d'Ariane"] {
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
}

#breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

#breadcrumb li {
    display: flex;
    align-items: center;
    gap: 8px;
}

#breadcrumb li:not(:last-child)::after {
    content: '›';
    color: var(--text-light, #94a3b8);
}

#breadcrumb a {
    color: var(--text-muted, #64748b);
    text-decoration: none;
    transition: color 0.2s;
}

#breadcrumb a:hover {
    color: var(--blue, #4f46e5);
    text-decoration: underline;
}

#breadcrumb li:last-child {
    color: var(--text, #1e293b);
    font-weight: 600;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 900px) {
    .course-menu {
        padding: 0 12px;
        gap: 2px;
    }
    
    .dropdown > button {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .course-menu .nav-home {
        padding: 8px;
    }
}

@media (max-width: 640px) {
    .course-menu {
        height: 50px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dropdown:nth-child(n+4) {
        display: none;
    }
    
    .nav-link.prof span {
        display: none;
    }
}

/* ========================================
   IMPRESSION
   ======================================== */

@media print {
    .course-menu,
    .breadcrumb-nav,
    nav[aria-label="Fil d'Ariane"],
    .theme-toggle,
    .print-btn {
        display: none !important;
    }
}
