﻿html {
    scroll-behavior: smooth;
}

/* AmÃ©liorations de design pour devis.php */

/* Variables CSS adaptées au thème (Cyan / Orange / Violet / Bleu) */
:root {
  /* =========================
     Palette principale (Primary = Cyan)
     ========================= */
  --primary: #22D3EE;
  --primary-dark: #0891B2;
  --primary-light: #67E8F9;
  --primary-lighter: #A5F3FC;
  --primary-pale: #ECFEFF;

  /* =========================
     Couleurs secondaires (Secondary = Orange)
     ========================= */
  --secondary: #F97316;
  --secondary-dark: #EA580C;
  --secondary-light: #FDBA74;
  --secondary-pale: #FFEDD5;

  /* =========================
     Couleurs d'accent (Accent = Violet)
     ========================= */
  --accent: #9333EA;
  --accent-dark: #7E22CE;
  --accent-light: #C084FC;
  --accent-pale: #F3E8FF;

  /* =========================
     Couleurs d’état
     (on garde des standards lisibles)
     ========================= */
  --success: #10B981;
  --success-light: #34D399;
  --success-pale: #D1FAE5;

  --warning: #F59E0B;
  --warning-light: #FBBF24;
  --warning-pale: #FEF3C7;

  --error: #EF4444;
  --error-light: #F87171;
  --error-pale: #FEE2E2;

  /* =========================
     Couleurs de texte
     (text-primary aligné au thème)
     ========================= */
  --text-primary: #1E3A8A;     /* ton text-primary */
  --text-secondary: #334155;   /* slate-700 */
  --text-tertiary: #64748B;    /* slate-500 */
  --text-muted: #94A3B8;       /* slate-400 */

  /* =========================
     Couleurs de fond
     ========================= */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;

  /* Gradient froid/tech (cyan → neutre → bleu clair) */
  --bg-gradient: linear-gradient(
    135deg,
    #ECFEFF 0%,
    #FFFFFF 32%,
    #EFF6FF 72%,
    #F8FAFC 100%
  );

  /* Gradient warm (orange doux → neutre → cyan clair) */
  --bg-gradient-warm: linear-gradient(
    135deg,
    #FFEDD5 0%,
    #FFFFFF 52%,
    #ECFEFF 100%
  );

  /* =========================
     Ombres (légèrement teintées)
     ========================= */
  --shadow-soft: 0 2px 4px -1px rgba(30, 58, 138, 0.06),
                 0 1px 2px -1px rgba(30, 58, 138, 0.10);

  --shadow-medium: 0 4px 6px -1px rgba(30, 58, 138, 0.10),
                   0 2px 4px -1px rgba(30, 58, 138, 0.06);

  --shadow-large: 0 10px 15px -3px rgba(30, 58, 138, 0.12),
                  0 4px 6px -2px rgba(30, 58, 138, 0.06);

  --shadow-xl: 0 20px 25px -5px rgba(30, 58, 138, 0.14),
               0 10px 10px -5px rgba(30, 58, 138, 0.06);

  /* =========================
     Bordures et rayons
     ========================= */
  --border-radius: 0.75rem;
  --border-radius-lg: 1rem;
  --border-radius-xl: 1.5rem;

  /* Couleurs de bordure */
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;
  --border-strong: #94A3B8;
}

/* AmÃ©lioration du body avec gradient subtil */
body {
    background: var(--bg-gradient);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-primary);
}

/* AmÃ©lioration du header */
header {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
}

/* AmÃ©lioration de la barre de promotion */
#offer-timer {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--secondary) 100%);
    position: relative;
    overflow: hidden;
}

#offer-timer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* AmÃ©lioration des cartes principales */
.rounded-3xl {
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-large);
    backdrop-filter: blur(20px);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

/* AmÃ©lioration du stepper */
.step {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.step-dot {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
}

.step-active .step-dot {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-lighter) 100%);
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary);
}

.step:hover .step-dot {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

/* AmÃ©lioration des champs de formulaire */
input, select, textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    position: relative;
}

input:focus, select:focus, textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px var(--primary-pale), var(--shadow-medium);
    border-color: var(--primary);
    background: var(--bg-primary);
}

/* Ã‰tats de validation des champs */
input:valid, select:valid, textarea:valid {
    border-color: var(--success);
    background: var(--success-pale);
}

input:invalid:not(:placeholder-shown), select:invalid:not(:placeholder-shown), textarea:invalid:not(:placeholder-shown) {
    border-color: var(--error);
    background: var(--error-pale);
}

/* Animation de validation */
input:valid, select:valid, textarea:valid {
    animation: validPulse 0.6s ease-out;
}

@keyframes validPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Indicateur de validation */
.field-container {
    position: relative;
}

.field-container::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.field-container.valid::after {
    content: 'âœ“';
    color: var(--success);
    font-weight: bold;
    opacity: 1;
}

.field-container.invalid::after {
    content: '!';
    color: var(--error);
    font-weight: bold;
    opacity: 1;
}

/* AmÃ©lioration des labels de sÃ©lection */
label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    position: relative;
    cursor: pointer;
}

label:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-light);
    background: var(--primary-pale);
}

/* Ã‰tat sÃ©lectionnÃ© pour les labels */
label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-pale);
    box-shadow: 0 0 0 2px var(--primary-pale);
}

/* Animation de sÃ©lection */
label:has(input:checked) {
    animation: selectPulse 0.4s ease-out;
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Indicateur de sÃ©lection */
label:has(input:checked)::before {
    content: 'âœ“';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* AmÃ©lioration des boutons */
button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

button:active {
    transform: translateY(0);
}

/* Ã‰tat de chargement des boutons */
button.loading {
    pointer-events: none;
    opacity: 0.7;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Boutons dÃ©sactivÃ©s */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-soft);
}

/* AmÃ©lioration de la barre de progression */
#pbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary-lighter) 100%);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

#pbar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* AmÃ©lioration de la sidebar */
aside {
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-large);
}

/* AmÃ©lioration des sections de rÃ©capitulatif */
#recap li {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

#recap li:hover {
    background: var(--primary-pale);
    transform: translateX(4px);
}

/* AmÃ©lioration des garanties de sÃ©curitÃ© */
.bg-accent\/10 {
    background: linear-gradient(135deg, var(--accent-pale) 0%, var(--accent-pale) 100%);
    border: 1px solid var(--accent-light);
}

/* AmÃ©lioration des animations d'entrÃ©e */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* AmÃ©lioration des Ã©tats de focus */
.focus-ring:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* AmÃ©lioration des couleurs de texte */
.text-ink-900 {
    color: var(--text-primary);
}

.text-ink-700 {
    color: var(--text-secondary);
}

.text-ink-600 {
    color: var(--text-tertiary);
}

.text-ink-500 {
    color: var(--text-muted);
}

/* AmÃ©lioration des couleurs de fond */
.bg-primary {
    background-color: var(--primary);
}

.bg-primary-light {
    background-color: var(--primary-light);
}

.bg-secondary {
    background-color: var(--secondary);
}

.bg-accent {
    background-color: var(--accent);
}

/* AmÃ©lioration des couleurs de bordure */
.border-slate-100 {
    border-color: var(--border-light);
}

.border-slate-200 {
    border-color: var(--border-medium);
}

/* AmÃ©lioration des transitions globales */
* {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Styles pour le header du formulaire */
.form-header {
    position: relative;
    overflow: hidden;
}

.form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.badge-trust {
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.badge-trust:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.progress-container {
    position: relative;
    overflow: hidden;
}

.progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* AmÃ©lioration tablette */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Header tablette */
    header .container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    /* Titre principal tablette */
    h1 {
        font-size: 1.75rem;
        line-height: 1.4;
    }
    
    /* Stepper tablette */
    .step-dot {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 0.875rem;
    }
    
    /* Champs de formulaire tablette */
    input, select, textarea {
        padding: 1rem;
        font-size: 16px;
    }
    
    /* Labels de sÃ©lection tablette */
    label {
        padding: 1.25rem;
    }
    
    /* Boutons tablette */
    button {
        min-height: 50px;
        padding: 1rem 1.75rem;
        font-size: 1rem;
    }
    
    /* Grille tablette */
    .grid {
        gap: 1.25rem;
    }
    
    /* Espacement des sections tablette */
    .space-y-8 > * + * {
        margin-top: 2.5rem;
    }
    
    /* Sidebar tablette */
    aside {
        margin-top: 1.5rem;
    }
    
    /* Espacement formulaire tablette */
    .form-section {
        margin-bottom: 6rem;
        padding-bottom: 1.5rem;
    }
    
    .form-section form {
        padding-bottom: 3rem;
    }
}

/* AmÃ©lioration mobile */
@media (max-width: 768px) {
    .rounded-3xl {
        border-radius: var(--border-radius);
        margin: 0.5rem;
    }
    
    button:hover {
        transform: none;
    }
    
    button:active {
        transform: scale(0.98);
    }
    
    /* AmÃ©lioration de l'espacement mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Header mobile optimisÃ© */
    header .container {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    /* Titre principal mobile */
    h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    /* Stepper mobile simplifiÃ© */
    .step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .step-dot {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.875rem;
    }
    
    /* Champs de formulaire mobile */
    input, select, textarea {
        font-size: 16px; /* Ã‰vite le zoom sur iOS */
        padding: 0.875rem;
    }
    
    /* Labels de sÃ©lection mobile */
    label {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Boutons mobiles */
    button {
        min-height: 48px; /* Taille tactile recommandÃ©e */
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    /* Barre de progression mobile */
    #pbar, #pbarm {
        height: 0.5rem;
    }
    
    /* Sidebar mobile */
    aside {
        margin-top: 2rem;
        order: -1; /* Place la sidebar avant le formulaire sur mobile */
    }
    
    /* Grille mobile */
    .grid {
        gap: 1rem;
    }
    
    /* Espacement des sections */
    .space-y-8 > * + * {
        margin-top: 2rem;
    }
    
    /* Espacement entre formulaire et boutons de navigation mobile */
    .form-section {
        margin-bottom: 10rem; /* Encore plus d'espace pour les boutons mobiles */
        padding-bottom: 2rem;
    }
    
    /* Espacement des champs de formulaire mobile */
    .space-y-4 > * + * {
        margin-top: 2rem;
    }
    
    /* Espacement supplÃ©mentaire pour les champs de formulaire */
    .space-y-4 {
        padding-bottom: 2rem;
    }
    
    /* Espacement des fieldset mobile */
    fieldset {
        margin-bottom: 2rem;
    }
    
    /* Espacement spÃ©cifique avant les boutons de navigation */
    .form-section form {
        padding-bottom: 6rem; /* Encore plus d'espace avant les boutons mobiles */
    }
    
    /* Espacement des boutons dans les fieldset */
    fieldset .flex.justify-end {
        margin-top: 4rem; /* Plus d'espace avant le bouton Continuer */
        padding-bottom: 2rem;
    }
    
    /* Espacement des boutons de navigation mobile */
    .mobile-navigation {
        margin-top: 4rem;
        padding-top: 2rem;
    }
    
    /* Espacement supplÃ©mentaire entre progression et formulaire mobile */
    .form-section .space-y-8 > *:last-child {
        margin-bottom: 6rem; /* Encore plus d'espace avant les boutons mobiles */
    }
    
    /* Espacement spÃ©cifique pour le dernier fieldset */
    fieldset:last-of-type {
        margin-bottom: 7rem;
        padding-bottom: 4rem;
    }
    
    /* Espacement supplÃ©mentaire pour tous les fieldset sur mobile */
    fieldset {
        margin-bottom: 4rem;
        padding-bottom: 3rem;
    }
    
    /* Espacement supplÃ©mentaire pour le dernier champ de chaque Ã©tape */
    fieldset > *:last-child {
        margin-bottom: 2rem;
    }
    
    /* Espacement de la barre de progression mobile */
    .mobile-navigation .h-2 {
        margin-bottom: 1rem; /* Espace sous la barre de progression */
    }
    
    /* Espacement du contenu de progression mobile */
    .mobile-navigation .flex.items-center.justify-between {
        margin-bottom: 1rem;
    }
    
    /* Espacement supplÃ©mentaire pour le conteneur principal mobile */
    @media (max-width: 768px) {
        main {
            padding-bottom: 12rem !important;
        }
        
        .form-section {
            margin-bottom: 12rem !important;
        }
        
        .form-section form {
            padding-bottom: 8rem !important;
        }
    }
    
    /* Texte mobile */
    .text-sm {
        font-size: 0.875rem;
    }
    
    .text-xs {
        font-size: 0.75rem;
    }
}

/* AmÃ©lioration mobile trÃ¨s petit Ã©cran */
@media (max-width: 480px) {
    /* Header ultra compact */
    header .container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    /* Titre ultra compact */
    h1 {
        font-size: 1.25rem;
    }
    
    /* Stepper ultra compact */
    .step-dot {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    /* Champs ultra compacts */
    input, select, textarea {
        padding: 0.75rem;
        font-size: 16px;
    }
    
    /* Labels ultra compacts */
    label {
        padding: 0.875rem;
    }
    
    /* Boutons ultra compacts */
    button {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    /* Espacement ultra compact */
    .space-y-8 > * + * {
        margin-top: 1.5rem;
    }
    
    /* Grille ultra compacte */
    .grid {
        gap: 0.75rem;
    }
}

/* AmÃ©lioration des Ã©tats de chargement */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AmÃ©lioration des messages d'erreur */
.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.5s ease-in-out;
    padding: 0.5rem;
    background: var(--error-pale);
    border: 1px solid var(--error-light);
    border-radius: 0.5rem;
}

.error-message::before {
    content: 'âš ï¸';
    font-size: 1rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Messages de succÃ¨s */
.success-message {
    color: var(--success);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--success-pale);
    border: 1px solid var(--success-light);
    border-radius: 0.5rem;
}

.success-message::before {
    content: 'âœ…';
    font-size: 1rem;
}

/* Messages d'information */
.info-message {
    color: var(--secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--secondary-pale);
    border: 1px solid var(--secondary-light);
    border-radius: 0.5rem;
}

.info-message::before {
    content: 'â„¹ï¸';
    font-size: 1rem;
}

/* AmÃ©lioration des tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-large);
    z-index: 1000;
    max-width: 200px;
    text-align: center;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
}

/* AmÃ©lioration de l'accessibilitÃ© */
.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;
}

/* Focus visible amÃ©liorÃ© */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* AmÃ©lioration des champs requis */
input:required, select:required, textarea:required {
    border-left: 3px solid var(--primary);
}

/* Indicateur de champ requis */
.required::after {
    content: ' *';
    color: var(--error);
    font-weight: bold;
}
