/* ===== 2-BASE.CSS - STRUCTURE GLOBALE UNIFIÉE ===== */
/* 🎯 Layout commun aux modes générateur ET dictionnaire */
/* ✅ VERSION NETTOYÉE - La navbar est dans navbar-nouvelle.css */

/* ===== RESET UNIVERSEL ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== BASE HTML ===== */
html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--fond-creme);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
    line-height: var(--hauteur-ligne-normale);
    color: var(--texte-principal);
    display: flex;
    flex-direction: column;
}

/* Main content prend l'espace disponible */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ===== IMAGES RESPONSIVE ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== LIENS ===== */
a {
    color: inherit;
    text-decoration: none;
    touch-action: manipulation;
}

/* ===== BOUTONS ===== */
button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(128, 128, 0, 0.2);
}

/* ===== SCROLLBARS PERSONNALISÉES ===== */
::-webkit-scrollbar {
    width: 0.625rem;
    height: 0.625rem;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0.625rem;
}

::-webkit-scrollbar-thumb {
    background: var(--couleur-primaire);
    border-radius: 0.625rem;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--couleur-primaire-foncee);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--couleur-primaire) #f1f1f1;
}

/* ========================================
   DISPOSITION VERTICALE DES SECTIONS
   Ordre identique pour les 2 modes
   ======================================== */

/* Wrapper des switches + panneau de contrôle */
.control-zone-wrapper {
    width: fit-content;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* Section d'affichage des diagrammes (générateur) */
.content-display-area {
    width: 100%;
}

/* Section d'affichage des diagrammes (dictionnaire) */
.diagrams-section {
    width: 100%;
}

/* Section SEO (dictionnaire uniquement) */
.seo-section {
    width: 100%;
}

/* ========================================
   ESPACEMENT ENTRE SECTIONS
   ======================================== */

/* Espace après le wrapper de contrôles */
.control-zone-wrapper + .content-display-area,
.control-zone-wrapper + .diagrams-section {
    margin-top: 2rem;
}

/* Espace avant la section SEO (dictionnaire) */
.diagrams-section + .seo-section {
    margin-top: 6rem;
}

/* ========================================
   CENTRAGE HORIZONTAL
   ======================================== */

.control-zone-wrapper,
.content-display-area,
.diagrams-section,
.seo-section {
    margin-left: auto;
    margin-right: auto;
}

/* ===== PAGE LAYOUT ===== */
.page-layout {
    max-width: var(--largeur-max-page);
    margin: 0 auto;
    overflow-x: hidden;
    min-height: calc(100vh - 120px);
}

/* Mode dictionnaire : pas de padding lateral dans page-layout */
body[data-current-note] .page-layout {
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
}

/* ===== LOADING INDICATOR ===== */
.loading {
    text-align: center;
    padding: var(--padding-xxl) var(--padding-lg);
    color: var(--couleur-primaire);
}

.loading p {
    margin-top: var(--margin-lg);
    font-size: var(--texte-lg);
}

/* ===== FOCUS VISIBLE (ACCESSIBILITÉ) ===== */
*:focus-visible {
    outline: var(--bordure-epaisse) solid var(--bordure-principale);
    outline-offset: var(--bordure-normale);
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 47.9375rem) {
    /* Espacements sections mobile */
    .control-zone-wrapper {
        margin-top: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .control-zone-wrapper + .content-display-area,
    .control-zone-wrapper + .diagrams-section {
        margin-top: 1.5rem;
    }
    
    .diagrams-section + .seo-section {
        margin-top: 4rem;
    }
}

/* ========================================
   RESPONSIVE - TABLETTE
   ======================================== */

@media (min-width: 48rem) {
    .control-zone-wrapper + .content-display-area,
    .control-zone-wrapper + .diagrams-section {
        margin-top: 2.5rem;
    }
    
    .diagrams-section + .seo-section {
        margin-top: 7rem;
    }
}

/* ========================================
   RESPONSIVE - DESKTOP
   ======================================== */

@media (min-width: 64rem) {
    .control-zone-wrapper {
        margin-top: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .control-zone-wrapper + .content-display-area,
    .control-zone-wrapper + .diagrams-section {
        margin-top: 3rem;
    }
    
    .diagrams-section + .seo-section {
        margin-top: 8rem;
    }
}

/* ===== PRÉFÉRENCE MOUVEMENT RÉDUIT ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== PRINT ===== */
@media print {
    .custom-navbar,
    .footer,
    .navbar-buttons {
        display: none;
    }
    
    body {
        background: var(--fond-blanc);
    }
    
    .page-layout {
        max-width: 100%;
        padding: 0;
    }
    
    .control-zone-wrapper {
        display: none;
    }
    
    .content-display-area,
    .diagrams-section {
        margin-top: 0;
        page-break-after: avoid;
    }
    
    .seo-section {
        margin-top: 2rem;
        page-break-before: auto;
    }
}