/* ============================================
   HISTO-PÉDIA - STYLES PARTAGÉS
   Améliorations globales pour tout le site
   ============================================ */

:root {
    --primary: #0d3b66;
    --primary-light: #1a508b;
    --primary-dark: #0a2d4d;
    --secondary: #f4d35e;
    --secondary-light: #f9c74f;
    --light: #f8f9fa;
    --light-gray: #e9ecef;
    --dark: #212529;
    --text: #343a40;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --border-radius: 12px;
    --box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ============================================
   AMÉLIORATIONS D'ACCESSIBILITÉ
   ============================================ */

/* Focus visible pour la navigation au clavier */
*:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to main content link (pour lecteurs d'écran) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Amélioration du contraste pour les liens */
a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-light);
    text-decoration-thickness: 2px;
}

/* ============================================
   AMÉLIORATIONS DE PERFORMANCE
   ============================================ */

/* Lazy loading pour les images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Optimisation des animations */
@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;
    }
}

/* ============================================
   COMPOSANTS AMÉLIORÉS
   ============================================ */

/* Toast notifications améliorées */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast.info {
    border-left-color: var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading states améliorés */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loader amélioré */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   AMÉLIORATIONS UX
   ============================================ */

/* Boutons avec états améliorés */
.btn {
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Tooltip amélioré */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--dark);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ============================================
   AMÉLIORATIONS RESPONSIVE
   ============================================ */

/* Container responsive amélioré */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 40px);
}

/* Grid responsive amélioré */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
    gap: clamp(20px, 4vw, 30px);
}

/* Améliorations pour tablettes */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }
    
    .responsive-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 25px;
    }
}

/* Améliorations pour mobile */
@media (max-width: 767px) {
    .container {
        padding: 0 16px;
    }
    
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Améliorer la lisibilité sur mobile */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Boutons plus grands sur mobile */
    .btn {
        padding: 14px 24px;
        font-size: 1rem;
        min-height: 44px; /* Taille minimale recommandée pour le touch */
    }
    
    /* Améliorer les zones de touch */
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   AMÉLIORATIONS D'ERREUR
   ============================================ */

.error-boundary {
    padding: 40px;
    text-align: center;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 40px auto;
    max-width: 600px;
}

.error-boundary h2 {
    color: var(--danger);
    margin-bottom: 16px;
}

.error-boundary p {
    color: var(--text);
    margin-bottom: 24px;
}

/* Messages d'erreur améliorés */
.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
}

.error-message i {
    font-size: 1.2rem;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    header,
    footer,
    .btn,
    .mobile-toggle,
    .scroll-top {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
}

/* ============================================
   DARK MODE SUPPORT (préparation)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Préparation pour le mode sombre - à activer si nécessaire */
}

