:root {
    --primary-color: #1176bc;
    --accent-color: #f1c40f;
    --bg-light: #f4f6f9;
    --text-dark: #333;
    --text-grey: #666;
    --border-color: #eee;
    --success-color: #25D366;
    --error-color: #e74c3c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* --- Layout Général --- */
.container.schedule {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}

h1 {
    font-size: 1.5rem;
    margin: 10px 0;
    text-align: center;
    line-height: 1.2;
    color: var(--text-dark);
}

/* --- Header & Contrôles --- */
.back-nav {
    text-align: left;
    margin-bottom: 10px;
}

.schedule-links-action {
    display: inline-block;
    padding: 8px 12px;
    background: #e9ecef;
    color: var(--text-dark);
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
}

.sticky-controls-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    padding: 10px 0;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border-bottom: 1px solid #ddd;
}

.search-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.search-input {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    height: 44px;
    box-sizing: border-box;
}

#btn-show-favs {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    border: 1px solid #ccc;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
}

#btn-show-favs.active-favs {
    background-color: var(--accent-color);
    color: #fff;
    border: none;
}

/* --- Barre d'outils --- */
.tools-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 0 5px;
}

.status-wrapper {
    font-size: 0.85em;
    color: #555;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.live-indicator {
    height: 10px; 
    width: 10px;
    background-color: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}
.live-indicator.connected { background-color: var(--success-color); box-shadow: 0 0 5px var(--success-color); }
.live-indicator.error { background-color: var(--error-color); }

.btn-share {
    background: none;
    border: none;
    color: var(--success-color);
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* --- Sélecteur de Vue --- */
.view-selector {
    display: flex;
    background: #eee;
    border-radius: 10px;
    padding: 4px;
}

.view-btn {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-grey);
    font-weight: 500;
    transition: all 0.2s;
}

.view-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: bold;
}

.view-section {
    display: none;
}
.view-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* --- Règles --- */
.rules-details {
    margin-bottom: 15px;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
}
.rules-summary {
    font-size: 0.9em;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    list-style: none;
}
.rules-summary::-webkit-details-marker { display: none; }
.rules-summary::before { content: "ℹ️ "; }

.rules-content {
    font-size: 0.85em;
    padding-top: 10px;
    color: #555;
    line-height: 1.4;
}

/* --- Tableaux (Poules) - DESIGN COLORÉ --- */
.poule-public-container {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

.poule-public-container h3 {
    margin: 0;
    padding: 12px 15px;
    font-size: 1.3rem;
    background: var(--primary-color);
    color: white;
    border-bottom: none;
    display: block;
}

.poule-content-wrapper {
    padding: 15px;
}

.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px; 
    padding: 0 15px;
}

.stats-table {
    width: 100%;
    min-width: 300px;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.stats-table th {
    padding: 10px 5px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    color: var(--text-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dce4ec;
}

.stats-table td {
    padding: 12px 5px;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
}

.stats-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.stats-table th.name-col, .stats-table td.name-col {
    text-align: left;
    width: auto;
    white-space: normal;
    min-width: 120px;
}

.stats-table tbody tr:first-child td:first-child b {
    color: var(--accent-color);
    font-size: 1.3em;
}

.stat-col { width: 35px; }

.poule-match-title {
    margin: 20px -15px 10px -15px;
    padding: 8px 15px;
    font-size: 1rem;
    color: var(--primary-color);
    background: #f0f4f8;
    font-weight: 700;
    border-left: 4px solid var(--primary-color);
}

.poule-match-table { width: 100%; border-collapse: collapse; }
.poule-match-table td {
    padding: 10px 5px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}
.poule-match-table tr:nth-child(even) { background-color: #fafafa; }

.poule-match-table .participant1 { text-align: right; width: 35%; color: var(--text-dark); }
.poule-match-table .participant2 { text-align: left; width: 35%; color: var(--text-dark); }
.poule-match-table .score { 
    width: 30%; 
    text-align: center; 
    font-weight: bold; 
    color: var(--primary-color);
    background: #e3f2fd;
    border-radius: 8px;
    padding: 4px 0;
}
.poule-match-table .winner { font-weight: bold; color: #000; }

/* --- Bracket (Tableau Final) --- */
/* Modification #1 : Texte plus gros et gras */
.swipe-hint {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.3rem; /* Agressif et visible */
    font-weight: 800;  /* Très gras */
    text-transform: uppercase;
    animation: blink 2s infinite;
}

@keyframes blink {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.bracket-container {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    padding-left: 5px;
    padding-right: 5px;
}
.bracket-container::after { content: ''; min-width: 20px; }

.bracket-round {
    min-width: 88vw;
    scroll-snap-align: center;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bracket-round-title {
    text-align: center;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    border-radius: 8px;
    margin-top: 0;
    font-size: 1rem;
    margin-bottom: 10px;
}

.bracket-match {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
    position: relative;
    background: #fff;
    transition: transform 0.1s;
}
.bracket-match:active { transform: scale(0.98); background-color: #fcfcfc; }

.bracket-participant {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-dark);
}
.bracket-participant.winner { font-weight: bold; color: #000; }
.bracket-participant.is-favorite span:first-child { color: var(--accent-color); font-weight: bold; }
.bracket-participant span:first-child { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 75%;
}
.bracket-participant .score { font-variant-numeric: tabular-nums; }

.match-live { border-left: 4px solid var(--error-color); }
.bracket-match.has-favorite { border: 2px solid var(--accent-color); background-color: #fffdf5; }
.table-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #333;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* --- Modale --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal-box {
    width: 90%;
    max-width: 400px;
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }

.modal-header-styled {
    text-align: center;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-players-styled {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
}
.player-highlight { font-weight: bold; color: var(--primary-color); }
.player-normal { font-weight: 500; color: var(--text-dark); }
.player-vs { font-size: 0.8em; color: #ccc; }

.modal-score-big {
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 10px 0 20px 0;
    font-family: monospace;
}

.modal-sets-label {
    text-align: center;
    font-size: 0.9em;
    color: var(--text-grey);
    margin-bottom: 5px;
}

.modal-sets-wrapper {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.set-chip {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #444;
    font-weight: 500;
}
.empty-msg { color: #999; font-style: italic; font-size: 0.9em; }

.modal-close {
    width: 100%;
    padding: 12px;
    background: #f1f3f5;
    color: #333;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    cursor: pointer;
}
.modal-close:active { background: #e2e6ea; }

/* --- Liste Tableaux --- */
.tableau-list-clean {
    padding: 0;
    list-style: none;
    margin: 0;
}

.tableau-card {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.tableau-card:active { background: #f9f9f9; }

.tableau-card-link {
    text-decoration: none;
    color: var(--text-dark);
    display: block;
    font-weight: bold;
    font-size: 1.05em;
}

.tableau-card-sub {
    font-size: 0.85em;
    color: var(--text-grey);
    font-weight: normal;
    margin-top: 4px;
}
.empty-list-message { text-align: center; color: #999; margin-top: 20px; }

/* --- Divers --- */
.fav-btn {
    color: #ccc;
    font-size: 1.2em;
    margin-right: 5px;
    cursor: pointer;
    line-height: 1;
}
.fav-btn.active { color: var(--accent-color); }
.favorite-row { background-color: #fffdf5 !important; }
.favorite-row .name-col { font-weight: bold; color: var(--primary-color); }

#backToTop {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 900;
}