/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1em;
}

/* Onglets */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1.1em;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

.back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

/* Filtres */
.filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.filters label {
    font-weight: 600;
    color: #333;
}

.filters select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    flex: 1;
    max-width: 300px;
}

.filters button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.filters button:hover {
    background: #5568d3;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2em;
}

/* Liste des matchs */
.matches-list {
    display: grid;
    gap: 15px;
}

.match-card {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s;
}

.match-card:hover {
    background: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.match-championship {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.match-date {
    color: #666;
    font-size: 0.9em;
}

.match-teams {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.match-odds {
    margin-top: 10px;
    padding: 8px 12px;
    background: #e7f3ff;
    border-radius: 6px;
    text-align: center;
    font-size: 0.95em;
    color: #0366d6;
}

/* Squads */
.squads-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.squad-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.squad-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.section-title {
    text-align: center;
    color: #667eea;
    margin: 20px 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.formation {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.substitutes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 6px;
    margin-bottom: 20px;
}

.substitute-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.substitute-item label {
    font-size: 0.85em;
    color: #856404;
    font-weight: 600;
}

.position-group h3 {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.position-slots {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.position-slot {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.player-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.player-select:focus {
    outline: none;
    border-color: #667eea;
}

.player-select option[data-note] {
    font-weight: 600;
}

/* Prédiction */
.prediction-section {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
}

.predict-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.predict-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.prediction-result {
    margin-top: 30px;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.prediction-title {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
}

.prediction-value {
    font-size: 3em;
    font-weight: 700;
    color: #667eea;
    margin: 20px 0;
}

.probabilities {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
}

.probability-item {
    text-align: center;
}

.probability-label {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.probability-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #667eea;
}

.team-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.feature-box {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.feature-box h4 {
    color: #333;
    margin-bottom: 10px;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.95em;
}

.feature-label {
    color: #666;
}

.feature-value {
    font-weight: 600;
    color: #667eea;
}

/* Contrôles d'archivage */
.archive-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff3cd;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px solid #ffc107;
}

#selection-count {
    font-weight: 600;
    color: #856404;
    font-size: 1.05em;
}

.archive-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.archive-btn:hover {
    background: #218838;
}

/* Checkbox de sélection */
.match-checkbox {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
}

.match-card {
    position: relative;
}

.match-card.selected {
    background: #e7f3ff;
    border-color: #0366d6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s, color 0.3s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary, .btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover {
    background: #dee2e6;
}

/* Formulaire de saisie des scores */
.score-entry-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.score-entry-match {
    font-weight: 600;
    color: #333;
}

.score-entry-match small {
    display: block;
    color: #666;
    font-weight: 400;
    margin-top: 5px;
    font-size: 0.85em;
}

.score-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    grid-column: 2 / 4;
}

.score-input {
    width: 70px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    text-align: center;
    font-weight: 600;
}

.score-input:focus {
    outline: none;
    border-color: #667eea;
}

.score-input.invalid {
    border-color: #f44336;
    background: #ffebee;
}

/* Responsive */
@media (max-width: 1024px) {
    .squads-container {
        grid-template-columns: 1fr;
    }

    .team-features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .filters {
        flex-direction: column;
    }

    .filters select {
        max-width: 100%;
    }

    .position-slot {
        min-width: 120px;
    }

    .score-entry-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .score-inputs {
        grid-column: 1;
    }

    .modal-content {
        width: 95%;
    }
}
