/* CSS Principal - IWI Fork CRM - Optimisé Mobile iOS/Android */

/* Variables CSS */
:root {
    --primary-color: #3B82F6;
    --primary-dark: #1E40AF;
    --primary-light: #93C5FD;
    --secondary-color: #10B981;
    --accent-color: #F59E0B;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --success-color: #10B981;
    --info-color: #3B82F6;
    
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Variables spécifiques mobile */
    --touch-target: 44px; /* Minimum recommandé iOS/Android */
    --mobile-spacing: 1rem;
    --mobile-padding: 1rem;
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-left: env(safe-area-inset-left);
    --safe-area-inset-right: env(safe-area-inset-right);
}

/* Reset et base optimisé mobile */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Supprime le highlight sur iOS */
}

html {
    /* Prévient le zoom sur focus iOS */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-sans);
    font-size: 16px; /* Minimum 16px pour éviter le zoom iOS */
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--gray-50);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Support des safe areas */
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    
    /* Prévient l'overscroll bounce sur iOS */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Améliore le scroll sur mobile */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Titres responsifs */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

/* Tailles responsive par défaut */
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 1.875rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h4 { font-size: clamp(1.125rem, 2.5vw, 1.25rem); }
h5 { font-size: clamp(1rem, 2vw, 1.125rem); }
h6 { font-size: 1rem; }

/* Liens optimisés pour le touch */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
    /* Zone de touch plus grande */
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0;
}

a:hover,
a:active {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Boutons optimisés mobile */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target); /* Zone de touch minimum */
    padding: 0.75rem 1.5rem;
    font-size: 1rem; /* Minimum 16px pour iOS */
    font-weight: 500;
    line-height: 1.25;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    
    /* Améliore l'affordance tactile */
    position: relative;
    transform: translateZ(0); /* Force hardware acceleration */
}

.btn:active {
    transform: scale(0.98); /* Feedback tactile */
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:active {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--gray-600);
    color: white;
    border-color: var(--gray-600);
}

.btn-secondary:hover,
.btn-secondary:active {
    background-color: var(--gray-700);
    border-color: var(--gray-700);
    color: white;
    text-decoration: none;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-success:hover,
.btn-success:active {
    background-color: #059669;
    border-color: #059669;
    color: white;
    text-decoration: none;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.btn-danger:hover,
.btn-danger:active {
    background-color: #DC2626;
    border-color: #DC2626;
    color: white;
    text-decoration: none;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover,
.btn-outline:active {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Boutons spéciaux mobile */
.btn-mobile-full {
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-mobile-large {
    min-height: 48px;
    font-size: 1.125rem;
    padding: 1rem 2rem;
}

/* Formulaires optimisés mobile */
.form-control {
    display: block;
    width: 100%;
    min-height: var(--touch-target);
    padding: 0.75rem 1rem;
    font-size: 1rem; /* Minimum 16px pour iOS */
    line-height: 1.5;
    color: var(--gray-700);
    background-color: white;
    border: 2px solid var(--gray-300); /* Bordure plus épaisse pour mobile */
    border-radius: var(--border-radius);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    
    /* Améliore l'expérience de saisie mobile */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    /* Prévient le zoom sur iOS */
    font-size: 1rem;
}

.form-control::placeholder {
    color: var(--gray-400);
    opacity: 1;
}

/* Amélioration des selects sur mobile */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Inputs numériques optimisés */
input[type="number"].form-control {
    -moz-appearance: textfield;
}

input[type="number"].form-control::-webkit-outer-spin-button,
input[type="number"].form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-error {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--danger-color);
    padding: 0.5rem;
    background-color: #FEE2E2;
    border-radius: var(--border-radius);
}

/* Cards responsive */
.card {
    background-color: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1rem;
}

.card-header {
    padding: 1rem;
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    background-color: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* Alerts responsive */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    border-left: 4px solid transparent;
}

.alert-success {
    color: #065F46;
    background-color: #D1FAE5;
    border-color: #A7F3D0;
    border-left-color: var(--success-color);
}

.alert-error,
.alert-danger {
    color: #991B1B;
    background-color: #FEE2E2;
    border-color: #FECACA;
    border-left-color: var(--danger-color);
}

.alert-warning {
    color: #92400E;
    background-color: #FEF3C7;
    border-color: #FDE68A;
    border-left-color: var(--warning-color);
}

.alert-info {
    color: #1E40AF;
    background-color: #DBEAFE;
    border-color: #BFDBFE;
    border-left-color: var(--info-color);
}

/* Tables responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    min-width: 600px; /* Largeur minimum pour scroll horizontal */
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    color: var(--gray-900);
    background-color: var(--gray-50);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

/* Badges optimisés */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-primary {
    color: var(--primary-color);
    background-color: #EBF4FF;
}

.badge-success {
    color: var(--success-color);
    background-color: #D1FAE5;
}

.badge-warning {
    color: var(--warning-color);
    background-color: #FEF3C7;
}

.badge-danger {
    color: var(--danger-color);
    background-color: #FEE2E2;
}

/* Spinner de chargement */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--gray-200);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Container responsive */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
}

/* Grid system responsive */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* Spacing utilities */
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }

/* Utilitaires de margin/padding */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-4 { margin: 1rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* Utilitaires d'affichage */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Utilitaires de largeur */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.w-2\/3 { width: 66.666667%; }
.w-1\/4 { width: 25%; }
.w-3\/4 { width: 75%; }

/* Utilitaires de hauteur */
.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

/* Utilitaires de texte */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-thin { font-weight: 100; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Utilitaires de couleur */
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Modales responsive */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Dropdowns responsive */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-width: 90vw;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-100);
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item:active {
    background-color: var(--gray-50);
    color: var(--gray-900);
}

/* Tabs responsives */
.tabs {
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-list {
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: max-content;
}

.tab-item {
    margin: 0;
    flex-shrink: 0;
}

.tab-link {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.tab-link:hover,
.tab-link:active {
    color: var(--gray-900);
    background-color: var(--gray-50);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* États de focus améliorés pour mobile */
.btn:focus,
.form-control:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Amélioration pour les lecteurs d'écran */
.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;
}

/* Tooltips adaptés mobile */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 250px;
    background-color: var(--gray-800);
    color: white;
    text-align: center;
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Breakpoints responsive */

/* Petit mobile (jusqu'à 480px) */
@media (max-width: 480px) {
    :root {
        --mobile-padding: 0.75rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem;
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 0.75rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Mobile paysage (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    
    .btn {
        width: auto;
    }
    
    .btn-mobile-full {
        width: 100%;
    }
}

/* Tablette (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    
    .modal-content {
        width: 90%;
        max-width: 600px;
    }
    
    .dropdown-menu {
        min-width: 160px;
    }
}

/* Orientation paysage sur mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .modal-content {
        max-height: 80vh;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        min-height: 40px;
    }
    
    .form-control {
        min-height: 40px;
        padding: 0.5rem 0.75rem;
    }
}

/* Mode sombre adapté mobile */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1F2937;
        --gray-100: #374151;
        --gray-200: #4B5563;
        --gray-300: #6B7280;
        --gray-400: #9CA3AF;
        --gray-500: #D1D5DB;
        --gray-600: #E5E7EB;
        --gray-700: #F3F4F6;
        --gray-800: #F9FAFB;
        --gray-900: #FFFFFF;
    }
    
    body {
        background-color: #111827;
        color: #F3F4F6;
    }
    
    .card {
        background-color: #1F2937;
        border-color: #374151;
    }
    
    .form-control {
        background-color: #374151;
        border-color: #4B5563;
        color: #F3F4F6;
    }
    
    .form-control::placeholder {
        color: #9CA3AF;
    }
    
    .modal-content {
        background-color: #1F2937;
    }
    
    .dropdown-menu {
        background-color: #1F2937;
        border-color: #374151;
    }
}

/* Optimisations spécifiques iOS */
@supports (-webkit-touch-callout: none) {
    /* Désactive le zoom automatique sur les inputs */
    input[type="text"],
    input[type="email"], 
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Améliore le scroll momentum */
    body,
    .scroll-container {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Désactive la sélection de texte sur les éléments interactifs */
    .btn,
    .badge,
    .alert {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
}

/* Optimisations spécifiques Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select.form-control {
        background-image: none;
    }
    
    /* Améliore le rendu des bordures */
    .btn,
    .form-control,
    .card {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* High DPI / Retina */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn,
    .form-control {
        border-width: 0.5px;
    }
}

/* États hover désactivés sur touch */
@media (hover: none) {
    .btn:hover,
    .dropdown-item:hover,
    .tab-link:hover,
    a:hover {
        background-color: initial;
        color: initial;
        text-decoration: initial;
    }
    
    /* Utilise :active au lieu de :hover */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
    
    .dropdown-item:active {
        background-color: var(--gray-100);
    }
}

/* Amélioration pour les petits écrans très étroits */
@media (max-width: 320px) {
    :root {
        --mobile-padding: 0.5rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .form-control {
        padding: 0.625rem 0.75rem;
    }
    
    .modal-content {
        margin: 0.25rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
}

/* Support des notch iPhone X+ */
@supports (padding: max(0px)) {
    body {
        padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
        padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
    }
    
    .modal-overlay {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Print styles optimisés */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    .no-print,
    .btn,
    .modal-overlay,
    .dropdown-menu {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        margin-bottom: 1rem;
        page-break-inside: avoid;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
        padding: 0.5rem !important;
    }
}

/* Animations réduites pour économiser la batterie */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .fade-in,
    .slide-in {
        animation: none;
    }
}

/* Amélioration de contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0056b3;
        --success-color: #0e6b47;
        --danger-color: #c21807;
        --warning-color: #b7800a;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
}

/* Utilitaires spécifiques mobile */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
}

/* Spacing adaptatif */
.space-mobile {
    margin: 0.5rem;
}

.space-tablet {
    margin: 0.75rem;
}

.space-desktop {
    margin: 1rem;
}

@media (min-width: 481px) {
    .space-mobile {
        margin: 0.75rem;
    }
}

@media (min-width: 768px) {
    .space-mobile {
        margin: 1rem;
    }
    
    .space-tablet {
        margin: 1rem;
    }
}

@media (min-width: 1024px) {
    .space-mobile {
        margin: 1.5rem;
    }
    
    .space-tablet {
        margin: 1.5rem;
    }
    
    .space-desktop {
        margin: 1.5rem;
    }
}

/* Effets de feedback tactile */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.touch-feedback:active::after {
    width: 300px;
    height: 300px;
}

/* Optimisation pour les connexions lentes */
@media (prefers-reduced-data: reduce) {
    /* Désactive les animations gourmandes */
    .fade-in,
    .slide-in,
    .spinner {
        animation: none;
    }
    
    /* Réduit les effets visuels */
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
    
    .btn {
        box-shadow: none;
    }
}

/* Fix pour Safari iOS et webkit */
@supports (-webkit-appearance: none) {
    .form-control {
        -webkit-appearance: none;
    }
    
    select.form-control {
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    }
}

/* Corrections pour les anciens navigateurs mobiles */
@supports not (display: grid) {
    .grid {
        display: flex;
        flex-wrap: wrap;
    }
    
    .grid > * {
        flex: 1;
        min-width: 200px;
        margin: 0.5rem;
    }
}

/* Amélioration pour les très hautes résolutions */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    body {
        font-size: 18px;
    }
    
    .btn {
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }
    
    .form-control {
        padding: 1rem 1.25rem;
        font-size: 1.125rem;
    }
}

/* Classes d'aide pour le développement mobile */
.debug-mobile {
    border: 2px solid red !important;
    background: rgba(255, 0, 0, 0.1) !important;
}

.debug-tablet {
    border: 2px solid blue !important;
    background: rgba(0, 0, 255, 0.1) !important;
}

.debug-desktop {
    border: 2px solid green !important;
    background: rgba(0, 255, 0, 0.1) !important;
}
/* 
 * Animations CSS Modernes - IWI Formateurs v2.0
 * Système d'animations performantes et accessibles
 */

/* ================================
   ANIMATIONS FONDAMENTALES
   ================================ */

/* Animations d'entrée */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animations de sortie */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

@keyframes slideOutUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ================================
   ANIMATIONS DE ZOOM
   ================================ */

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(0.3);
    }
    to {
        opacity: 0;
        transform: scale(0.3);
    }
}

@keyframes zoomInUp {
    from {
        opacity: 0;
        transform: scale(0.1) translateY(1000px);
        animation-timing-function: ease-in-out;
    }
    60% {
        opacity: 1;
        transform: scale(0.475) translateY(-60px);
        animation-timing-function: ease-out;
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        animation-timing-function: ease-out;
    }
}

/* ================================
   ANIMATIONS DE REBOND
   ================================ */

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-30px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceInUp {
    0% {
        opacity: 0;
        transform: translateY(3000px);
    }
    60% {
        opacity: 1;
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(10px);
    }
    90% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0);
    }
}

/* ================================
   ANIMATIONS DE ROTATION
   ================================ */

@keyframes rotateIn {
    from {
        transform-origin: center;
        transform: rotate(-200deg);
        opacity: 0;
    }
    to {
        transform-origin: center;
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes rotateInDownLeft {
    from {
        transform-origin: left bottom;
        transform: rotate(-45deg);
        opacity: 0;
    }
    to {
        transform-origin: left bottom;
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   ANIMATIONS DE PULSATION
   ================================ */

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* ================================
   ANIMATIONS DE TREMBLEMENT
   ================================ */

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes wobble {
    0% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
    100% {
        transform: translateX(0%);
    }
}

@keyframes jello {
    0%, 11.1%, 100% {
        transform: skewX(0deg) skewY(0deg);
    }
    22.2% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }
    33.3% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }
    44.4% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }
    55.5% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }
    66.6% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }
    77.7% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }
    88.8% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

/* ================================
   ANIMATIONS SPÉCIALES
   ================================ */

@keyframes flip {
    0% {
        transform: perspective(400px) translateZ(0) rotateY(-1turn) scale(1);
        animation-timing-function: ease-out;
    }
    40% {
        transform: perspective(400px) translateZ(150px) rotateY(-190deg) scale(1);
        animation-timing-function: ease-out;
    }
    50% {
        transform: perspective(400px) translateZ(150px) rotateY(-170deg) scale(1);
        animation-timing-function: ease-in;
    }
    80% {
        transform: perspective(400px) translateZ(0) rotateY(0deg) scale(0.95);
        animation-timing-function: ease-in;
    }
    100% {
        transform: perspective(400px) translateZ(0) rotateY(0deg) scale(1);
        animation-timing-function: ease-in;
    }
}

@keyframes lightSpeedIn {
    0% {
        transform: translateX(100%) skewX(-30deg);
        opacity: 0;
    }
    60% {
        transform: translateX(-20%) skewX(20deg);
        opacity: 1;
    }
    80% {
        transform: translateX(0%) skewX(-5deg);
        opacity: 1;
    }
    100% {
        transform: translateX(0%) skewX(0deg);
        opacity: 1;
    }
}

@keyframes rollIn {
    0% {
        opacity: 0;
        transform: translateX(-100%) rotate(-120deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0px) rotate(0deg);
    }
}

/* ================================
   ANIMATIONS DE GRADIENT
   ================================ */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ================================
   ANIMATIONS DE LOADING
   ================================ */

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes loadingBars {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ================================
   CLASSES UTILITAIRES D'ANIMATION
   ================================ */

/* Animations d'entrée */
.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease-out; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease-out; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease-out; }

.animate-slide-in-up { animation: slideInUp 0.5s ease-out; }
.animate-slide-in-down { animation: slideInDown 0.5s ease-out; }
.animate-slide-in-left { animation: slideInLeft 0.5s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.5s ease-out; }

/* Animations de sortie */
.animate-fade-out { animation: fadeOut 0.3s ease-in; }
.animate-fade-out-up { animation: fadeOutUp 0.3s ease-in; }
.animate-fade-out-down { animation: fadeOutDown 0.3s ease-in; }

.animate-slide-out-up { animation: slideOutUp 0.3s ease-in; }
.animate-slide-out-down { animation: slideOutDown 0.3s ease-in; }
.animate-slide-out-left { animation: slideOutLeft 0.3s ease-in; }
.animate-slide-out-right { animation: slideOutRight 0.3s ease-in; }

/* Animations de zoom */
.animate-zoom-in { animation: zoomIn 0.5s ease-out; }
.animate-zoom-out { animation: zoomOut 0.3s ease-in; }
.animate-zoom-in-up { animation: zoomInUp 0.6s ease-out; }

/* Animations de rebond */
.animate-bounce { animation: bounce 1s infinite; }
.animate-bounce-in { animation: bounceIn 0.8s ease-out; }
.animate-bounce-in-up { animation: bounceInUp 1s ease-out; }

/* Animations de rotation */
.animate-rotate-in { animation: rotateIn 0.6s ease-out; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-spin-slow { animation: spin 2s linear infinite; }
.animate-spin-fast { animation: spin 0.5s linear infinite; }

/* Animations de pulsation */
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-pulse-fast { animation: pulse 1s ease-in-out infinite; }
.animate-pulse-slow { animation: pulse 3s ease-in-out infinite; }
.animate-heartbeat { animation: heartbeat 1.5s ease-in-out infinite; }

/* Animations de mouvement */
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-wobble { animation: wobble 1s ease-in-out; }
.animate-jello { animation: jello 0.9s ease-in-out; }

/* Animations spéciales */
.animate-flip { animation: flip 1s ease-in-out; }
.animate-light-speed-in { animation: lightSpeedIn 1s ease-out; }
.animate-roll-in { animation: rollIn 1s ease-out; }

/* ================================
   DELAYS ET DURÉES
   ================================ */

/* Délais d'animation */
.animate-delay-75 { animation-delay: 75ms; }
.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-150 { animation-delay: 150ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-500 { animation-delay: 500ms; }
.animate-delay-700 { animation-delay: 700ms; }
.animate-delay-1000 { animation-delay: 1000ms; }

/* Durées d'animation */
.animate-duration-75 { animation-duration: 75ms; }
.animate-duration-100 { animation-duration: 100ms; }
.animate-duration-150 { animation-duration: 150ms; }
.animate-duration-200 { animation-duration: 200ms; }
.animate-duration-300 { animation-duration: 300ms; }
.animate-duration-500 { animation-duration: 500ms; }
.animate-duration-700 { animation-duration: 700ms; }
.animate-duration-1000 { animation-duration: 1000ms; }

/* ================================
   ANIMATIONS INTERACTIVES
   ================================ */

/* Hover animations */
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
    transition: transform 0.3s ease;
}

.hover-bounce:hover {
    animation: bounce 0.6s ease;
}

.hover-pulse:hover {
    animation: pulse 0.6s ease;
}

.hover-shake:hover {
    animation: shake 0.6s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    transition: box-shadow 0.3s ease;
}

/* Focus animations */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    transition: box-shadow 0.2s ease;
}

/* ================================
   ANIMATIONS DE CHARGEMENT
   ================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Loading bars */
.loading-bars {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.loading-bars span {
    width: 3px;
    height: 20px;
    background: currentColor;
    animation: loadingBars 1.2s infinite ease-in-out;
}

.loading-bars span:nth-child(1) { animation-delay: -1.2s; }
.loading-bars span:nth-child(2) { animation-delay: -1.1s; }
.loading-bars span:nth-child(3) { animation-delay: -1.0s; }
.loading-bars span:nth-child(4) { animation-delay: -0.9s; }
.loading-bars span:nth-child(5) { animation-delay: -0.8s; }

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
    animation: ripple 0.6s ease-out;
}

/* ================================
   ANIMATIONS AVANCÉES
   ================================ */

/* Typing animation */
.typing {
    overflow: hidden;
    border-right: 2px solid;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: currentColor; }
}

/* Floating animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* Morphing button */
.morph-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.morph-button:hover {
    border-radius: 50px;
    transform: scale(1.1);
}

/* Glitch effect */
.glitch {
    position: relative;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.3s infinite;
    color: #ff0000;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.3s infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(2px, 2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(-2px, 2px); }
}

/* ================================
   TRANSITIONS PERSONNALISÉES
   ================================ */

/* Timing functions */
.ease-in-expo { transition-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); }
.ease-out-expo { transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1); }
.ease-in-out-expo { transition-timing-function: cubic-bezier(1, 0, 0, 1); }

.ease-in-circ { transition-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.335); }
.ease-out-circ { transition-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1); }
.ease-in-out-circ { transition-timing-function: cubic-bezier(0.785, 0.135, 0.15, 0.86); }

.ease-in-back { transition-timing-function: cubic-bezier(0.6, -0.28, 0.735, 0.045); }
.ease-out-back { transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.ease-in-out-back { transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }

/* ================================
   ANIMATIONS DE PARTICULES
   ================================ */

/* Confetti animation */
.confetti {
    position: relative;
    overflow: hidden;
}

.confetti::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ff6b6b' fill-opacity='0.8'%3E%3Cpath d='M0 0h20L0 20'/%3E%3C/g%3E%3C/svg%3E");
    animation: confetti-fall 3s linear infinite;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100%) rotate(0deg); }
    100% { transform: translateY(100vh) rotate(360deg); }
}

/* Snow animation */
.snow {
    position: relative;
    overflow: hidden;
}

.snow::before,
.snow::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='5' cy='5' r='2' fill='white' fill-opacity='0.8'/%3E%3C/svg%3E");
    animation: snow-fall 10s linear infinite;
    pointer-events: none;
}

.snow::after {
    animation-delay: -5s;
    animation-duration: 15s;
}

@keyframes snow-fall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* ================================
   UTILITAIRES DE PERFORMANCE
   ================================ */

/* GPU acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Will-change optimizations */
.will-change-transform { will-change: transform; }
.will-change-opacity { will-change: opacity; }
.will-change-scroll { will-change: scroll-position; }
.will-change-contents { will-change: contents; }
.will-change-auto { will-change: auto; }

/* ================================
   RESPONSIVE ANIMATIONS
   ================================ */

/* Réduire les animations sur mobile */
@media (max-width: 768px) {
    .animate-fade-in-up,
    .animate-slide-in-up,
    .animate-bounce-in-up {
        animation-duration: 0.3s;
    }
    
    .animate-pulse,
    .animate-bounce {
        animation-duration: 1s;
    }
}

/* ================================
   ACCESSIBILITÉ
   ================================ */

/* Respecter les préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-bounce,
    .animate-pulse,
    .animate-spin,
    .animate-shake,
    .floating,
    .glitch {
        animation: none !important;
    }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .skeleton {
        background: linear-gradient(90deg, #000 25%, #333 50%, #000 75%);
    }
    
    .loading-dots span,
    .loading-bars span {
        background: currentColor;
        opacity: 1;
    }
}

/* ================================
   DEBUG ET DÉVELOPPEMENT
   ================================ */

/* Mode debug pour voir les animations */
.debug-animations * {
    animation-duration: 10s !important;
    transition-duration: 2s !important;
    outline: 1px solid red;
}

/* Pause toutes les animations */
.pause-animations * {
    animation-play-state: paused !important;
}

/* ================================
   COMPOSITIONS D'ANIMATIONS
   ================================ */

/* Séquences d'animations complexes */
.animate-sequence-1 {
    animation: 
        fadeInUp 0.6s ease-out 0s,
        pulse 2s ease-in-out 0.6s infinite;
}

.animate-sequence-2 {
    animation: 
        slideInLeft 0.5s ease-out 0s,
        bounce 0.8s ease-out 0.5s,
        pulse 2s ease-in-out 1.3s infinite;
}

.animate-hero {
    animation: 
        fadeInUp 0.8s ease-out 0s,
        floating 3s ease-in-out 0.8s infinite;
}

.animate-card-stack {
    animation: 
        slideInUp 0.6s ease-out var(--delay, 0s),
        hover-lift 0.3s ease-out var(--delay, 0s);
}

/* Variables CSS pour animations dynamiques */
.animate-dynamic {
    --duration: 0.5s;
    --delay: 0s;
    --easing: ease-out;
    
    animation-duration: var(--duration);
    animation-delay: var(--delay);
    animation-timing-function: var(--easing);
}

/* ================================
   PRINT STYLES
   ================================ */

@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
    
    .loading-dots,
    .loading-bars,
    .confetti,
    .snow {
        display: none !important;
    }
}