:root {
    --bg: #0f0f13;
    --bg-elevated: #16162a;
    --card-bg: #1a1a24;
    --card-hover: #22223a;
    --accent: #e94560;
    --accent-dim: #c73650;
    --accent-green: #2ecc71;
    --accent-blue: #3498db;
    --accent-purple: #9b59b6;
    --accent-orange: #e67e22;
    --text: #eaeaea;
    --text-muted: #8888a0;
    --border: #2a2a3a;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header h1 span {
    color: var(--accent);
}

header .date {
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-size: 1.05rem;
}

/* Page navigation */
.page-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
.page-nav-btn {
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.45rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.page-nav-btn:hover {
    background: var(--card-hover);
    color: var(--text);
}
.page-nav-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Date picker */
.date-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.date-nav {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.date-nav:hover {
    background: var(--card-hover);
}

#date-input {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}
#date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.date-today-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    margin-left: 0.3rem;
}
.date-today-btn:hover {
    background: var(--accent-dim);
}

header .subtitle {
    color: var(--text-muted);
    margin-top: 0.2rem;
    font-size: 0.9rem;
}

/* Container */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

/* Sections */
.section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Source status bar */
.source-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.source-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
}

/* Event count */
.event-count {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

/* Genre filters */
.genre-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.genre-btn {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.genre-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.genre-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.genre-btn .count {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.2rem;
}

/* Genre badge on cards */
.card-body .genre-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.4rem;
}

.genre-badge.jazz { background: #1a3a2a; color: #2ecc71; }
.genre-badge.blues { background: #1a2a3a; color: #3498db; }
.genre-badge.classical { background: #2a1a3a; color: #9b59b6; }
.genre-badge.pop { background: #3a2a1a; color: #e67e22; }
.genre-badge.rock { background: #3a1a1a; color: #e94560; }
.genre-badge.rnb { background: #2a1a2a; color: #e074c0; }
.genre-badge.funk { background: #2a2a1a; color: #c8e040; }
.genre-badge.hiphop { background: #2a1a1a; color: #e0a030; }
.genre-badge.flamenco { background: #3a1a1a; color: #ff6b6b; }
.genre-badge.candlelight { background: #3a2a1a; color: #f0c040; }
.genre-badge.other { background: #2a2a2a; color: #8888a0; }

/* Event grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.4rem;
}

/* Event card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.card:hover {
    border-color: #3a3a5a;
}

/* Enlarged preview overlay */
.card-preview {
    display: none;
    position: fixed;
    z-index: 1000;
    width: 580px;
    max-height: 90vh;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid #3a3a5a;
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: previewIn 0.2s ease-out;
}

.card-preview.visible {
    display: flex;
    flex-direction: column;
}

.card-preview .card-img {
    height: 300px;
}

.card-preview .card-body {
    padding: 1.4rem 1.6rem 1.6rem;
}

.card-preview .band-name {
    font-size: 1.5rem;
}

.card-preview .time-badge {
    font-size: 1rem;
    padding: 0.3rem 0.8rem;
}

.card-preview .detail {
    font-size: 1.05rem;
}

.card-preview .source-tag {
    font-size: 0.8rem;
}

.card-preview .genre-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.55rem;
}

.card-preview .action-link {
    font-size: 1rem;
}

@keyframes previewIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 700px) {
    .card-preview { display: none !important; }
}

.card-img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #252535;
}

.card-body {
    padding: 1rem 1.2rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body .band-name {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.card-body .detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.card-body .detail .icon {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.card-body .address-link {
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
}
.card-body .address-link:hover {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.card-body .time-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
    width: fit-content;
}

.card-body .source-tag {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body .card-actions {
    margin-top: auto;
    padding-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-body .action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.15s;
}

.card-body .action-link.ticket-link {
    color: var(--accent);
}

.card-body .action-link.ticket-link:hover {
    color: #fff;
}

.card-body .action-link.spotify-link {
    color: #1db954;
}

.card-body .action-link.spotify-link:hover {
    color: #1ed760;
}

.card-body .spotify-icon {
    flex-shrink: 0;
}

.card-body .action-link.wiki-link {
    color: #636466;
}

.card-body .action-link.wiki-link:hover {
    color: #fff;
}

.card-body .wiki-icon {
    flex-shrink: 0;
}

/* Festival banner */
.festival-active {
    background: linear-gradient(135deg, #2a1a3a 0%, #1a2a3a 100%);
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
}

.festival-active h3 {
    color: var(--accent-purple);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.festival-active p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.festival-active a {
    color: var(--accent-purple);
    text-decoration: none;
}

/* Festival grid */
.festival-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.festival-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.2rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.festival-card:hover {
    border-color: var(--accent-purple);
}

.festival-card .fest-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.festival-card .fest-name a {
    color: var(--text);
    text-decoration: none;
}

.festival-card .fest-name a:hover {
    color: var(--accent);
}

.festival-card .fest-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.festival-card .genre-tag {
    display: inline-block;
    background: var(--bg);
    color: var(--accent-purple);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 0.4rem;
}

/* Venue directory grid */
.venue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.venue-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.venue-card:hover {
    border-color: var(--accent-blue);
    background: var(--card-hover);
}

.venue-card .venue-icon {
    font-size: 1.6rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.venue-card .venue-info {
    flex: 1;
}

.venue-card .venue-info .v-name a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.venue-card .venue-info .v-name a:hover {
    color: var(--accent);
}

.venue-card .venue-info .v-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* Loading / empty states */
.state-msg {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.state-msg h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Setup banner */
.setup-banner {
    background: #2a2240;
    border: 1px solid #3d3560;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.setup-banner h3 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.setup-banner code {
    background: #16162a;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.setup-banner ol {
    padding-left: 1.2rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* Skeleton loading cards */
.skeleton-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.skeleton-img {
    width: 100%;
    height: 190px;
    background: #252535;
    position: relative;
    overflow: hidden;
}

.skeleton-body {
    padding: 1rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: #252535;
    position: relative;
    overflow: hidden;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.long { width: 85%; }
.skeleton-line.tag { width: 60px; height: 24px; border-radius: 6px; }
.skeleton-line.title { height: 20px; width: 75%; }

.skeleton-img::after,
.skeleton-line::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to { left: 100%; }
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    .festival-grid, .venue-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 1rem;
    }
}

/* Mobile: tighten vertical spacing */
@media (max-width: 768px) {
    header {
        padding: 0.8rem 1rem 0.6rem;
    }
    header h1 {
        font-size: 1.4rem;
    }
    header .subtitle {
        font-size: 0.75rem;
        margin-top: 0.1rem;
    }
    .date-picker {
        margin-top: 0.3rem;
    }
    .container {
        padding: 0.6rem 0.8rem 60px;
    }
    .section {
        margin-bottom: 0.8rem;
    }
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
    }
    .event-count {
        margin-bottom: 0.5rem;
        font-size: 0.8rem;
    }
    .genre-filters {
        margin-bottom: 0.5rem;
        gap: 0.3rem;
    }
    .genre-btn {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }
    .source-bar {
        margin-bottom: 0.5rem;
    }
    .card-body {
        padding: 0.7rem 0.9rem 0.9rem;
    }
    .card-body .band-name {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    .card-body .detail {
        font-size: 0.8rem;
        margin-bottom: 0.2rem;
    }
}

/* Mobile bottom nav */
@media (max-width: 768px) {
    .page-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--bg);
        border-top: 1px solid var(--border);
        margin: 0;
        padding: 0.6rem 0;
    }
    main.container {
        padding-bottom: 60px;
    }
}

/* Mobile card image taller */
@media (max-width: 768px) {
    .card-img {
        height: auto;
        aspect-ratio: 6 / 4;
    }
}

/* Mobile swipe mode */
@media (max-width: 768px) {
    .grid.swipe-mode {
        display: flex;
        overflow: hidden;
        position: relative;
        touch-action: pan-y;
    }
    .grid.swipe-mode .card {
        min-width: 100%;
        max-width: 100%;
        flex-shrink: 0;
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
    }
    .grid.swipe-mode .card.swipe-hidden {
        display: none;
    }
    .grid.swipe-mode .card.swipe-active {
        display: flex;
    }
    .swipe-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1.2rem;
        padding: 0.6rem 0 0.2rem;
    }
    .swipe-nav button {
        background: var(--card-bg);
        border: 1px solid var(--border);
        color: var(--text);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .swipe-nav button:active {
        background: var(--accent);
    }
    .swipe-nav button:disabled {
        opacity: 0.3;
    }
    .swipe-counter {
        color: var(--text-muted);
        font-size: 0.85rem;
        min-width: 60px;
        text-align: center;
    }
    .swipe-share-btn {
        background: none;
        border: 1px solid rgba(66,165,245,0.5);
        color: #42a5f5;
        padding: 0.3rem 0.8rem;
        border-radius: 6px;
        font-size: 0.8rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }
}
@media (min-width: 769px) {
    .swipe-nav { display: none !important; }
}
