/* ==========================================
   FIAMC - Styles JavaScript
   Animations et interactions dynamiques
   ========================================== */

/* Animations d'entrée */
@keyframes fadeInUp {
    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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Classes d'animation */
.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease-out forwards;
}

/* Bouton retour en haut */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #e30613, #d4af37);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* Styles pour les notifications temps réel */
#notification-toggle {
    transition: all 0.3s ease;
}

#notification-toggle:hover {
    transform: scale(1.1);
}

#realtime-notification-panel {
    font-family: 'Montserrat', sans-serif;
}

#notification-history {
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

#notification-history::-webkit-scrollbar {
    width: 6px;
}

#notification-history::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#notification-history::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

#notification-history::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Animation pour les nouvelles notifications */
@keyframes notificationPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.notification-pulse {
    animation: notificationPulse 0.5s ease-in-out;
}

/* Indicateur de statut de connexion temps réel */
.realtime-status {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1000;
    display: none;
}

.realtime-status.connected {
    background: #28a745;
    color: white;
}

.realtime-status.disconnected {
    background: #dc3545;
    color: white;
}

.realtime-status.connecting {
    background: #ffc107;
    color: #333;
}

/* Styles pour les formulaires */
.field-error {
    border-color: #e30613 !important;
    box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.1) !important;
}

.field-error-message {
    animation: fadeInUp 0.3s ease-out;
}

/* Styles pour les notifications */
.notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Styles pour le menu mobile */
.menu-toggle {
    display: none;
    background: #e30613;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 1000;
        padding-top: 60px;
    }

    .main-nav.mobile-open {
        left: 0;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .nav-links li {
        width: 100%;
        margin: 10px 0;
    }

    .nav-links a {
        display: block;
        padding: 15px;
        border-radius: 8px;
        transition: background 0.3s ease;
    }

    .nav-links a:hover {
        background: #f8f9fa;
    }
}

/* Styles pour les carrousels */
.carousel-controls button {
    transition: all 0.3s ease;
}

.carousel-controls button:hover {
    background: rgba(255,255,255,0.8) !important;
    transform: scale(1.1);
}

/* Styles pour les filtres */
.filter-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.filter-controls select,
.filter-controls input[type="text"] {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-controls select:focus,
.filter-controls input[type="text"]:focus {
    border-color: #e30613;
    outline: none;
}

@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Styles pour les cartes interactives */
.competition-card,
.stat-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.competition-card:hover,
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Styles pour les boutons */
.btn-js {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-js::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-js:hover::before {
    width: 300px;
    height: 300px;
}

/* Styles pour les modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e30613;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Styles pour les tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Styles pour les indicateurs de chargement */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Styles pour les messages de statut */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.online {
    background: #28a745;
}

.status-indicator.offline {
    background: #dc3545;
}

.status-indicator.warning {
    background: #ffc107;
}

/* Styles pour les accordéons */
.accordion {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid #ddd;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-header::after {
    content: '+';
    font-size: 18px;
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-header::after {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.accordion-content.show {
    max-height: 500px;
}

/* Styles pour les onglets */
.tab-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 500;
}

.tab-button.active {
    background: #e30613;
    color: white;
}

.tab-button:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Styles pour les barres de progression */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e30613, #d4af37);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Styles pour les compteurs animés */
.counter {
    font-size: 2em;
    font-weight: bold;
    color: #e30613;
}

.counter[data-target] {
    counter-reset: count 0;
    animation: countUp 2s ease-out forwards;
}

@keyframes countUp {
    to {
        counter-increment: count attr(data-target number);
    }
}

/* Styles responsives pour JavaScript */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        padding: 20px;
    }

    .filter-controls {
        flex-direction: column;
    }

    .tab-buttons {
        flex-direction: column;
    }

    .accordion-header {
        padding: 12px 15px;
    }
}

/* Styles d'impression */
@media print {
    .notification-container,
    .modal,
    .carousel-controls,
    .menu-toggle {
        display: none !important;
    }

    .competition-card,
    .stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}