/* ============ IMPORT GOOGLE FONTS ============ */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@400;500;600;700&family=Teko:wght@400;500;600;700&display=swap');

/* ============ VARIABLES CSS - THÈME SPORT/STADE ============ */
:root {
    /* Couleurs principales - Gazon */
    --primary: #1b5e20;
    --primary-dark: #0d3312;
    --primary-light: #2e7d32;
    
    /* Couleurs équipes */
    --team-white: #ffffff;
    --team-red: #d32f2f;
    --team-red-dark: #b71c1c;
    
    /* Couleurs d'accentuation */
    --accent-yellow: #ffd600;
    --accent-green: #00e676;
    
    /* Couleurs neutres */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Fond et texte */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-field: linear-gradient(90deg, #1b5e20 0%, #2e7d32 50%, #1b5e20 100%);
    --text-primary: #212121;
    --text-secondary: #616161;
    --text-light: #ffffff;
    
    /* Espacements */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Bordures */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Ombres */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ RESET ET BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Oswald', 'Arial Narrow', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ TYPOGRAPHIE SPORTIVE ============ */
h1, h2, h3, .card-title, .nav-logo, .podium-username {
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

.stat-value, .podium-rank {
    font-family: 'Teko', sans-serif;
    font-weight: 700;
}

/* ============ NAVIGATION - STYLE STADE ============ */
.navbar {
    background: var(--bg-field);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 4px solid var(--accent-yellow);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.nav-logo {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--team-white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-links {
    display: flex;
    gap: var(--spacing-sm);
    list-style: none;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--team-white);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.875rem, 2vw, 1rem);
    transition: var(--transition);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--team-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--team-white);
    font-weight: 600;
    flex-wrap: wrap;
}

.elo-badge {
    background: var(--accent-yellow);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    font-family: 'Teko', sans-serif;
    box-shadow: var(--shadow-sm);
}

/* ============ CONTAINER RESPONSIVE ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    width: 100%;
}

.container-narrow {
    max-width: 600px;
}

/* ============ CARTES - STYLE TERRAIN ============ */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-top: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--team-red) 50%, var(--primary) 100%);
}

.card-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--gray-200);
}

.card-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 500;
}

/* ============ BOUTONS - STYLE SPORTIF ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary);
    color: var(--team-white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--team-red);
    color: var(--team-white);
}

.btn-secondary:hover {
    background: var(--team-red-dark);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: #e53935;
    color: var(--team-white);
}

.btn-danger:hover {
    background: #c62828;
}

.btn-outline {
    background: transparent;
    border: 3px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--team-white);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:active {
    transform: translateY(0);
}

/* ============ FORMULAIRES RESPONSIVE ============ */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--primary);
    font-size: clamp(0.875rem, 2vw, 1rem);
    text-transform: uppercase;
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 0.05em;
}

.form-input,
.form-select,
textarea.form-input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-family: 'Oswald', sans-serif;
    transition: var(--transition);
    background: var(--bg-primary);
}

.form-input:focus,
.form-select:focus,
textarea.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(27, 94, 32, 0.1);
}

.form-error {
    color: var(--team-red);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    margin-top: var(--spacing-xs);
    font-weight: 600;
}

.form-help {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    margin-top: var(--spacing-xs);
}

/* ============ TABLEAUX RESPONSIVE ============ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.table thead {
    background: var(--primary);
    color: var(--team-white);
}

.table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 700;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Bebas Neue', cursive;
}

.table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--gray-200);
    font-size: clamp(0.875rem, 2vw, 1rem);
}

.table tbody tr:hover {
    background: rgba(27, 94, 32, 0.05);
}

.table tbody tr:active {
    background: rgba(27, 94, 32, 0.1);
}

.table-rank {
    font-weight: 700;
    font-family: 'Teko', sans-serif;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.table-rank.gold { color: #ffd600; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.table-rank.silver { color: #c0c0c0; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }
.table-rank.bronze { color: #cd7f32; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }

/* ============ PODIUM - STYLE STADE OLYMPIQUE ============ */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: var(--spacing-md);
    margin: var(--spacing-2xl) 0;
    padding: var(--spacing-xl) var(--spacing-md);
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 140px;
    flex: 0 1 200px;
}

.podium-platform {
    width: 100%;
    background: var(--gray-300);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--spacing-md) var(--spacing-sm);
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.podium-platform::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(0,0,0,0.1) 100%);
}

.podium-platform:hover {
    transform: translateY(-8px) scale(1.05);
}

/* 2ème place - À GAUCHE (nth-child 1) */
.podium-place:nth-child(1) .podium-platform {
    background: linear-gradient(135deg, #e0e0e0 0%, #9e9e9e 100%);
    height: clamp(140px, 20vw, 170px);
    box-shadow: 0 8px 32px rgba(158, 158, 158, 0.4);
}

/* 1ère place - AU CENTRE (nth-child 2) - PLUS HAUTE ET OR */
.podium-place:nth-child(2) .podium-platform {
    background: linear-gradient(135deg, #ffd600 0%, #ffab00 100%);
    height: clamp(200px, 28vw, 240px);
    box-shadow: 0 8px 32px rgba(255, 214, 0, 0.5);
}

/* 3ème place - À DROITE (nth-child 3) */
.podium-place:nth-child(3) .podium-platform {
    background: linear-gradient(135deg, #d4a574 0%, #a0713f 100%);
    height: clamp(110px, 16vw, 130px);
    box-shadow: 0 8px 32px rgba(205, 127, 50, 0.4);
}

.podium-rank {
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 700;
    color: white;
    margin-bottom: var(--spacing-xs);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    line-height: 1;
}

.podium-username {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    font-weight: 700;
    color: white;
    margin-bottom: var(--spacing-xs);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    word-break: break-word;
    line-height: 1.2;
}

.podium-elo {
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    color: white;
    font-weight: 700;
    font-family: 'Teko', sans-serif;
    position: relative;
    z-index: 1;
    line-height: 1;
}

/* ============ STATS - STYLE TABLEAU DE SCORE ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition);
    border: 3px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-yellow);
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--team-red);
}

.stat-value {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-xs);
    line-height: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    font-family: 'Bebas Neue', cursive;
}

/* ============ BADGES - STYLE MÉDAILLES ============ */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Bebas Neue', cursive;
    letter-spacing: 0.05em;
}

.badge-success {
    background: var(--primary-light);
    color: white;
}

.badge-danger {
    background: var(--team-red);
    color: white;
}

.badge-warning {
    background: var(--accent-yellow);
    color: var(--text-primary);
}

.badge-info {
    background: #0288d1;
    color: white;
}

/* ============ ALERTES ============ */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 600;
    font-size: clamp(0.875rem, 2vw, 1rem);
}

.alert-success {
    background: #c8e6c9;
    color: #1b5e20;
    border-left: 6px solid var(--primary);
}

.alert-error {
    background: #ffcdd2;
    color: #b71c1c;
    border-left: 6px solid var(--team-red);
}

.alert-info {
    background: #b3e5fc;
    color: #01579b;
    border-left: 6px solid #0288d1;
}

/* ============ MODAL RESPONSIVE ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--team-red);
}

/* ============ GRILLE RESPONSIVE ============ */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ============ UTILITAIRES ============ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--spacing-sm); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ============ RESPONSIVE - MOBILE FIRST ============ */

/* Petits écrans (smartphones) */
@media (max-width: 576px) {
    :root {
        --spacing-lg: 1rem;
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    
    .nav-user {
        width: 100%;
        justify-content: center;
    }
    
    .container {
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-md);
    }
    
    .podium {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-place {
        max-width: 100%;
        width: 100%;
    }
    
    .podium-place:nth-child(1) .podium-platform,
    .podium-place:nth-child(2) .podium-platform,
    .podium-place:nth-child(3) .podium-platform {
        height: 160px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: var(--spacing-sm);
    }
}

/* Tablettes */
@media (min-width: 577px) and (max-width: 768px) {
    .nav-links {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop */
@media (min-width: 769px) {
    .nav-links {
        gap: var(--spacing-md);
    }
}

/* Très grands écrans */
@media (min-width: 1400px) {
    .container {
        padding: var(--spacing-2xl);
    }
}

/* ============ ANIMATIONS SPORTIVES ============ */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in-top {
    animation: slideInFromTop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in-bottom {
    animation: slideInFromBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ SCROLLBAR PERSONNALISÉE ============ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============ ACCESSIBILITÉ ============ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============ OPTIMISATIONS TACTILES ============ */
@media (hover: none) and (pointer: coarse) {
    /* Augmenter les zones tactiles sur mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-links a {
        min-height: 44px;
    }
    
    .table tbody tr:hover {
        background: transparent;
    }
}

/* ============ PRINT ============ */
@media print {
    .navbar,
    .btn,
    .nav-user {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
