:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --text: #202124;
    --muted: #6b7280;
    --border: #dedede;
    --accent: #7c3aed;
    --accent-soft: #ede9fe;
    --other-event: #d1d5db;
    --general: #2563eb;
    --danger: #dc2626;
}

body.dark {
    --bg: #101010;
    --panel: #181818;
    --text: #eeeeee;
    --muted: #9ca3af;
    --border: #333333;
    --accent: #a78bfa;
    --accent-soft: #29213d;
    --other-event: #444444;
    --general: #60a5fa;
}


/* GLOBAL */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

button {
    font: inherit;
    cursor: pointer;
}


/* BARRE HAUTE */

.topbar {
    min-height: 82px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 28px;

    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.topbar h1 {
    margin: 0;
    font-size: 1.4rem;
}

.subtitle {
    margin: 3px 0 0;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

#todayButton {
    padding: 9px 16px;

    border-radius: 20px;
    border: 1px solid var(--border);

    background: var(--panel);
    color: var(--text);
}


/* SWITCH CLAIR SOMBRE */

.theme-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-switch input {
    display: none;
}

.slider {
    width: 42px;
    height: 22px;

    border-radius: 20px;

    background: #aaa;

    position: relative;

    cursor: pointer;
}

.slider::after {
    content: "";

    width: 18px;
    height: 18px;

    position: absolute;
    top: 2px;
    left: 2px;

    border-radius: 50%;

    background: white;

    transition: 0.2s;
}

.theme-switch input:checked + .slider::after {
    transform: translateX(20px);
}


/* STRUCTURE */

.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;

    min-height: calc(100vh - 82px);
}


/* SIDEBAR */

.sidebar {
    padding: 24px;

    background: var(--panel);

    border-right: 1px solid var(--border);
}

.sidebar h2 {
    margin-top: 0;
}

.sidebar-help,
.general-info p,
#lastUpdate {
    color: var(--muted);
    font-size: 0.9rem;
}

.sidebar hr {
    border: 0;
    border-top: 1px solid var(--border);

    margin: 24px 0;
}

.piece-filter {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    margin: 12px 0;
}

.piece-filter input {
    margin-top: 4px;
}


/* CONTENU */

.main-content {
    padding: 24px;

    max-width: 1400px;
    width: 100%;

    margin: auto;
}

.panel {
    background: var(--panel);

    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 20px;

    margin-bottom: 22px;
}

.panel h2 {
    margin-top: 0;
}

.panel-header p {
    margin-top: -8px;
    color: var(--muted);
}


/* PROCHAINES REPRESENTATIONS */

.show-row {
    display: grid;

    grid-template-columns:
        90px
        110px
        minmax(200px, 1fr)
        minmax(160px, 260px);

    gap: 16px;

    align-items: center;

    padding: 13px 8px;

    border-top: 1px solid var(--border);

    cursor: pointer;
}

.show-row:hover {
    background: var(--accent-soft);
}

.show-date {
    font-weight: 700;
}

.show-time {
    color: var(--muted);
}

.show-title {
    font-weight: 650;
}

.show-place {
    color: var(--muted);
}

.show-muted {
    opacity: 0.42;
}


/* CALENDRIER */

.calendar-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 30px;

    margin-bottom: 18px;
}

.calendar-toolbar h2 {
    margin: 0;
    min-width: 230px;

    text-align: center;
}

.calendar-toolbar button {
    border: 0;

    background: transparent;
    color: var(--text);

    font-size: 2rem;
}

.weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.weekdays div {
    text-align: center;
    font-size: 0.85rem;

    color: var(--muted);

    padding-bottom: 8px;
}

.calendar-day {
    min-height: 92px;

    padding: 8px;

    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);

    cursor: pointer;
}

.calendar-day:nth-child(7n) {
    border-right: 1px solid var(--border);
}

.calendar-day:hover {
    background: var(--accent-soft);
}

.calendar-day.other-month {
    opacity: 0.32;
}

.day-number {
    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
}

.calendar-day.today .day-number {
    background: var(--general);
    color: white;
}

.calendar-day.selected {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.calendar-day.personal-event {
    background: var(--accent-soft);
}

.calendar-day.other-event:not(.personal-event) .day-number {
    color: var(--muted);
    background: var(--other-event);
}


/* PETITS POINTS DANS LE CALENDRIER */

.day-indicators {
    margin-top: 8px;

    display: flex;
    flex-wrap: wrap;

    gap: 4px;
}

.event-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--other-event);
}

.event-dot.personal {
    background: var(--accent);
}

.event-dot.general {
    background: var(--general);
}


/* SEMAINE */

.week-day-block {
    border-top: 1px solid var(--border);

    padding: 14px 4px;
}

.week-day-title {
    font-weight: 700;

    margin-bottom: 8px;
}

.week-event {
    display: grid;

    grid-template-columns: 70px 1fr;

    gap: 12px;

    margin: 7px 0;

    padding: 9px 12px;

    border-radius: 8px;

    background: var(--accent-soft);

    cursor: pointer;
}

.week-event.other {
    background: transparent;
    color: var(--muted);

    border: 1px solid var(--border);

    opacity: 0.6;
}

.week-event.general {
    border-left: 4px solid var(--general);
}


/* MODALE */

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0,0,0,0.65);
}

.modal-card {
    position: relative;

    width: min(650px, 92vw);
    max-height: 90vh;

    overflow-y: auto;

    background: var(--panel);
    color: var(--text);

    border-radius: 14px;

    padding: 28px;

    z-index: 1;
}

.modal-close {
    position: absolute;

    right: 16px;
    top: 10px;

    border: 0;
    background: transparent;

    color: var(--text);

    font-size: 2rem;
}

.event-type {
    color: var(--accent);

    font-weight: 700;

    text-transform: uppercase;

    font-size: 0.8rem;

    letter-spacing: 0.08em;
}

.event-location {
    margin-top: 20px;
}

.map-frame {
    width: 100%;
    height: 230px;

    border: 0;

    margin-top: 12px;

    border-radius: 10px;
}

.action-button {
    display: inline-block;

    margin-top: 14px;
    margin-right: 8px;

    padding: 10px 16px;

    border-radius: 8px;

    background: var(--accent);

    color: white;

    text-decoration: none;
}


/* MOBILE */

@media (max-width: 850px) {

    .app-layout {
        display: block;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    #pieceFilters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 18px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar h1 {
        font-size: 1.05rem;
    }

    .subtitle {
        display: none;
    }

    .main-content {
        padding: 12px;
    }

    .show-row {
        grid-template-columns: 70px 1fr;
    }

    .show-place {
        grid-column: 2;
    }

    .calendar-day {
        min-height: 62px;
        padding: 4px;
    }

    .day-number {
        width: 24px;
        height: 24px;

        font-size: 0.8rem;
    }

}