/* ==============================================
   FICHIER CSS SUPPLÉMENTAIRE POUR AMÉLIORATIONS
   Espérance Sportive de Tunis - Ultra-Moderne
   ============================================== */

/* Lazy Loading pour images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Animation de chargement */
@keyframes shimmerLoading {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmerLoading 2s infinite;
}

/* Tooltips modernes */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: var(--text-dark);
    color: white;
    font-size: 0.85rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-dark);
    opacity: 0;
    transition: opacity 0.3s;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

[data-tooltip]:hover::before {
    transform: translateX(-50%) translateY(-12px);
}

/* Bouton "Retour en haut" */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--est-rouge), #ff4655);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 8px 20px rgba(237, 28, 36, 0.3);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(237, 28, 36, 0.4);
}

/* Améliorations pour la navigation mobile */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: linear-gradient(180deg, #ED1C24 0%, #c41017 100%);
        padding: 2rem 0;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
        box-shadow: 5px 0 30px rgba(0,0,0,0.3);
        overflow-y: auto;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        z-index: 9999;
    }
    
    .nav-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Animations avancées pour les cartes */
.card-hover-effect {
    position: relative;
    overflow: hidden;
}

.card-hover-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.card-hover-effect:hover::before {
    left: 100%;
}

/* Badge animé */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(237, 28, 36, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(237, 28, 36, 0);
    }
}

.badge-animated {
    animation: badgePulse 2s infinite;
}

/* Progress bar pour le chargement */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--est-rouge), var(--est-jaune), var(--est-rouge));
    background-size: 200% 100%;
    animation: loadingProgress 2s linear infinite;
    z-index: 10001;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.loading-bar.active {
    transform: scaleX(1);
}

@keyframes loadingProgress {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

/* Amélioration des formulaires */
.form-control-modern {
    position: relative;
}

.form-control-modern input,
.form-control-modern textarea,
.form-control-modern select {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
}

.form-control-modern i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-lighter);
    transition: color 0.3s;
}

.form-control-modern input:focus ~ i,
.form-control-modern textarea:focus ~ i,
.form-control-modern select:focus ~ i {
    color: var(--est-rouge);
}

/* Cards avec glass morphism */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Statistiques animées */
.stat-number {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--est-rouge), #ff4655);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

/* Timeline moderne */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--est-rouge), var(--est-jaune));
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
}

.timeline-item:nth-child(odd) {
    flex-direction: row-reverse;
}

.timeline-content {
    flex: 1;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    margin: 0 2rem;
}

.timeline-marker {
    width: 20px;
    height: 20px;
    background: var(--est-rouge);
    border: 4px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(237, 28, 36, 0.2);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

/* Accordéon moderne */
.accordion-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.accordion-header {
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.3s;
}

.accordion-header:hover {
    background: var(--est-rouge-leger);
    color: var(--est-rouge);
}

.accordion-icon {
    transition: transform 0.3s;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-light);
    line-height: 1.7;
}

/* Tabs modernes */
.tabs-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.tabs-nav {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 2rem;
}

.tab-button {
    padding: 1rem 2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--est-rouge);
}

.tab-button.active {
    color: var(--est-rouge);
    border-bottom-color: var(--est-rouge);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal moderne */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 2rem;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--est-rouge);
}

.modal-body {
    padding: 2rem;
}

/* Breadcrumb moderne */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.9rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.breadcrumb-item a {
    color: var(--est-rouge);
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-item a:hover {
    color: var(--est-rouge-fonce);
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    color: var(--text-lighter);
    margin-left: 0.5rem;
}

.breadcrumb-item:last-child {
    color: var(--text-dark);
    font-weight: 600;
}

/* Print styles */
@media print {
    .no-print,
    header,
    footer,
    .back-to-top,
    .nav-menu,
    .social-links {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Dark mode support (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f8f9fa;
        --text-light: #cbd5e1;
        --bg-light: #1a1a2e;
        --bg-card: #2d2d44;
        --border-light: #3d3d54;
    }
}

/* Amélioration des performances - Will-change */
.will-animate {
    will-change: transform, opacity;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Accessibilité - Focus visible amélioré */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--est-rouge);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Screen reader only */
.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;
}

/* Utility classes */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 30px rgba(237, 28, 36, 0.3);
}

.hover-lift {
    transition: transform 0.3s;
}

.hover-lift:hover {
    transform: translateY(-5px);
}
