/*
 * assets/css/style.css
 * Système de design global — Wizan CV
 *
 * ORGANISATION :
 *  1. Variables & Reset
 *  2. Typographie
 *  3. Composants de base (boutons, formulaires, alertes)
 *  4. Layout commun (header nav, footer)
 *  5. Page d'authentification
 *  6. Dashboard
 *  7. Éditeur de CV (toolbar, form panel, preview)
 *  8. Toasts & notifications
 *  9. Utilitaires
 * 10. Responsive (mobile-first)
 * 11. Animations
 */

/* ============================================================
   1. VARIABLES CSS & RESET
   ============================================================
   On définit ici les couleurs de l'INTERFACE (pas du CV).
   Elles sont complètement indépendantes des couleurs du CV.
   La couleur principale (#1a1a2e) est un bleu-marine profond
   qui donne un caractère sérieux et professionnel au produit.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    /* Palette principale de l'interface */
    --ui-primary:        #2563EB;
    --ui-primary-dark:   #1D4ED8;
    --ui-primary-light:  #EFF6FF;
    --ui-accent:         #F59E0B;    /* Orange doré — CTA secondaire */
    --ui-dark:           #0F172A;    /* Fond sombre, texte principal */
    --ui-gray-900:       #1E293B;
    --ui-gray-700:       #334155;
    --ui-gray-500:       #64748B;
    --ui-gray-300:       #CBD5E1;
    --ui-gray-100:       #F1F5F9;
    --ui-gray-50:        #F8FAFC;
    --ui-white:          #FFFFFF;
    --ui-success:        #10B981;
    --ui-warning:        #F59E0B;
    --ui-error:          #EF4444;
    --ui-info:           #3B82F6;

    /* Typographie */
    --font-display:  'Playfair Display', Georgia, serif;
    --font-ui:       'DM Sans', 'Helvetica Neue', sans-serif;

    /* Espacement (système 8pt) */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  24px;
    --space-6:  32px;
    --space-7:  48px;
    --space-8:  64px;
    --space-9:  96px;

    /* Ombres */
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.14);
    --shadow-xl:   0 24px 64px rgba(0,0,0,.18);

    /* Bordures */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-base:   250ms ease;
    --transition-slow:   400ms ease;

    /* Taille de la barre de navigation */
    --nav-height: 68px;
    /* Largeur de l'éditeur */
    --form-panel-width: 420px;
}

/* Reset moderne */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-ui);
    color: var(--ui-gray-900);
    background: var(--ui-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 1rem; }

/* ============================================================
   2. TYPOGRAPHIE
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-ui);
    font-weight: 600;
    line-height: 1.25;
    color: var(--ui-dark);
}
.display-text {
    font-family: var(--font-display);
    font-weight: 900;
}

/* ============================================================
   3. COMPOSANTS DE BASE
   ============================================================ */

/* --- BOUTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
/* Effet de brillance au survol */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--ui-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover {
    background: var(--ui-primary-dark);
    box-shadow: 0 4px 16px rgba(37,99,235,.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--ui-gray-100);
    color: var(--ui-gray-700);
}
.btn-secondary:hover { background: var(--ui-gray-300); }

.btn-ghost {
    background: transparent;
    color: var(--ui-gray-500);
}
.btn-ghost:hover { background: var(--ui-gray-100); color: var(--ui-gray-900); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--ui-gray-300);
    color: var(--ui-gray-700);
}
.btn-outline:hover { border-color: var(--ui-primary); color: var(--ui-primary); background: var(--ui-primary-light); }

.btn-warning {
    background: var(--ui-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,.35);
}
.btn-warning:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger { background: var(--ui-error); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn[disabled], .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- FORMULAIRES --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
}
.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ui-gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.label-link {
    font-weight: 400;
    color: var(--ui-primary);
    font-size: 0.82rem;
    transition: opacity var(--transition-fast);
}
.label-link:hover { opacity: 0.75; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="month"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--ui-gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--ui-gray-900);
    background: var(--ui-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
input::placeholder, textarea::placeholder { color: var(--ui-gray-300); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.select-sm { padding: 6px 30px 6px 10px; font-size: 0.82rem; border-radius: var(--radius-sm); }

.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: var(--ui-error);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.error-msg { font-size: 0.78rem; color: var(--ui-error); font-weight: 500; }
.field-hint { font-size: 0.78rem; color: var(--ui-gray-500); line-height: 1.4; }

.form-row { display: grid; gap: var(--space-3); }
.form-row.two-cols   { grid-template-columns: 1fr 1fr; }
.form-row.three-cols { grid-template-columns: 1fr 1fr 1fr; }

/* Champ mot de passe avec bouton œil */
.input-password-wrapper { position: relative; display: flex; }
.input-password-wrapper input { padding-right: 42px; }
.toggle-password {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1rem;
    color: var(--ui-gray-500); padding: 0; line-height: 1;
}
.toggle-password:hover { color: var(--ui-gray-900); }

/* Checkbox inline */
.inline-label {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: 0.82rem; color: var(--ui-gray-500); cursor: pointer;
    margin-top: var(--space-1);
}
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ui-primary); cursor: pointer; }
input[type="range"] { accent-color: var(--ui-primary); width: 100%; cursor: pointer; }

/* --- ALERTES --- */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* --- BADGES --- */
.badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}
.badge-ats     { background: #D1FAE5; color: #065F46; }
.badge-premium { background: #FEF3C7; color: #92400E; }
.ats-badge     { font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-full); }
.ats-excellent { background: #D1FAE5; color: #065F46; }
.ats-good      { background: #DBEAFE; color: #1E40AF; }
.ats-average   { background: #FEF3C7; color: #92400E; }
.ats-poor      { background: #FEE2E2; color: #991B1B; }

/* ============================================================
   4. NAVIGATION PRINCIPALE
   ============================================================ */
.main-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    display: flex; align-items: center;
    padding: 0 var(--space-6);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: box-shadow var(--transition-base);
}
.main-nav.scrolled { box-shadow: var(--shadow-md); }
.nav-brand {
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
    color: var(--ui-dark);
}
.nav-brand img { height: 32px; }
.nav-brand span { color: var(--ui-primary); }

.nav-links {
    display: flex; align-items: center; gap: var(--space-5);
    margin: 0 auto;
}
.nav-links a {
    font-size: 0.9rem; font-weight: 500;
    color: var(--ui-gray-500);
    transition: color var(--transition-fast);
    position: relative;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
    height: 2px; background: var(--ui-primary);
    transform: scaleX(0); transition: transform var(--transition-base);
    border-radius: 2px;
}
.nav-links a:hover { color: var(--ui-gray-900); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: var(--space-3); }

/* ============================================================
   5. PAGE D'AUTHENTIFICATION
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--ui-gray-50) 0%, #EFF6FF 100%);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}
/* Décoration de fond géométrique */
.auth-page::before {
    content: '';
    position: absolute; top: -200px; right: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.auth-page::after {
    content: '';
    position: absolute; bottom: -200px; left: -200px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(245,158,11,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.auth-container {
    background: var(--ui-white);
    border-radius: var(--radius-xl);
    padding: var(--space-7) var(--space-7);
    width: 100%; max-width: 480px;
    box-shadow: var(--shadow-xl);
    position: relative; z-index: 1;
    animation: slideUp 0.5s ease both;
}
.auth-brand {
    text-align: center;
    margin-bottom: var(--space-6);
}
.auth-brand img { margin: 0 auto var(--space-3); height: 44px; }
.auth-brand h1 {
    font-size: 1.6rem; font-weight: 700;
    color: var(--ui-dark); margin-bottom: var(--space-1);
}
.auth-brand p { color: var(--ui-gray-500); font-size: 0.9rem; }

.auth-form .btn-primary { margin-top: var(--space-2); }
.auth-switch {
    text-align: center; margin-top: var(--space-4);
    font-size: 0.88rem; color: var(--ui-gray-500);
}
.auth-switch a { color: var(--ui-primary); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* ============================================================
   6. DASHBOARD — Mes CV
   ============================================================ */
.dashboard-page {
    min-height: 100vh;
    padding-top: var(--nav-height);
    background: var(--ui-gray-50);
}
.dashboard-header {
    background: var(--ui-white);
    border-bottom: 1px solid var(--ui-gray-100);
    padding: var(--space-5) var(--space-6);
    display: flex; align-items: center; justify-content: space-between;
}
.dashboard-header h1 { font-size: 1.4rem; }
.dashboard-content { max-width: 1100px; margin: 0 auto; padding: var(--space-6); }

/* Grille de cartes CV */
.cv-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-5);
}
.cv-card {
    background: var(--ui-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 1.5px solid var(--ui-gray-100);
    cursor: pointer;
}
.cv-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--ui-primary);
}
.cv-card-preview {
    height: 160px;
    background: var(--ui-gray-100);
    position: relative; overflow: hidden;
}
.cv-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.cv-card-overlay {
    position: absolute; inset: 0;
    background: rgba(15,23,42,0);
    transition: background var(--transition-base);
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-2);
}
.cv-card:hover .cv-card-overlay { background: rgba(15,23,42,0.55); }
.cv-card-overlay .btn { opacity: 0; transform: translateY(8px); transition: all var(--transition-base); }
.cv-card:hover .cv-card-overlay .btn { opacity: 1; transform: translateY(0); }

.cv-card-body { padding: var(--space-3) var(--space-4); }
.cv-card-title { font-size: 0.95rem; font-weight: 600; color: var(--ui-dark); margin-bottom: 4px; }
.cv-card-meta { font-size: 0.78rem; color: var(--ui-gray-500); }

/* Carte "Nouveau CV" */
.cv-card-new {
    border: 2px dashed var(--ui-gray-300);
    display: flex; align-items: center; justify-content: center;
    min-height: 220px;
    transition: all var(--transition-base);
}
.cv-card-new:hover {
    border-color: var(--ui-primary);
    background: var(--ui-primary-light);
    transform: translateY(-4px);
}
.cv-card-new-inner { text-align: center; color: var(--ui-gray-500); }
.cv-card-new-inner .icon { font-size: 2rem; margin-bottom: var(--space-2); }
.cv-card-new:hover .cv-card-new-inner { color: var(--ui-primary); }

/* ============================================================
   7. ÉDITEUR DE CV
   ============================================================ */
.editor-page {
    height: 100vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    background: var(--ui-gray-50);
}

/* Barre d'outils supérieure */
.editor-toolbar {
    height: 56px;
    background: var(--ui-white);
    border-bottom: 1px solid var(--ui-gray-100);
    display: flex; align-items: center; gap: var(--space-3);
    padding: 0 var(--space-4);
    flex-shrink: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}
.editor-toolbar-center { display: flex; align-items: center; gap: var(--space-3); flex: 1; justify-content: center; }
.cv-title-input {
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.95rem; font-weight: 600;
    background: transparent;
    color: var(--ui-dark); text-align: center;
    transition: all var(--transition-fast);
    max-width: 280px;
}
.cv-title-input:hover { border-color: var(--ui-gray-300); background: var(--ui-gray-50); }
.cv-title-input:focus { border-color: var(--ui-primary); background: var(--ui-white); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.save-status { font-size: 0.78rem; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-full); }
.status-unsaved { background: #FEF3C7; color: #92400E; }
.status-saving  { background: #DBEAFE; color: #1E40AF; }
.status-saved   { background: #D1FAE5; color: #065F46; }
.status-error   { background: #FEE2E2; color: #991B1B; }

.editor-toolbar-actions { display: flex; align-items: center; gap: var(--space-2); }

/* Layout principal de l'éditeur */
.editor-layout {
    display: flex; flex: 1; overflow: hidden;
}

/* Panneau gauche — Formulaire */
.editor-form-panel {
    width: var(--form-panel-width);
    flex-shrink: 0;
    background: var(--ui-white);
    border-right: 1px solid var(--ui-gray-100);
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* Navigation des sections du formulaire */
.form-sections-nav {
    display: flex; overflow-x: auto; gap: 0;
    border-bottom: 1px solid var(--ui-gray-100);
    scrollbar-width: none; /* Firefox */
    flex-shrink: 0;
}
.form-sections-nav::-webkit-scrollbar { display: none; }
.section-tab {
    padding: 10px 14px;
    font-size: 0.78rem; font-weight: 600;
    color: var(--ui-gray-500);
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    transition: all var(--transition-fast);
    background: none; border-radius: 0;
}
.section-tab:hover { color: var(--ui-gray-900); background: var(--ui-gray-50); }
.section-tab.active { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }

/* Sections du formulaire */
.form-section { display: none; flex: 1; overflow-y: auto; padding: var(--space-4); }
.form-section.active { display: block; }
.section-title {
    font-size: 1rem; font-weight: 700;
    color: var(--ui-dark); margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--ui-gray-100);
}
.section-hint { font-size: 0.82rem; color: var(--ui-gray-500); margin-bottom: var(--space-4); line-height: 1.5; }

/* Zone upload photo */
.photo-upload-zone {
    display: flex; align-items: center; justify-content: center;
    margin-bottom: var(--space-4); position: relative; width: 100px; margin: 0 auto var(--space-4);
}
#photo-preview {
    width: 90px; height: 90px; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--ui-gray-100);
    box-shadow: var(--shadow-md);
}
.photo-overlay {
    position: absolute; inset: 0; border-radius: 50%;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity var(--transition-fast);
}
.photo-upload-zone:hover .photo-overlay { opacity: 1; }
.photo-overlay label {
    color: #fff; font-size: 0.72rem; font-weight: 600;
    cursor: pointer; text-align: center; padding: 4px;
}

/* Zone import */
.import-cv-zone {
    background: var(--ui-gray-50);
    border: 1.5px dashed var(--ui-gray-300);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4); text-align: center;
}
.import-hint { font-size: 0.8rem; color: var(--ui-gray-500); margin-bottom: var(--space-2); }
#import-progress {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-2); font-size: 0.85rem; color: var(--ui-gray-500);
    margin-top: var(--space-2);
}

/* Blocs dynamiques (expériences, formations, etc.) */
.dynamic-block {
    border: 1.5px solid var(--ui-gray-100);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}
.dynamic-block:hover { border-color: var(--ui-gray-300); }
.block-header {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--ui-gray-50);
    cursor: pointer; user-select: none;
}
.block-drag { color: var(--ui-gray-300); cursor: grab; }
.block-title { flex: 1; font-size: 0.85rem; font-weight: 600; color: var(--ui-gray-700); }
.btn-remove-block {
    width: 24px; height: 24px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: var(--ui-gray-500);
    transition: all var(--transition-fast);
}
.btn-remove-block:hover { background: var(--ui-error); color: #fff; }
.block-body { padding: var(--space-3); display: block; }
.skill-block .block-body { padding: var(--space-2) var(--space-3); }
.btn-remove-inline {
    align-self: flex-end; margin-bottom: var(--space-4);
    width: 28px; height: 28px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--ui-gray-400); font-size: 0.8rem;
    transition: all var(--transition-fast);
}
.btn-remove-inline:hover { background: var(--ui-error); color: #fff; }

/* Score ATS dans l'éditeur */
.ats-score-display {
    display: flex; align-items: center; gap: var(--space-4);
    background: var(--ui-gray-50); border-radius: var(--radius-md);
    padding: var(--space-4); margin-bottom: var(--space-4);
}
.ats-score-circle {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    flex-shrink: 0; border: 4px solid;
    transition: all var(--transition-slow);
}
.ats-score-circle.good    { border-color: var(--ui-success); color: var(--ui-success); }
.ats-score-circle.average { border-color: var(--ui-accent); color: var(--ui-accent); }
.ats-score-circle.poor    { border-color: var(--ui-error); color: var(--ui-error); }

/* Couleurs et templates */
.color-picker-row { display: flex; align-items: center; gap: var(--space-2); }
.color-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.color-dot {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.active { border-color: var(--ui-dark); transform: scale(1.15); }
.color-pickers { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
input[type="color"] { width: 40px; height: 36px; padding: 2px; border-radius: var(--radius-sm); cursor: pointer; border: 1.5px solid var(--ui-gray-300); }

/* Grille des templates */
.template-filter-tabs {
    display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3);
}
.tpl-filter {
    padding: 4px 12px; border-radius: var(--radius-full);
    font-size: 0.78rem; font-weight: 600;
    color: var(--ui-gray-500); background: var(--ui-gray-100);
    transition: all var(--transition-fast);
}
.tpl-filter:hover, .tpl-filter.active {
    background: var(--ui-primary); color: #fff;
}
.templates-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3);
}
.template-card {
    border: 2px solid var(--ui-gray-100);
    border-radius: var(--radius-md); overflow: hidden;
    cursor: pointer; transition: all var(--transition-base);
}
.template-card:hover { border-color: var(--ui-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.template-card.selected { border-color: var(--ui-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.template-card img { width: 100%; height: 110px; object-fit: cover; }
.template-preview-placeholder {
    height: 110px; display: flex; align-items: center; justify-content: center;
}
.template-preview-placeholder span { color: rgba(255,255,255,0.9); font-weight: 700; font-size: 0.85rem; text-align: center; padding: 8px; }
.template-card-info {
    padding: var(--space-2) var(--space-2);
    display: flex; align-items: center; justify-content: space-between; gap: 4px;
    background: var(--ui-white);
}
.tpl-name { font-size: 0.78rem; font-weight: 600; color: var(--ui-gray-700); }

/* Panneau droit — Preview */
.editor-preview-panel {
    flex: 1; display: flex; flex-direction: column;
    background: var(--ui-gray-100); overflow: hidden;
}
.preview-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: var(--ui-white); border-bottom: 1px solid var(--ui-gray-100);
    flex-shrink: 0;
}
.preview-label { font-size: 0.8rem; font-weight: 600; color: var(--ui-gray-500); }
.preview-zoom-controls {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: 0.82rem; color: var(--ui-gray-500);
}
.preview-zoom-controls button {
    width: 26px; height: 26px; border-radius: var(--radius-sm);
    background: var(--ui-gray-100); font-size: 1.1rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition-fast);
}
.preview-zoom-controls button:hover { background: var(--ui-gray-300); }
#zoom-level { min-width: 40px; text-align: center; font-weight: 600; }

.preview-wrapper {
    flex: 1; overflow: auto;
    display: flex; align-items: flex-start; justify-content: center;
    padding: var(--space-5);
}
#cv-preview-frame {
    width: 794px; /* Largeur A4 en pixels à 96dpi */
    height: 1123px; /* Hauteur A4 en pixels */
    border: none;
    box-shadow: var(--shadow-xl);
    background: #fff;
    transform-origin: top center;
    transition: transform var(--transition-base);
}

/* ============================================================
   8. TOASTS & NOTIFICATIONS
   ============================================================ */
.toast {
    position: fixed; bottom: var(--space-5); right: var(--space-5);
    background: var(--ui-dark); color: #fff;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    transform: translateY(100px); opacity: 0;
    transition: all var(--transition-base);
    max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--ui-success); }
.toast-error   { background: var(--ui-error); }
.toast-warning { background: var(--ui-accent); color: var(--ui-dark); }

/* Loading spinner */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--ui-gray-300);
    border-top-color: var(--ui-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ============================================================
   9. UTILITAIRES
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-5); }
.text-center { text-align: center; }
.text-muted  { color: var(--ui-gray-500); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

/* ============================================================
   10. RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    :root { --form-panel-width: 100%; }

    .editor-layout { flex-direction: column; }
    .editor-form-panel { width: 100%; height: 55vh; border-right: none; border-bottom: 1px solid var(--ui-gray-100); }
    .editor-preview-panel { height: 45vh; }
    #cv-preview-frame { width: 100%; transform: scale(0.5); }

    .form-row.two-cols, .form-row.three-cols { grid-template-columns: 1fr; }
    .templates-grid { grid-template-columns: repeat(3, 1fr); }

    .main-nav { padding: 0 var(--space-4); }
    .nav-links { display: none; }
    .auth-container { padding: var(--space-5); }
}

/* ============================================================
   11. ANIMATIONS
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animation des cartes CV */
.cv-card { animation: fadeIn 0.4s ease both; }
.cv-card:nth-child(2) { animation-delay: 0.05s; }
.cv-card:nth-child(3) { animation-delay: 0.10s; }
.cv-card:nth-child(4) { animation-delay: 0.15s; }
.cv-card:nth-child(5) { animation-delay: 0.20s; }
.cv-card:nth-child(6) { animation-delay: 0.25s; }
