/* ═══════════════════════════════════════════════════════════════
   THEME BASE v1.0 — Structure Pure (Aucune Couleur)
   ═══════════════════════════════════════════════════════════════

   🎯 OBJECTIF :
   Fondation structurelle du système de thème modulaire.
   Contient UNIQUEMENT le layout, les formes et la typographie.
   Les couleurs sont injectées par les fichiers de déclinaison :
     - theme-light-desktop.css
     - theme-light-mobile.css
     - theme-dark-desktop.css
     - theme-dark-mobile.css

   🔗 DÉPENDANCE :
   Requiert design-tokens.css chargé AVANT ce fichier.
   Toutes les valeurs structurelles viennent de var(--dt-*).

   ⚠️ RÈGLE ABSOLUE :
   AUCUN code couleur (#xxx, rgb(), hsl()) dans ce fichier.
   Toujours var(--dt-*) ou des valeurs neutres (px, rem, %).

   ═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════
   1. RESET & FONDATION TYPOGRAPHIQUE
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--dt-font-family);
    font-size: var(--dt-text-base);
    font-weight: var(--dt-font-normal);
    line-height: var(--dt-leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
}


/* ═══════════════════════════════════════════════════════════════
   2. CONTAINERS & LAYOUT
   ═══════════════════════════════════════════════════════════════ */

/* Container principal de contenu */
.theme-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Zone de contenu scrollable */
.theme-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Évite le débordement flex */
}

/* Container de page — centré avec max-width  */
.theme-page {
    width: 100%;
    max-width: var(--dt-content-max, 1400px);
    margin: 0 auto;
    padding: var(--dt-space-6);
}


/* ═══════════════════════════════════════════════════════════════
   3. SYSTÈME DE GRILLE (hérité du design system premium)
   ═══════════════════════════════════════════════════════════════
   Les classes settings-grid, settings-grid--N sont définies
   dans admin-forms-unified.css. Ici on définit les utilitaires
   de grille complémentaires pour le thème.
   ═══════════════════════════════════════════════════════════════ */

/* Grille générique réutilisable */
.grid {
    display: grid;
    gap: var(--dt-space-5);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid--auto {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--compact {
    gap: var(--dt-space-3);
}

/* Span utilities */
.span-full {
    grid-column: 1 / -1;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}


/* ═══════════════════════════════════════════════════════════════
   4. CARDS & SURFACES
   ═══════════════════════════════════════════════════════════════ */

.card {
    border-radius: var(--dt-card-radius);
    padding: var(--dt-card-padding);
    overflow: hidden;
    transition: box-shadow var(--dt-transition-base),
        transform var(--dt-transition-base);
}

.card--hover:hover {
    transform: translateY(-2px);
}

.card--flat {
    border-radius: var(--dt-radius-md);
}


/* ═══════════════════════════════════════════════════════════════
   5. TYPOGRAPHIE STRUCTURELLE
   ═══════════════════════════════════════════════════════════════ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--dt-font-semibold);
    line-height: var(--dt-leading-tight);
    margin-bottom: var(--dt-space-2);
}

h1 {
    font-size: var(--dt-text-3xl);
}

h2 {
    font-size: var(--dt-text-2xl);
}

h3 {
    font-size: var(--dt-text-xl);
}

h4 {
    font-size: var(--dt-text-lg);
}

h5 {
    font-size: var(--dt-text-md);
}

h6 {
    font-size: var(--dt-text-base);
}

p {
    line-height: var(--dt-leading-relaxed);
    margin-bottom: var(--dt-space-3);
}

p:last-child {
    margin-bottom: 0;
}

small {
    font-size: var(--dt-text-sm);
}

code,
pre {
    font-family: var(--dt-font-mono);
    font-size: var(--dt-text-sm);
    border-radius: var(--dt-radius-sm);
}

pre {
    padding: var(--dt-space-4);
    border-radius: var(--dt-radius-md);
    overflow-x: auto;
}

a {
    text-decoration: none;
    transition: color var(--dt-transition-fast);
}

a:hover {
    text-decoration: none;
}


/* ═══════════════════════════════════════════════════════════════
   6. ESPACEMENTS UTILITAIRES
   ═══════════════════════════════════════════════════════════════ */

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: var(--dt-space-1);
}

.mt-2 {
    margin-top: var(--dt-space-2);
}

.mt-3 {
    margin-top: var(--dt-space-3);
}

.mt-4 {
    margin-top: var(--dt-space-4);
}

.mt-5 {
    margin-top: var(--dt-space-5);
}

.mt-6 {
    margin-top: var(--dt-space-6);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: var(--dt-space-1);
}

.mb-2 {
    margin-bottom: var(--dt-space-2);
}

.mb-3 {
    margin-bottom: var(--dt-space-3);
}

.mb-4 {
    margin-bottom: var(--dt-space-4);
}

.mb-5 {
    margin-bottom: var(--dt-space-5);
}

.mb-6 {
    margin-bottom: var(--dt-space-6);
}

.p-0 {
    padding: 0;
}

.p-2 {
    padding: var(--dt-space-2);
}

.p-3 {
    padding: var(--dt-space-3);
}

.p-4 {
    padding: var(--dt-space-4);
}

.p-5 {
    padding: var(--dt-space-5);
}

.p-6 {
    padding: var(--dt-space-6);
}

.gap-1 {
    gap: var(--dt-space-1);
}

.gap-2 {
    gap: var(--dt-space-2);
}

.gap-3 {
    gap: var(--dt-space-3);
}

.gap-4 {
    gap: var(--dt-space-4);
}

.gap-5 {
    gap: var(--dt-space-5);
}


/* ═══════════════════════════════════════════════════════════════
   7. FLEX UTILITAIRES
   ═══════════════════════════════════════════════════════════════ */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.flex-1 {
    flex: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════
   8. FORMES & ARRONDIS
   ═══════════════════════════════════════════════════════════════ */

.rounded-sm {
    border-radius: var(--dt-radius-sm);
}

.rounded-md {
    border-radius: var(--dt-radius-md);
}

.rounded-lg {
    border-radius: var(--dt-radius-lg);
}

.rounded-xl {
    border-radius: var(--dt-radius-xl);
}

.rounded-full {
    border-radius: var(--dt-radius-circle);
}

.rounded-pill {
    border-radius: var(--dt-radius-pill);
}


/* ═══════════════════════════════════════════════════════════════
   9. OMBRES
   ═══════════════════════════════════════════════════════════════ */

.shadow-xs {
    box-shadow: var(--dt-shadow-xs);
}

.shadow-sm {
    box-shadow: var(--dt-shadow-sm);
}

.shadow-md {
    box-shadow: var(--dt-shadow-md);
}

.shadow-lg {
    box-shadow: var(--dt-shadow-lg);
}

.shadow-xl {
    box-shadow: var(--dt-shadow-xl);
}

.shadow-none {
    box-shadow: none;
}


/* ═══════════════════════════════════════════════════════════════
   10. Z-INDEX SCALE
   ═══════════════════════════════════════════════════════════════ */

.z-dropdown {
    z-index: var(--dt-z-dropdown);
}

.z-sticky {
    z-index: var(--dt-z-sticky);
}

.z-overlay {
    z-index: var(--dt-z-overlay);
}

.z-modal {
    z-index: var(--dt-z-modal);
}

.z-toast {
    z-index: var(--dt-z-toast);
}

.z-tooltip {
    z-index: var(--dt-z-tooltip);
}


/* ═══════════════════════════════════════════════════════════════
   11. TRANSITIONS & ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.transition-fast {
    transition: all var(--dt-transition-fast);
}

.transition-base {
    transition: all var(--dt-transition-base);
}

.transition-slow {
    transition: all var(--dt-transition-slow);
}

/* Transition douce pour changement de thème */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.35s ease,
        color 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease !important;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}


/* ═══════════════════════════════════════════════════════════════
   12. DISPLAY & VISIBILITY UTILITAIRES
   ═══════════════════════════════════════════════════════════════ */

.hidden {
    display: none !important;
}

.visible {
    visibility: visible;
}

.invisible {
    visibility: hidden;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   13. SCROLLBAR STRUCTURE
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    border-radius: var(--dt-radius-xs);
}