/* Variables pour les thèmes */
:root[data-theme="light"] {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --grid-color: #ddd;
    --header-bg: #fff;
    --button-bg: #007bff;
    --button-text: white;
}

:root[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
    --grid-color: #404040;
    --header-bg: #2d2d2d;
    --button-bg: #0056b3;
    --button-text: white;
}

/* Styles généraux */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-color);
}

header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    background-color: var(--header-bg);
    position: relative;
}

.app-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3em;
    color: var(--text-color);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
    padding: 10px 0;
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    position: relative;
}

/* Switch thème */
.theme-switch-wrapper {
    position: absolute;
    right: 20px;
    top: 20px;
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

input:checked + .slider {
    background-color: #66bb6a;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.theme-icon {
    margin-left: 10px;
    font-size: 20px;
}

/* Panneau d'affichage des scores */
.scoreboard {
    text-align: center;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-grow: 1;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scoreboard h2 {
    font-size: 1.8em;
    color: var(--text-color);
    margin-bottom: 20px;
}

.scoreboard h3 {
    color: var(--text-color);
    font-size: 1.4em;
    margin: 30px 0;
}

.match-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    width: 100%;
    max-width: 400px;
}

.player-box {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--card-bg);
    width: 150px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.player-box h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.4em;
    margin-bottom: 5px;
}

.score-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.increment, .decrement {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
    border: none;
}

.increment {
    background-color: #4CAF50;
    color: white;
    order: 1;
}

.increment:hover {
    background-color: #3e8e41;
}

.decrement {
    background-color: #F44336;
    color: white;
    order: 3;
}

.decrement:hover {
    background-color: #c62828;
}

.score {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--text-color);
    text-align: center;
    margin: 5px 0;
    order: 2;
}

/* Sidebar - Historique des parties */
.sidebar {
    width: 250px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: fixed;
    top: 20%;
    right: 50px;
    max-height: 80%;
    overflow-y: auto;
    color: var(--text-color);
}

.end-week {
    width: 100%;
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 10px;
    margin-bottom: 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.end-week:hover {
    background-color: #0056b3;
}

.sidebar h2 {
    font-size: 1.4em;
    color: var(--text-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
    text-align: center;
    width: 100%;
}

#history {
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

#history li {
    background-color: var(--card-bg);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    font-size: 1em;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    text-align: center;
}

.year-separator {
    text-align: center;
    padding: 10px 0;
    margin: 10px 0;
    font-weight: bold;
    color: var(--text-color);
    border: none;
    background: none;
    font-size: 0.9em;
}

/* Section du score total */
.total-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

#total-scores {
    text-align: center;
    font-size: 1.2em;
    margin: 10px 0;
    padding: 10px;
    background-color: var(--card-bg);
    border-radius: 5px;
    color: var(--text-color);
}

.history-section {
    margin-top: 20px;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1em;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }

    .scoreboard, .sidebar {
        width: 90%;
        max-width: none;
    }

    .player-box {
        width: 100%;
        max-width: 300px;
    }

    .match-container {
        flex-direction: column;
    }

    .vs {
        margin: 10px 0;
    }

    .sidebar {
        position: static;
        margin-top: 20px;
    }
}

#score-graph {
    background-color: var(--card-bg);
}

/* Animations */
@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2) translate(var(--x), var(--y));
        opacity: 0;
    }
}

.explosion {
    position: absolute;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 0;
    height: 0;
}

.particle {
    width: 8px;
    height: 8px;
    background-color: #ffcc00;
    border-radius: 50%;
    position: absolute;
    animation: explode 0.6s ease-out forwards;
}

@keyframes shake {
    0% { transform: translateX(0); }
    10% { transform: translateX(-5px); }
    20% { transform: translateX(5px); }
    30% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
    60% { transform: translateX(5px); }
    70% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    90% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.5s ease;
}