/* ===============================================
   UTILITIES.CSS - Bibliothèque de classes utilitaires

   Auteur: Thomas Kireche
   Version: 1.0.0
   Dernière mise à jour: 2026-01-26

   Description:
   Classes utilitaires réutilisables pour le spacing,
   layout, typography, colors et effets visuels.
   Inspiré de Tailwind CSS avec conventions BEM.

   Table des matières:
   1. Spacing (margin, padding, gap)
   2. Layout (display, flex, grid)
   3. Typography (font sizes, weights, alignment)
   4. Colors (text, backgrounds)
   5. Dimensions (width, height, max-width)
   6. Borders (radius, decorative)
   7. Visual Effects (shadows, opacity, gradients)
   8. Composants spécialisés
   =============================================== */

/* ========== 1. SPACING ========== */

/**
 * Margin Bottom Utilities
 * @description Applique une marge en bas de l'élément
 * @example <div class="mb-4">Contenu avec marge bas 2rem</div>
 */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }
.mb-6 { margin-bottom: 4rem; }

/**
 * Margin Top Utilities
 * @description Applique une marge en haut de l'élément
 * @example <div class="mt-2">Contenu avec marge haut 1rem</div>
 */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

/**
 * Margin Horizontal (left + right)
 * @description Centre horizontalement avec auto ou applique marge uniforme
 * @example <div class="mx-auto">Contenu centré</div>
 */
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-1 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-2 { margin-left: 1rem; margin-right: 1rem; }

/**
 * Margin Vertical (top + bottom)
 * @description Applique marge verticale uniforme
 * @example <div class="my-4">Contenu avec marge verticale</div>
 */
.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-2 { margin-top: 1rem; margin-bottom: 1rem; }
.my-3 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-4 { margin-top: 2rem; margin-bottom: 2rem; }

/**
 * Padding Utilities (all sides)
 * @description Applique un padding uniforme
 * @example <div class="p-4">Contenu avec padding 2rem</div>
 */
.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 2.5rem; }
.p-6 { padding: 3rem; }

/**
 * Padding Horizontal
 * @description Applique padding gauche et droite
 * @example <div class="px-4">Contenu avec padding horizontal</div>
 */
.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-4 { padding-left: 2rem; padding-right: 2rem; }

/**
 * Padding Vertical
 * @description Applique padding haut et bas
 * @example <div class="py-4">Contenu avec padding vertical</div>
 */
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.py-3 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }

/**
 * Padding Top Navigation
 * @description Offset pour la navigation fixe (120px)
 * @example <section class="pt-nav">Section sous la nav</section>
 */
.pt-nav { padding-top: 120px; }

/**
 * Gap Utilities (pour flex/grid)
 * @description Espacement entre éléments flex/grid
 * @example <div class="d-flex gap-4">Items espacés</div>
 */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.5rem; }
.gap-sm { gap: 0.75rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.gap-5 { gap: 2.5rem; }
.gap-6 { gap: 3rem; }

/* ========== 2. LAYOUT ========== */

/**
 * Display Utilities
 * @description Contrôle le type d'affichage
 * @example <div class="d-flex">Container flex</div>
 */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }

/**
 * Flex Direction
 * @description Définit la direction des éléments flex
 * @example <div class="d-flex flex-col">Stack vertical</div>
 */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-col-reverse { flex-direction: column-reverse; }

/**
 * Flex Wrap
 * @description Contrôle le retour à la ligne des éléments flex
 * @example <div class="d-flex flex-wrap">Items qui wrap</div>
 */
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/**
 * Flex Grow/Shrink
 * @description Contrôle l'expansion et réduction des éléments
 * @example <div class="flex-1">Prend tout l'espace disponible</div>
 */
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow-0 { flex-grow: 0; }

/**
 * Align Items (axe transversal)
 * @description Aligne les éléments sur l'axe perpendiculaire
 * @example <div class="d-flex items-center">Centré verticalement</div>
 */
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.items-baseline { align-items: baseline; }

/**
 * Justify Content (axe principal)
 * @description Distribue l'espace sur l'axe principal
 * @example <div class="d-flex justify-between">Espacé uniformément</div>
 */
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/**
 * Align Self
 * @description Aligne un élément individuel
 * @example <div class="self-center">Cet élément est centré</div>
 */
.self-auto { align-self: auto; }
.self-start { align-self: flex-start; }
.self-center { align-self: center; }
.self-end { align-self: flex-end; }
.self-stretch { align-self: stretch; }

/**
 * Grid Columns
 * @description Définit le nombre de colonnes grid
 * @example <div class="d-grid grid-cols-3">3 colonnes</div>
 */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/**
 * Grid Auto-fit (responsive)
 * @description Grilles auto-adaptatives avec minmax
 * @example <div class="d-grid grid-auto-fit-280">Grille responsive</div>
 */
.grid-auto-fit-200 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-auto-fit-250 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-auto-fit-280 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-fit-300 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/**
 * Grid Special Layouts
 * @description Layouts de grille spécifiques
 * @example <div class="d-grid grid-sidebar">Sidebar 300px + main</div>
 */
.grid-sidebar { grid-template-columns: 300px 1fr; }
.grid-sidebar-sm { grid-template-columns: 200px 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

/**
 * Text Alignment
 * @description Aligne le texte horizontalement
 * @example <p class="text-center">Texte centré</p>
 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/**
 * Vertical Alignment
 * @description Aligne verticalement les éléments inline
 * @example <span class="align-middle">Centré verticalement</span>
 */
.align-baseline { vertical-align: baseline; }
.align-top { vertical-align: top; }
.align-middle { vertical-align: middle; }
.align-bottom { vertical-align: bottom; }

/* ========== 3. TYPOGRAPHY ========== */

/**
 * Font Sizes
 * @description Tailles de police standardisées
 * @example <span class="text-lg">Texte large</span>
 */
.text-xs { font-size: 0.75rem; }    /* 12px */
.text-sm { font-size: 0.85rem; }    /* ~14px */
.text-base { font-size: 1rem; }     /* 16px */
.text-md { font-size: 1.1rem; }     /* ~18px */
.text-lg { font-size: 1.25rem; }    /* 20px */
.text-xl { font-size: 1.5rem; }     /* 24px */
.text-2xl { font-size: 2rem; }      /* 32px */
.text-3xl { font-size: 2.5rem; }    /* 40px */
.text-4xl { font-size: 3rem; }      /* 48px */
.text-5xl { font-size: 5rem; }      /* 80px */

/**
 * Font Sizes Responsive (avec clamp)
 * @description Tailles fluides qui s'adaptent au viewport
 * @example <h1 class="text-responsive-xl">Titre adaptatif</h1>
 */
.text-responsive-lg { font-size: clamp(1.5rem, 3vw, 2.5rem); }
.text-responsive-xl { font-size: clamp(2rem, 4vw, 3rem); }
.text-responsive-2xl { font-size: clamp(2.5rem, 5vw, 4rem); }

/**
 * Font Weights
 * @description Épaisseurs de police
 * @example <span class="font-bold">Texte gras</span>
 */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/**
 * Line Heights
 * @description Hauteurs de ligne pour lisibilité
 * @example <p class="leading-relaxed">Texte aéré</p>
 */
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.6; }
.leading-relaxed { line-height: 1.7; }
.leading-loose { line-height: 1.8; }

/**
 * Letter Spacing
 * @description Espacement entre les lettres
 * @example <span class="tracking-wide">TEXTE ESPACÉ</span>
 */
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }

/**
 * Text Transform
 * @description Transformation de la casse
 * @example <span class="uppercase">texte en majuscules</span>
 */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* ========== 4. COLORS ========== */

/**
 * Text Colors
 * @description Couleurs de texte utilisant les variables CSS
 * @example <span class="text-primary">Texte violet</span>
 */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-accent { color: var(--accent, var(--secondary)); }
.text-muted { color: var(--text-secondary); }
.text-body { color: var(--text-primary); }
.text-white { color: white; }
.text-inherit { color: inherit; }

/**
 * Background Colors
 * @description Couleurs d'arrière-plan
 * @example <div class="bg-surface">Fond de carte</div>
 */
.bg-transparent { background-color: transparent; }
.bg-white { background-color: white; }
.bg-surface { background-color: var(--surface); }
.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }

/**
 * Gradient Backgrounds
 * @description Arrière-plans dégradés
 * @example <div class="bg-gradient">Fond dégradé violet</div>
 */
.bg-gradient { background: var(--gradient-primary); }
.bg-gradient-gold { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); }
.bg-gradient-blue { background: linear-gradient(135deg, #0078D4 0%, #005A9E 100%); }
.bg-gradient-green { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.bg-gradient-red { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); }

/**
 * Gradient Text
 * @description Texte avec dégradé (effet moderne)
 * @example <h1 class="gradient-text">Titre dégradé</h1>
 */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 5. DIMENSIONS ========== */

/**
 * Width Utilities
 * @description Largeurs fixes et relatives
 * @example <div class="w-full">Pleine largeur</div>
 */
.w-auto { width: auto; }
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.w-50 { width: 50%; }
.w-fit { width: fit-content; }

/**
 * Height Utilities
 * @description Hauteurs fixes et relatives
 * @example <div class="h-full">Pleine hauteur</div>
 */
.h-auto { height: auto; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.h-fit { height: fit-content; }

/**
 * Max Width Utilities
 * @description Largeurs maximales pour conteneurs
 * @example <div class="max-w-lg mx-auto">Contenu limité</div>
 */
.max-w-xs { max-width: 400px; }
.max-w-sm { max-width: 600px; }
.max-w-md { max-width: 700px; }
.max-w-lg { max-width: 800px; }
.max-w-xl { max-width: 900px; }
.max-w-2xl { max-width: 1000px; }
.max-w-full { max-width: 100%; }
.max-w-none { max-width: none; }

/**
 * Size Utilities (width + height égaux)
 * @description Dimensions carrées pour icônes et avatars
 * @example <div class="size-16">Carré 64px</div>
 */
.size-8 { width: 32px; height: 32px; }
.size-10 { width: 40px; height: 40px; }
.size-12 { width: 50px; height: 50px; }
.size-16 { width: 64px; height: 64px; }
.size-18 { width: 70px; height: 70px; }
.size-20 { width: 80px; height: 80px; }
.size-48 { width: 200px; height: 200px; }
.size-55 { width: 220px; height: 220px; }

/* ========== 6. BORDERS ========== */

/**
 * Border Radius
 * @description Coins arrondis
 * @example <div class="rounded-lg">Coins arrondis 16px</div>
 */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: 4px; }
.rounded { border-radius: 8px; }
.rounded-md { border-radius: 12px; }
.rounded-lg { border-radius: 16px; }
.rounded-xl { border-radius: 20px; }
.rounded-2xl { border-radius: 24px; }
.rounded-full { border-radius: 50%; }

/**
 * Decorative Borders
 * @description Bordures décoratives pour sections
 * @example <h3 class="border-left-accent">Titre avec accent</h3>
 */
.border-left-accent {
    padding-left: 1rem;
    border-left: 4px solid var(--secondary);
}

.border-left-primary {
    padding-left: 1rem;
    border-left: 4px solid var(--primary);
}

/**
 * Border Colors
 * @description Couleurs de bordure
 * @example <div class="border border-primary">Bordure violette</div>
 */
.border { border: 1px solid var(--border); }
.border-primary { border-color: var(--primary); }
.border-secondary { border-color: var(--secondary); }
.border-transparent { border-color: transparent; }

/* ========== 7. VISUAL EFFECTS ========== */

/**
 * Box Shadows
 * @description Ombres portées
 * @example <div class="shadow-lg">Carte avec ombre</div>
 */
.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-glow { box-shadow: var(--shadow-glow); }

/**
 * Opacity
 * @description Transparence de l'élément
 * @example <div class="opacity-50">Demi-transparent</div>
 */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/**
 * Overflow
 * @description Gestion du dépassement de contenu
 * @example <div class="overflow-hidden">Contenu coupé</div>
 */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-scroll { overflow: scroll; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }

/**
 * Glassmorphism
 * @description Effet verre dépoli
 * @example <div class="glass-effect">Effet glassmorphism</div>
 */
.glass-effect {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/**
 * Cursor
 * @description Style du curseur
 * @example <button class="cursor-pointer">Cliquable</button>
 */
.cursor-auto { cursor: auto; }
.cursor-default { cursor: default; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/**
 * Pointer Events
 * @description Contrôle des événements souris
 * @example <div class="pointer-events-none">Non interactif</div>
 */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/**
 * User Select
 * @description Contrôle la sélection de texte
 * @example <span class="select-none">Non sélectionnable</span>
 */
.select-none { user-select: none; }
.select-text { user-select: text; }
.select-all { user-select: all; }

/* ========== 8. COMPOSANTS SPÉCIALISÉS ========== */

/**
 * Icon Box
 * @description Conteneur pour icônes avec fond dégradé
 * @example <div class="icon-box"><svg>...</svg></div>
 */
.icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 16px;
    flex-shrink: 0;
}

.icon-box--sm {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

.icon-box--md {
    width: 64px;
    height: 64px;
    border-radius: 16px;
}

.icon-box--lg {
    width: 70px;
    height: 70px;
    border-radius: 16px;
}

/**
 * Avatar
 * @description Cercle pour photo/initiales de profil
 * @example <div class="avatar avatar--lg">TK</div>
 */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    color: white;
    font-weight: 800;
}

.avatar--md {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
}

.avatar--lg {
    width: 200px;
    height: 200px;
    font-size: 5rem;
}

.avatar--xl {
    width: 220px;
    height: 220px;
    font-size: 5rem;
    box-shadow: var(--shadow-glow);
}

/**
 * Badge
 * @description Étiquettes et badges
 * @example <span class="badge badge--gold">Major</span>
 */
.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.badge--gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a2e;
}

.badge--surface {
    background: var(--surface);
    border: 1px solid var(--border);
}

.badge--primary {
    background: var(--primary);
    color: white;
}

.badge--sm {
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
}

/**
 * Section Header
 * @description Titre de section avec icône et bordure accent
 * @example <h3 class="section-header">Titre de section</h3>
 */
.section-header {
    color: var(--secondary);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--secondary);
}

.section-header--primary {
    color: var(--primary);
    border-left-color: var(--primary);
}

/**
 * Info Item
 * @description Item avec icône + texte (pour contact, etc.)
 * @example <div class="info-item"><span class="icon-box">...</span><div>...</div></div>
 */
.info-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

/**
 * Stat Display
 * @description Affichage de statistiques (nombre + label)
 * @example <div class="stat"><span class="stat__value">10+</span><span class="stat__label">Projets</span></div>
 */
.stat {
    text-align: center;
}

.stat__value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat__label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/**
 * Hero Section
 * @description Container pleine hauteur centré
 * @example <section class="hero">Contenu hero</section>
 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
}

/**
 * Card Content Wrapper
 * @description Wrapper pour contenu de carte avec padding
 * @example <div class="card-content">...</div>
 */
.card-content {
    padding: 2rem;
}

.card-content--lg {
    padding: 3rem;
}

/**
 * List Styled
 * @description Listes avec bullets personnalisés
 * @example <ul class="list-arrow">...</ul>
 */
.list-arrow li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.list-arrow li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
}

.list-bullet li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.list-bullet li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/**
 * Link Inline Icon
 * @description Alignement vertical pour icônes dans le texte
 * @example <span class="inline-icon"><svg>...</svg></span>
 */
.inline-icon {
    vertical-align: middle;
    margin-right: 0.5rem;
}

/**
 * Visually Hidden (accessibilité)
 * @description Cache visuellement mais reste accessible aux lecteurs d'écran
 * @example <span class="sr-only">Texte pour lecteur d'écran</span>
 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
