/* ── Variables ─────────────────────────────────────────────── */
:root {
    --primary-color: #3a5a8a;
    --background-color: #f4f3f1;
    --card-color: #ffffff;
    --text-color: #222222;
    --text-muted: #777777;
    --border-radius: 12px;
    --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --header-height: 56px;
    --footer-height: 64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    background: var(--background-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────── */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #2e4a73 0%, #3a5a8a 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 1px 8px rgba(0,0,0,0.18);
}

.festival-logo {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.time-indicator {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.18);
    padding: 4px 10px;
    border-radius: 20px;
}

.main-content {
    flex: 1;
    padding: calc(var(--header-height) + 12px) 14px calc(var(--footer-height) + 14px);
    overflow-y: auto;
}

/* ── Nav tabs ──────────────────────────────────────────────── */
.nav-tabs {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--footer-height);
    background: var(--card-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -1px 6px rgba(0,0,0,0.08);
    border-top: 2px solid #edecea;
    z-index: 1000;
}

.nav-tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    flex: 1;
    height: 100%;
    color: #999;
    font-size: 0.72rem;
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.nav-tabs button.active { color: var(--primary-color); font-weight: 600; border-top: 2px solid var(--primary-color); margin-top: -2px; }
.nav-tabs .icon { font-size: 1.35rem; margin-bottom: 2px; }
.nav-heart-icon { display: block; margin-bottom: 2px; color: #999; }
.nav-tabs button.active .nav-heart-icon { color: var(--primary-color); }
.nav-heart-icon .heart-icon { width: 22px; height: 22px; }

/* ── Views ─────────────────────────────────────────────────── */
.view { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-color);
}

/* ── View toolbar ──────────────────────────────────────────── */
.view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.view-toolbar h2 { margin-bottom: 0; }


/* ── Time slot selector (Now view) ────────────────────────── */
.time-slot-selector {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.time-slot-selector::-webkit-scrollbar { display: none; }

.time-slot-selector button {
    flex: 0 0 auto;
    padding: 7px 16px;
    background: var(--card-color);
    border: 1.5px solid #ddd;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.time-slot-selector button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.time-slot-selector.dimmed button {
    opacity: 0.4;
}

/* ── Now view location filter ──────────────────────────────── */
.now-location-select {
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--text-muted);
    border: 1.5px solid #ddd;
    border-radius: 20px;
    background: var(--card-color);
    padding: 5px 24px 5px 10px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    max-width: 160px;
}
.now-location-select:focus { outline: none; border-color: var(--primary-color); }

/* ── Category pills ────────────────────────────────────────── */
.category-pills {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    margin-bottom: 14px;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.category-pill {
    flex: 0 0 auto;
    padding: 5px 13px;
    border-radius: 20px;
    border: 1.5px solid #ccc;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.category-pill.active {
    background: #3a5a8a;
    border-color: #3a5a8a;
    color: white;
}

/* ── Performance cards (Now view) ─────────────────────────── */
.performances-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.venue-card {
    background: var(--card-color);
    border-radius: var(--border-radius);
    padding: 13px 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border-left: 5px solid #ccc;
}

.venue-address {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.slot-dot {
    margin-left: 5px;
    font-size: 0.72rem;
    color: #aaa;
}
.slot-dot::before { content: '· '; }

.artist-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
    color: var(--text-color);
}

.card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.category-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.genre-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.distance {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ── Heart button ──────────────────────────────────────────── */
.heart-btn {
    float: right;
    background: none;
    border: none;
    cursor: pointer;
    color: #d8d8d8;
    padding: 0 0 4px 8px;
    transition: color 0.15s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
    line-height: 0;
}
.heart-btn:hover { color: #e0607a; }
.heart-btn.hearted { color: #e0607a; }
.heart-btn:active { transform: scale(1.25); }

.heart-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

/* ── Favorites badge ───────────────────────────────────────── */
.fav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: #e0607a;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Map view ──────────────────────────────────────────────── */
#festival-map {
    height: calc(100vh - var(--header-height) - var(--footer-height) - 80px);
    border-radius: var(--border-radius);
    z-index: 1;
    overflow: hidden;
}

/* ── Map legend ────────────────────────────────────────────── */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 8px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Map markers ───────────────────────────────────────────── */
.custom-marker { background: transparent; border: none; }
.marker-icon {
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: absolute;
    left: 50%; top: 50%;
    margin: -14px 0 0 -14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: opacity 0.2s;
}
.marker-icon::after {
    content: '';
    width: 12px; height: 12px;
    border-radius: 50%;
    background: white;
    position: absolute;
    left: 8px; top: 8px;
}

/* ── Map popups ────────────────────────────────────────────── */
.venue-popup { min-width: 190px; padding: 2px 0; }
.venue-popup h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}
.popup-slot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    padding: 4px 0;
    border-top: 1px solid #f0f0f0;
    font-size: 0.82rem;
}
.popup-slot--current {
    background: #fffbea;
    margin: 0 -4px;
    padding: 4px;
    border-radius: 4px;
}
.popup-slot-time {
    color: #aaa;
    font-size: 0.7rem;
    min-width: 30px;
}
.popup-artist { font-weight: 600; color: #222; }
.popup-genre { color: #888; font-size: 0.72rem; }
.popup-genre::before { content: ' · '; }

/* ── Locate button ─────────────────────────────────────────── */
.locate-button {
    position: absolute;
    bottom: calc(var(--footer-height) + 24px);
    right: 20px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 44px; height: 44px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 500;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.locate-button::after { content: '📍'; font-size: 1.2rem; }
.locate-button:hover { background: #f5f5f5; }

/* ── Schedule view ─────────────────────────────────────────── */
.schedule-search {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    background: var(--card-color);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.15s;
}
.schedule-search:focus { border-color: var(--primary-color); }
.schedule-search::placeholder { color: #bbb; }

.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.filter-row select {
    flex: 1;
    min-width: 130px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    background: var(--card-color);
    font-size: 0.85rem;
    color: var(--text-color);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.schedule-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--primary-color);
    background: #edf1f7;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 18px 0 10px;
}

.time-slot-group { margin-bottom: 6px; }

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    padding: 8px 2px;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.slot-header.no-toggle { cursor: default; }
.slot-toggle { font-size: 0.65rem; color: #bbb; }

.schedule-item {
    background: var(--card-color);
    border-radius: var(--border-radius);
    padding: 11px 13px;
    margin-bottom: 7px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border-left: 5px solid #ccc;
}
.schedule-item.current { box-shadow: 0 0 0 2px var(--primary-color), var(--shadow); }

/* ── Conflict indicator ────────────────────────────────────── */
.conflict-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #c0392b;
    background: #fde8e8;
    padding: 2px 8px;
    border-radius: 10px;
}
.conflict-item { background: #fffaf9; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
    padding: 20px 16px;
    text-align: center;
    color: #bbb;
    font-size: 0.9rem;
    font-style: italic;
}

.saved-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px;
    gap: 12px;
}
.saved-empty-heart { width: 52px; height: 52px; color: #e0e0e0; }
.saved-empty p { color: #aaa; text-align: center; font-size: 0.9rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (min-width: 600px) {
    .performances-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 900px) {
    .app-container { max-width: 860px; margin: 0 auto; }
    .performances-list { grid-template-columns: repeat(3, 1fr); }
}
