:root {
    --bg-body: #121212;
    --bg-surface: #1e1e1e;
    --bg-elevated: #2c2c2c;
    --primary: #ff5722;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border: #333;
    --header-height: 125px; 
    --axis-left-width: 100px;
    --axis-top-height: 30px;
}

body.light-mode {
    --bg-body: #f0f0f0; --bg-surface: #ffffff; --bg-elevated: #e0e0e0;
    --primary: #d84315; --text-main: #222; --text-muted: #555; --border: #ccc;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Roboto, sans-serif; background: var(--bg-body); color: var(--text-main); height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

/* HEADER */
header { height: var(--header-height); background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; flex-direction: column; gap: 5px; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.3); position: relative; justify-content: space-between; }
.top-bar { display: flex; justify-content: space-between; align-items: center; }

h1 { margin: 0; font-size: 1.2rem; text-transform: uppercase; color: var(--primary); display: flex; align-items: center; }
h1 span.title-part { color: var(--text-main); font-weight: 300; opacity: 0.8; }

.status-pill { font-size: 0.65rem; background: #d32f2f; color: white; padding: 2px 6px; border-radius: 4px; margin-left: 10px; font-weight: bold; letter-spacing: 0.5px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.festival-range { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: -5px; margin-bottom: 5px; }
.festival-range b { color: var(--primary); font-weight: 600; }

.menu-btn { background: none; border: none; font-size: 1.8rem; color: var(--text-main); cursor: pointer; padding: 5px; margin-left: 15px; }

/* AUTH & AVATAR */
.header-controls { display: flex; align-items: center; }
.auth-links-text { display: flex; gap: 15px; margin-right: 10px; }
.nav-item { color: var(--text-main); text-decoration: none; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; transition: color 0.2s; }
.nav-item:hover { color: var(--primary); }

.user-menu-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; margin-right: 5px; padding: 5px; border-radius: 8px; transition: background 0.2s; }
.user-menu-wrap:hover { background: rgba(255,255,255,0.05); }

.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); margin-bottom: 2px; }
.user-avatar svg { width: 18px; height: 18px; }
.user-name-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; transition: color 0.2s; }

.user-menu-wrap:hover .user-avatar, .user-menu-wrap.active .user-avatar { border-color: var(--primary); color: var(--primary); }
.user-menu-wrap:hover .user-name-label, .user-menu-wrap.active .user-name-label { color: var(--text-main); }

.user-dropdown-content { position: absolute; top: 100%; right: 0; margin-top: 5px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; width: 160px; box-shadow: 0 5px 20px rgba(0,0,0,0.5); display: none; flex-direction: column; z-index: 3001; overflow: hidden; padding: 5px 0; }
.user-dropdown-content.active { display: flex; animation: fadeIn 0.15s ease-out; }

.dropdown-item { padding: 10px 15px; color: var(--text-main); text-decoration: none; font-size: 0.9rem; display: block; cursor: pointer; transition: background 0.2s; }
.dropdown-item:hover { background: var(--bg-elevated); color: var(--primary); }

/* MENU PRINCIPAL */
.main-menu { position: absolute; top: 50px; right: 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; width: 260px; box-shadow: 0 5px 20px rgba(0,0,0,0.5); display: none; flex-direction: column; z-index: 3000; overflow: hidden; padding-bottom: 5px; }
.main-menu.active { display: flex; animation: fadeIn 0.15s ease-out; }

.menu-item { padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; color: var(--text-main); }
.menu-item:hover { background: var(--bg-elevated); }
.menu-item select { background: var(--bg-elevated); color: var(--text-main); border: 1px solid var(--border); padding: 4px; border-radius: 4px; width: 140px; font-size: 0.8rem; }
.menu-section-title { padding: 10px 15px 5px 15px; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
.view-option { padding-left: 25px; }
.view-option.active-view { color: var(--primary); font-weight: bold; background: rgba(255, 87, 34, 0.1); }
.view-option.active-view::after { content: '✓'; font-weight: bold; }
.menu-separator { height: 1px; background: var(--border); margin: 5px 0; }

.day-tabs { display: flex; justify-content: center; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.day-tab { flex: none; min-width: 60px; text-align: center; font-weight: bold; font-size: 0.8rem; padding: 4px 16px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; border-radius: 20px; transition: all 0.2s; }
.day-tab:hover { background: var(--border); }
.day-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* VUES & GRILLE */
#main-view { flex: 1; overflow: auto; position: relative; background: var(--bg-body); display: flex; flex-direction: column; }
.timeline-wrapper { position: relative; margin: 0 auto; width: max-content; }
#list-view { display: none; width: 100%; padding: 10px; max-width: 800px; margin: 0 auto; }
body.view-list #timeline-wrapper { display: none; }
body.view-list #list-view { display: block; }

.f-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; }
.f-table th { text-align: left; padding: 12px 8px; color: var(--primary); border-bottom: 2px solid var(--border); position: sticky; top: 0; background: var(--bg-body); z-index: 10; }
.f-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.f-table tr:hover { background: var(--bg-elevated); cursor: pointer; }
.col-time { font-weight: bold; width: 80px; font-size: 0.85rem; }
.col-band { font-weight: bold; font-size: 1rem; }
.col-meta { font-size: 0.75rem; color: var(--text-muted); }
.col-vote, .col-heart { width: 100px; text-align: center; font-size: 0.8rem; }
.f-table th.col-vote, .f-table th.col-heart { text-align: center; font-size: 1.2rem; }
.list-star, .list-heart { font-size: 1.1rem; line-height: 1; vertical-align: middle; }
.list-star { color: #444; } .list-star.active { color: #ffca28; }
.list-heart { color: #d32f2f; white-space: nowrap; }

.axis-corner { position: sticky; top: 0; left: 0; width: var(--axis-left-width); height: var(--axis-top-height); background: var(--bg-surface); z-index: 70; border-bottom: 1px solid var(--primary); border-right: 2px solid var(--primary); }
.axis-top { position: sticky; top: 0; margin-left: var(--axis-left-width); margin-top: calc(var(--axis-top-height) * -1); height: var(--axis-top-height); background: var(--bg-surface); border-bottom: 1px solid var(--primary); z-index: 50; display: flex; width: max-content; }
.axis-left { position: sticky; left: 0; width: var(--axis-left-width); background: var(--bg-surface); border-right: 2px solid var(--primary); z-index: 60; }
.axis-label-h { flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--border); font-size: 0.8rem; font-weight: bold; }
.axis-label-v { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }
body.view-vert .axis-label-v { align-items: flex-start; padding-top: 5px; }
body.view-horiz .axis-label-h { justify-content: flex-start; padding-left: 5px; }

.grid-lines { position: absolute; top: var(--axis-top-height); left: var(--axis-left-width); pointer-events: none; }
.grid-line-v { position: absolute; top: 0; border-right: 1px solid rgba(255,255,255,0.05); }
.grid-line-h { position: absolute; left: 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.events-layer { position: absolute; top: var(--axis-top-height); left: var(--axis-left-width); }
.event-card { position: absolute; background: var(--bg-elevated); border: 1px solid rgba(255,255,255,0.1); border-left: 4px solid var(--primary); border-radius: 4px; padding: 4px; overflow: hidden; font-size: 0.75rem; cursor: pointer; display: flex; flex-direction: column; justify-content: center; }
.event-card:hover { filter: brightness(1.2); z-index: 10; }
.ev-band { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-style { font-size: 0.65rem; color: var(--text-muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-style-0 { border-left-color: #e91e63; } .ev-style-1 { border-left-color: #9c27b0; } .ev-style-2 { border-left-color: #3f51b5; } .ev-style-3 { border-left-color: #03a9f4; } .ev-style-4 { border-left-color: #009688; } .ev-style-5 { border-left-color: #8bc34a; } .ev-style-6 { border-left-color: #ffc107; }

/* INDICATEURS SUR LES CARTES (Seen & Target) */
/* Cible (📍) : En haut à droite */
.event-card.target::before { 
    content: "📍"; position: absolute; top: 2px; right: 2px; font-size: 0.75rem; line-height: 1; z-index: 5; 
}
/* Vu (✅) : En haut à droite aussi, mais décalé à gauche si 'target' est présent */
.event-card.seen::after { 
    content: "✅"; position: absolute; top: 3px; right: 2px; font-size: 0.7rem; line-height: 1; z-index: 5; 
}
/* Si la carte est À LA FOIS target et seen, on décale le check vers la gauche */
.event-card.target.seen::after {
    right: 18px; /* Décalage pour laisser la place à l'épingle */
}


/* POPUP & FILTRES */
.context-popup { position: fixed; width: 320px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 15px; z-index: 2000; box-shadow: 0 5px 20px rgba(0,0,0,0.5); display: none; opacity: 0; transform: scale(0.95); transition: opacity 0.1s, transform 0.1s; }
.context-popup.active { display: block; opacity: 1; transform: scale(1); }
.close-btn { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.close-btn:hover { color: var(--primary); }
.artist-header { display: flex; gap: 15px; margin-bottom: 10px; }
.artist-img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; background: #000; }
.vote-container { display: flex; flex-direction: column; gap: 5px; margin: 5px 0 15px 0; align-items: flex-start; }
.stars, .hearts { display: flex; gap: 5px; font-size: 2rem; cursor: pointer; line-height: 1; }
.star { color: #444; transition: color 0.2s; } .star.active { color: #ffca28; }
.heart { color: #444; filter: grayscale(1); transition: color 0.2s; } .heart.active { color: #d32f2f; filter: grayscale(0); }
.hearts { display: none; } .hearts.visible { display: flex; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.seen-toggle { font-size: 1.8rem; cursor: pointer; filter: grayscale(1); transition: 0.3s; }
.seen-toggle.active { filter: grayscale(0); transform: scale(1.1); }
.more-options-btn { width: 100%; text-align: left; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px 0; border-top: 1px solid var(--border); margin-top: 5px; font-size: 0.85rem; display: flex; justify-content: space-between; }
.more-options-btn:hover { color: var(--primary); }
.more-options-content { display: none; padding-bottom: 5px; }
.more-options-content.open { display: block; }
.spotify-link { display: block; width: 100%; text-align: center; background: #1DB954; color: #fff; text-decoration: none; padding: 8px; border-radius: 4px; font-weight: bold; font-size: 0.9rem; margin-bottom: 10px; }
.setlist-placeholder { background: rgba(255,255,255,0.05); border: 1px dashed var(--border); border-radius: 4px; padding: 10px; font-size: 0.8rem; color: var(--text-muted); text-align: center; }

#filter-panel { position: absolute; top: var(--header-height); left: 0; right: 0; background: var(--bg-surface); padding: 15px; z-index: 90; display: none; border-bottom: 2px solid var(--primary); max-height: calc(100vh - var(--header-height)); overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#filter-panel.open { display: block; }
.tag { display: inline-block; padding: 4px 10px; margin: 3px; border-radius: 12px; font-size: 0.75rem; background: var(--bg-elevated); border: 1px solid var(--border); cursor: pointer; }
.tag.selected { background: var(--primary); color: white; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.anon-warning { background: rgba(255, 152, 0, 0.15); border: 1px solid #ff9800; color: #ffb74d; padding: 10px 15px; text-align: center; font-size: 0.85rem; margin: 10px auto 0 auto; max-width: 95%; border-radius: 6px; display: flex; align-items: center; justify-content: center; gap: 10px; }
body.light-mode .anon-warning { background: #fff3e0; color: #e65100; border-color: #ffb74d; }

/* BOUTON TARGET (J'y serais) */
.target-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 10px; border-radius: 4px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    cursor: pointer; margin-bottom: 10px; 
    font-weight: bold; font-size: 0.9rem;
    color: var(--text-muted); transition: all 0.2s;
}
.target-btn:hover { border-color: var(--primary); color: var(--text-main); }
.target-btn.active {
    background: #2196f3; /* Bleu */
    color: white; border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}