/*
 *   Feuille de style principale pour le constructeur de sites
 *   Organisation : Variables -> Reset -> Layout -> Composants -> Utilitaires
 */

/* ============================================ */
/* VARIABLES CSS */
/* ============================================ */

/*
 *   Les variables CSS (custom properties) nous permettent de définir
 *   des valeurs réutilisables à travers toute notre feuille de style.
 *   Changer une variable ici met à jour automatiquement partout où elle est utilisée.
 */
:root {
    /* Couleurs primaires */
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-primary-light: #60a5fa;

    /* Couleurs de feedback */
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* Couleurs neutres */
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-background: #ffffff;
    --color-surface: #f8fafc;
    --color-border: #e2e8f0;

    /* Typographie */
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    /* Tailles de police */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */

    /* Espacements */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-2xl: 3rem;     /* 48px */

    /* Bordures */
    --border-radius-sm: 0.375rem;  /* 6px */
    --border-radius-md: 0.5rem;    /* 8px */
    --border-radius-lg: 0.75rem;   /* 12px */
    --border-radius-xl: 1rem;      /* 16px */

    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;

    /* Conteneur */
    --container-max-width: 1200px;
}

/* ============================================ */
/* RESET ET BASE */
/* ============================================ */

/*
 *   Ce reset minimal normalise les styles entre les différents navigateurs
 *   et définit des valeurs par défaut sensées pour notre application
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/*
 *   box-sizing: border-box fait en sorte que la largeur et hauteur
 *   incluent le padding et la bordure, ce qui rend les calculs de layout
 *   beaucoup plus intuitifs
 */

html {
    font-size: 16px;
    /*
     *       Cette taille de base permet d'utiliser des rem partout ailleurs
     *       1rem = 16px, ce qui facilite les calculs
     */
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);

    /*
     *       -webkit-font-smoothing et -moz-osx-font-smoothing améliorent
     *       le rendu des polices sur macOS et iOS
     */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================ */
/* LAYOUT PRINCIPAL */
/* ============================================ */

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
}

/*
 *   Sur les petits écrans, réduit le padding pour maximiser l'espace
 */
@media (max-width: 768px) {
    .container {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
}

/* ============================================ */
/* HEADER DE L'APPLICATION */
/* ============================================ */

.app-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-2xl);
}

.app-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
}

.app-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xl);
}

/* ============================================ */
/* BARRE DE PROGRESSION */
/* ============================================ */

.progress-bar {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-top: var(--spacing-xl);
}

/*
 *   La ligne qui connecte les étapes
 *   Elle est positionnée en absolute pour passer derrière les cercles des étapes
 */
.progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-border);
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: all var(--transition-base);
    margin-bottom: var(--spacing-sm);
}

.step-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    transition: color var(--transition-base);
}

/*
 *   Style pour l'étape active
 */
.progress-step.active .step-number {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.progress-step.active .step-label {
    color: var(--color-primary);
    font-weight: 600;
}

/*
 *   Sur mobile, affiche seulement les numéros
 */
@media (max-width: 640px) {
    .step-label {
        display: none;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: var(--text-sm);
    }
}

/* ============================================ */
/* SECTIONS ET ÉTAPES */
/* ============================================ */

.app-main {
    min-height: 60vh;
    padding-bottom: var(--spacing-2xl);
}

.step-section {
    display: none;
}

/*
 *   Seule la section active est visible
 *   Cela fonctionne en conjonction avec l'attribut data-step
 */
.step-section.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-section h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.section-intro {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-2xl);
    line-height: 1.7;
}

/* ============================================ */
/* ZONES D'UPLOAD */
/* ============================================ */

.upload-zone {
    background-color: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.upload-zone h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--spacing-lg);
    color: var(--color-text);
}

/* ============================================ */
/* BOÎTES DE RÈGLES */
/* ============================================ */

.rules-box {
    background-color: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-lg);
}

.rules-box summary {
    padding: var(--spacing-md);
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.rules-box summary:hover {
    background-color: var(--color-surface);
}

.toggle-icon {
    transition: transform var(--transition-base);
}

.rules-box[open] .toggle-icon {
    transform: rotate(180deg);
}

.rules-content {
    padding: 0 var(--spacing-md) var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.rules-content ul {
    list-style-position: inside;
    margin-top: var(--spacing-md);
}

.rules-content li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

.rules-content li ul {
    margin-left: var(--spacing-lg);
    margin-top: var(--spacing-sm);
}

.rules-content code {
    background-color: var(--color-surface);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.rules-content pre {
    background-color: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: var(--spacing-sm) 0;
}

.rules-content pre code {
    padding: 0;
    background-color: transparent;
}

.example-box {
    background-color: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    margin-top: var(--spacing-md);
}

.example-list {
    list-style: none;
    margin-top: var(--spacing-sm);
}

.valid-item {
    color: var(--color-success);
}

.invalid-item {
    color: var(--color-error);
}

/* ============================================ */
/* BOUTONS */
/* ============================================ */

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.upload-button {
    background-color: white;
    color: var(--color-text);
    border: 2px solid var(--color-border);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.upload-button:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: var(--color-surface);
}

.primary-button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: var(--text-lg);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.primary-button:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.primary-button:disabled {
    background-color: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================ */
/* PRÉVISUALISATION DES FICHIERS */
/* ============================================ */

.files-preview {
    margin-top: var(--spacing-lg);
}

.files-list {
    list-style: none;
}

.files-list li {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-sm);
}

.files-list li.valid-file {
    border-left: 4px solid var(--color-success);
}

.files-list li.invalid-file {
    border-left: 4px solid var(--color-error);
    background-color: rgba(239, 68, 68, 0.05);
}

.file-icon {
    font-size: var(--text-2xl);
}

.file-name {
    flex: 1;
    font-weight: 500;
}

.file-size {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.badge {
    background-color: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}

.error-badge {
    color: var(--color-error);
    font-weight: 600;
    font-size: var(--text-sm);
}

/* ============================================ */
/* ACTIONS DES ÉTAPES */
/* ============================================ */

.step-actions {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

/* ============================================ */
/* MESSAGES DE VALIDATION */
/* ============================================ */

.validation-message {
    text-align: center;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-weight: 500;
}

.validation-message.info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}

.validation-message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.validation-message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

/* ============================================ */
/* OVERLAY DE CHARGEMENT */
/* ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    color: white;
    margin-top: var(--spacing-lg);
    font-size: var(--text-lg);
    font-weight: 600;
}

/* ============================================ */
/* CARTES DES TYPES DE SITES */
/* ============================================ */

.site-types-grid {
    display: grid;
    /*
     *       Cette grille s'adapte automatiquement au nombre de colonnes
     *       selon l'espace disponible. Chaque colonne fait minimum 300px
     *       et maximum 1fr (une fraction de l'espace disponible)
     */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.site-type-card {
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
    /*
     *       position: relative permet aux éléments enfants positionnés
     *       en absolute de se positionner par rapport à cette carte
     */
    position: relative;
}

.site-type-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

/*
 *   Style pour la carte sélectionnée
 *   Elle a une bordure bleue épaisse et une ombre colorée
 */
.site-type-card.selected {
    border-color: var(--color-primary);
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/*
 *   Animation subtile pour attirer l'attention sur la carte recommandée
 */
.site-type-card.recommended {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
}

.site-type-thumbnail {
    /*
     *       Cette div contient la vignette SVG et le badge recommandé
     *       aspect-ratio garantit que la zone garde toujours les mêmes proportions
     */
    aspect-ratio: 4 / 5;
    background-color: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    position: relative;
}

.site-type-icon {
    /*
     *       Le SVG prend 100% de la largeur disponible
     *       height: auto garantit que les proportions sont préservées
     */
    width: 100%;
    height: auto;
    max-width: 200px;
}

.recommended-badge {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: var(--color-primary);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.site-type-info {
    padding: var(--spacing-lg);
}

.site-type-info h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.site-type-description {
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    font-size: var(--text-sm);
}

.site-type-tags {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.tag {
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}

/*
 *   Sur les tablettes et mobiles, réduit la taille minimum des cartes
 */
@media (max-width: 768px) {
    .site-types-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--spacing-lg);
    }

    .site-type-thumbnail {
        padding: var(--spacing-md);
    }

    .site-type-info {
        padding: var(--spacing-md);
    }
}

/* ============================================ */
/* CARTES DES THÈMES */
/* ============================================ */

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.theme-card {
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary-light);
}

.theme-card.selected {
    border-color: var(--color-primary);
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/*
 *   Animation subtile pour la carte recommandée
 *   Identique à celle des cartes de types de sites
 */
.theme-card.recommended {
    animation: pulse 2s ease-in-out infinite;
}

/*
 *   L'aperçu du thème montre un dégradé des couleurs principales
 *   Cette zone occupe environ un tiers de la hauteur de la carte
 */
.theme-preview {
    height: 140px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /*
     *       Le dégradé est défini inline dans le JavaScript
     *       car il est différent pour chaque thème
     */
}

/*
 *   Badge recommandé positionné dans le coin du preview
 */
.theme-preview .recommended-badge {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--color-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-md);
}

/*
 *   Informations textuelles du thème
 */
.theme-info {
    padding: var(--spacing-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.theme-info h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--spacing-xs);
    color: var(--color-text);
}

.theme-category {
    font-size: var(--text-sm);
    color: var(--color-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
}

.theme-description {
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    font-size: var(--text-sm);
    flex: 1;
}

/*
 *   Palette de couleurs affichée sous forme de petits cercles
 *   Ces cercles donnent un aperçu rapide des couleurs du thème
 */
.theme-colors {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    /*
     *       La couleur de fond est définie inline dans le JavaScript
     */
    cursor: help;
    transition: transform var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.15);
}

/*
 *   Information sur la font stack utilisée
 */
.theme-font-stack {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    font-size: var(--text-sm);
}

.font-stack-label {
    color: var(--color-text-muted);
}

.font-stack-name {
    color: var(--color-text);
    font-weight: 600;
    background-color: var(--color-surface);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
}

/*
 *   Tags descriptifs du thème
 */
.theme-tags {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/*
 *   Sur les petits écrans, empile les cartes verticalement
 */
@media (max-width: 768px) {
    .themes-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .theme-preview {
        height: 120px;
    }

    .theme-info {
        padding: var(--spacing-md);
    }
}

/* ============================================ */
/* ZONE DE PRÉVISUALISATION EN DIRECT */
/* ============================================ */

.preview-container {
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.preview-header h3 {
    font-size: var(--text-lg);
    margin: 0;
    color: var(--color-text);
}

.icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    background-color: white;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    transition: all var(--transition-fast);
}

.icon-button:hover {
    background-color: var(--color-surface);
    border-color: var(--color-primary);
}

.preview-frame-wrapper {
    /*
     *       Cette wrapper contraint l'iframe dans un aspect ratio 16:9
     *       pour une prévisualisation cohérente sur tous les écrans
     */
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    background-color: var(--color-surface);
}

.preview-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================ */
/* PANNEAUX DE PERSONNALISATION */
/* ============================================ */

.customization-panels {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.customization-panel {
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base);
}

/*
 *   Quand le panneau est ouvert, change la couleur de bordure
 *   pour indiquer visuellement qu'il est actif
 */
.customization-panel[open] {
    border-color: var(--color-primary-light);
}

.panel-header {
    padding: var(--spacing-lg);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background-color: var(--color-surface);
    transition: background-color var(--transition-base);
    /*
     *       list-style: none retire la flèche par défaut du navigateur
     *       sur l'élément summary, nous utilisons notre propre icône
     */
    list-style: none;
}

/*
 *   Retire aussi la flèche WebKit qui apparaît sur Safari
 */
.panel-header::-webkit-details-marker {
    display: none;
}

.panel-header:hover {
    background-color: #f1f5f9;
}

.panel-icon {
    font-size: var(--text-2xl);
    flex-shrink: 0;
}

.panel-title {
    font-size: var(--text-xl);
    font-weight: 600;
    flex: 1;
    color: var(--color-text);
}

.panel-chevron {
    font-size: var(--text-sm);
    transition: transform var(--transition-base);
    color: var(--color-text-muted);
}

/*
 *   Quand le panneau est ouvert, rotate le chevron
 */
.customization-panel[open] .panel-chevron {
    transform: rotate(180deg);
}

.panel-content {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.panel-description {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: var(--spacing-xl);
    font-size: var(--text-base);
    background-color: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    border-left: 3px solid var(--color-primary);
}

/* ============================================ */
/* GROUPES DE CONTRÔLES */
/* ============================================ */

.control-group {
    margin-bottom: var(--spacing-xl);
}

/*
 *   Le dernier groupe n'a pas de marge en bas
 *   pour éviter un espacement excessif
 */
.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    margin-bottom: var(--spacing-md);
}

.label-text {
    display: block;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
    font-size: var(--text-base);
}

.label-help {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* ============================================ */
/* COLOR PICKERS */
/* ============================================ */

.color-picker-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--color-surface);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
}

.color-input {
    /*
     *       Style le color picker natif du navigateur
     *       Nous gardons une taille généreuse pour faciliter le clic
     */
    width: 60px;
    height: 60px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.color-input:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.color-values {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.color-hex {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text);
}

.color-oklch {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* ============================================ */
/* SLIDERS */
/* ============================================ */

.slider-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.slider {
    /*
     *       Style personnalisé pour les sliders HTML5
     *       Le slider natif varie beaucoup selon les navigateurs,
     *       nous devons donc styliser chaque partie séparément
     */
    flex: 1;
    height: 6px;
    border-radius: var(--border-radius-sm);
    background: var(--color-surface);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

/*
 *   Style de la piste du slider pour WebKit (Chrome, Safari)
 */
.slider::-webkit-slider-track {
    height: 6px;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(
        to right,
        var(--color-primary-light) 0%,
                                var(--color-primary) 100%
    );
}

/*
 *   Style du thumb (curseur) pour WebKit
 */
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

/*
 *   Style de la piste du slider pour Firefox
 */
.slider::-moz-range-track {
    height: 6px;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(
        to right,
        var(--color-primary-light) 0%,
                                var(--color-primary) 100%
    );
}

/*
 *   Style du thumb pour Firefox
 */
.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.slider-value {
    min-width: 140px;
    text-align: right;
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--text-sm);
}

/* ============================================ */
/* BOUTONS PRESET */
/* ============================================ */

.scale-presets {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.preset-button {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    background-color: white;
    border-radius: var(--border-radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--color-text);
}

.preset-button:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* ============================================ */
/* SÉLECTEUR DE POLICE */
/* ============================================ */

.font-select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background-color: white;
    font-size: var(--text-base);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
}

.font-select:hover {
    border-color: var(--color-primary-light);
}

.font-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.font-preview {
    margin-top: var(--spacing-md);
    padding: var(--spacing-lg);
    background-color: var(--color-surface);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    font-size: var(--text-lg);
    line-height: 1.6;
    /*
     *       La font-family sera définie dynamiquement par JavaScript
     *       pour afficher un aperçu de la police sélectionnée
     */
}

/* ============================================ */
/* APERÇUS DE BORDURES */
/* ============================================ */

.border-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.border-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.border-preview-box {
    width: 80px;
    height: 80px;
    background-color: white;
    border: 2px solid var(--color-primary);
    /*
     *       Le border-radius sera défini dynamiquement par JavaScript
     *       selon la valeur du slider
     */
    transition: all var(--transition-base);
}

.border-preview-item span {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ============================================ */
/* APERÇUS D'OMBRES */
/* ============================================ */

.shadow-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding: var(--spacing-lg);
    background-color: var(--color-surface);
    border-radius: var(--border-radius-md);
}

.shadow-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.shadow-preview-box {
    width: 80px;
    height: 80px;
    background-color: white;
    border-radius: var(--border-radius-md);
    /*
     *       La box-shadow sera définie dynamiquement par JavaScript
     *       selon la valeur du slider d'intensité
     */
    transition: all var(--transition-base);
}

.shadow-preview-item span {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ============================================ */
/* BOUTON SECONDAIRE */
/* ============================================ */

.secondary-button {
    background-color: white;
    color: var(--color-text);
    border: 2px solid var(--color-border);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: var(--text-base);
    cursor: pointer;
    transition: all var(--transition-base);
}

.secondary-button:hover {
    background-color: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ============================================ */
/* RESPONSIVE - TABLETTES ET MOBILES */
/* ============================================ */

@media (max-width: 768px) {
    .preview-frame-wrapper {
        /*
         *           Sur mobile, utilise un ratio plus carré
         *           pour mieux utiliser l'espace vertical limité
         */
        padding-bottom: 75%; /* Ratio 4:3 */
    }

    .panel-content {
        padding: var(--spacing-md);
    }

    .color-picker-group {
        flex-direction: column;
        align-items: stretch;
    }

    .slider-value {
        min-width: auto;
        text-align: left;
    }

    .border-preview-grid,
    .shadow-preview-grid {
        grid-template-columns: 1fr;
    }

    .scale-presets {
        justify-content: stretch;
    }

    .preset-button {
        flex: 1;
        text-align: center;
    }
}

/* ============================================ */
/* PAGE D'EXPORT ET OVERLAY DE SUCCÈS */
/* ============================================ */

.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.success-overlay.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.success-box {
    background: white;
    border-radius: var(--border-radius-xl);
    padding: calc(var(--spacing-2xl) * 1.5);
    max-width: 500px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.success-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    animation: scaleIn 0.5s ease 0.2s both;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.success-box h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.success-box p {
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.success-details {
    background-color: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--spacing-lg);
}

/* Section d'export */
.export-preview {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.export-preview h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.export-info {
    background-color: var(--color-surface);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    margin: var(--spacing-lg) 0;
}

.export-info-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.export-info-item:last-child {
    border-bottom: none;
}

.export-info-label {
    font-weight: 600;
    color: var(--color-text);
}

.export-info-value {
    color: var(--color-text-muted);
}
