/**
 * Secret Story Game - Styles personnalisés
 * 
 * @version 1.0
 * Complément à Tailwind CSS
 */

/* ==========================================
   Variables CSS
   ========================================== */
:root {
    /* Couleurs personnalisées */
    --color-primary: #F04F3D;
    --color-secondary: #47A12E;
    --color-accent: #FFD700;
    --color-bg-gradient-start: #667eea;
    --color-bg-gradient-end: #764ba2;
    
    /* Espacements */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Reset et Base
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   Animations personnalisées
   ========================================== */

/* Pulse pour le jour actuel */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
        transform: scale(1.02);
    }
}

.pulse-current {
    animation: pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Shake pour les erreurs */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s;
}

/* Bounce pour les éléments importants */
@keyframes bounce-soft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.bounce-soft {
    animation: bounce-soft 2s ease-in-out infinite;
}

/* Fade in pour les modales */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Slide up pour les notifications */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* ==========================================
   Composants - Cases du Calendrier
   ========================================== */
.calendar-day {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.calendar-day::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.calendar-day:hover::before {
    opacity: 1;
}

.calendar-day:not(.locked):hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: var(--shadow-xl);
    z-index: 10;
}

.calendar-day.locked {
    cursor: not-allowed;
    opacity: 0.6;
}

/* État actuel avec animation */
.calendar-day.current {
    position: relative;
}

.calendar-day.current::after {
    content: '⭐';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 2rem;
    animation: bounce-soft 2s ease-in-out infinite;
}

/* ==========================================
   Composants - Modal
   ========================================== */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

/* Personnalisation de la scrollbar dans les modales */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================================
   Composants - Boutons personnalisés
   ========================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #c23b2d 100%);
    color: white;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #357a22 100%);
    color: white;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   Composants - Cartes
   ========================================== */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #1f2937;
}

/* ==========================================
   Composants - Badges de rang
   ========================================== */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.rank-badge:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.rank-badge.gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
}

/* ==========================================
   Composants - Options de réponse
   ========================================== */
.answer-option {
    display: block;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.answer-option:hover {
    border-color: #8b5cf6;
    background-color: #f5f3ff;
    transform: translateX(5px);
}

.answer-option input[type="radio"] {
    margin-right: 0.75rem;
}

.answer-option.correct {
    border-color: var(--color-secondary);
    background-color: #f0fdf4;
}

.answer-option.incorrect {
    border-color: var(--color-primary);
    background-color: #fef2f2;
}

.answer-option.correct::after {
    content: '✅';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.answer-option.incorrect::after {
    content: '❌';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

/* ==========================================
   Composants - Notifications
   ========================================== */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    animation: slideUp 0.4s ease-out;
    max-width: 400px;
}

.notification.success {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #357a22 100%);
    color: white;
}

.notification.error {
    background: linear-gradient(135deg, var(--color-primary) 0%, #c23b2d 100%);
    color: white;
}

.notification.info {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
}

/* ==========================================
   Composants - Loader / Spinner
   ========================================== */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

/* ==========================================
   Composants - Podium
   ========================================== */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.podium-place {
    flex: 1;
    max-width: 200px;
    text-align: center;
    border-radius: 1rem 1rem 0 0;
    padding: 2rem 1rem;
    color: white;
    position: relative;
    transition: all var(--transition-normal);
}

.podium-place:hover {
    transform: translateY(-10px);
}

.podium-place.first {
    height: 300px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    order: 2;
}

.podium-place.second {
    height: 250px;
    background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
    order: 1;
}

.podium-place.third {
    height: 200px;
    background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
    order: 3;
}

/* ==========================================
   Utilitaires - Texte
   ========================================== */
.text-gradient {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Utilitaires - Responsive
   ========================================== */
@media (max-width: 768px) {
    .calendar-day {
        font-size: 0.875rem;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: 85vh;
    }
    
    .notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* ==========================================
   Utilitaires - Impression
   ========================================== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .calendar-day {
        break-inside: avoid;
    }
}

/* ==========================================
   Utilitaires - 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-width: 0;
}

/* Focus visible pour l'accessibilité au clavier */
*:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* ==========================================
   Animations de flocons de neige
   ========================================== */
.snowflake {
    position: fixed;
    top: -10px;
    z-index: 9999;
    user-select: none;
    cursor: default;
    animation: fall linear infinite;
    color: white;
    font-size: 1.5em;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

@keyframes fall {
    to {
        transform: translateY(calc(100vh + 10px)) rotate(360deg);
    }
}

/* ==========================================
   Animations de chargement personnalisées
   ========================================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(
        to right,
        #f0f0f0 4%,
        #e0e0e0 25%,
        #f0f0f0 36%
    );
    background-size: 1000px 100%;
}

/* ==========================================
   Styles pour les tableaux
   ========================================== */
.table-hover tbody tr:hover {
    background-color: #f9fafb;
    transition: background-color var(--transition-fast);
}

/* ==========================================
   Styles pour les formulaires
   ========================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    transition: all var(--transition-normal);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   Styles pour les messages d'alerte
   ========================================== */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: var(--color-secondary);
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border-color: var(--color-primary);
    color: #991b1b;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

/* ==========================================
   Fin du fichier
   ========================================== */