/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure hidden elements never display due to conflicting rules */
[hidden] { display: none !important; }

:root {
    /* Quiet Light inspired palette (VS Code) */
    --primary-color: #F5F5F5;      /* Base background */
    --secondary-color: #F2F2F2;    /* Subtle surface */
    --accent-color: #705697;       /* Purple accent */
    --text-light: #333333;         /* Primary text */
    --text-muted: #6c6c6c;         /* Muted text */
    --border-color: #e0e0e0;       /* Neutral borders */
    --card-bg: #FFFFFF;            /* Card background */
    --hover-bg: #e0e0e0;           /* Hover background */
    --success-color: #448C27;      /* From token colors */
    --warning-color: #FFE055;      /* Validation warning border */
    --error-color: #f1897f;        /* Error foreground */
    --cyan: #93C6D6;               /* Info highlight */
    --pink: #BF9CAC;               /* Match highlight */
    --orange: #9C5D27;             /* Constants/numbers */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: light;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary-color);
    color: var(--text-light);
    line-height: 1.6;
    font-size: clamp(14px, 1.8vw, 16px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 100%;
    overflow-x: hidden;
}

html { max-width: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; }

/* Prevent iOS Safari auto-zoom on inputs (requires >=16px) */
@media (max-width: 768px) {
    .header-controls input,
    .header-controls select,
    .header-controls textarea {
        font-size: 16px;
    }
}

/* Strengthen iOS no-zoom for the specific search input */
@media (max-width: 768px) {
    body.minimal #filter-search { font-size: 16px !important; }
}

.header-inner .header-controls {
    position: relative;
}

/* Ensure the page header stays above the schedule and visible */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

/* Make header layout resilient in very narrow/zoomed viewports */
.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    max-width: 100%;
}

.header-inner h1 {
    margin: 0;
    flex: 0 1 auto;
    max-width: 100%;
}

.header-inner .header-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 320px;
    min-width: 0;
    max-width: 100%;
}

.header-inner .header-controls .row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-inner .header-controls select {
    flex: 1 1 140px;
    min-width: 0;
}

#filter-search {
    width: 100%;
    min-width: 0;
}

header, .header-inner { overflow-x: visible; }

@media (max-width: 400px) {
    .header-inner h1 { font-size: 1.25rem; }
    .header-inner .header-controls .row { gap: 0.4rem; }
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Enhanced Header Styles */
.header {
    background: linear-gradient(135deg,
        var(--primary-color) 0%,
        rgba(112,86,151,0.05) 60%,
        rgba(201,208,217,0.2) 100%
    );
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled {
    padding: 0.5rem 0;
    background: linear-gradient(135deg,
        var(--primary-color) 0%,
        rgba(112,86,151,0.06) 50%,
        rgba(201,208,217,0.15) 100%
    );
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Header Top Section */
.header-top {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2.5rem);
}

/* Enhanced Logo */
.logo {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.25rem);
}

.logo-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(2.5rem, 6vw, 3.5rem);
    height: clamp(2.5rem, 6vw, 3.5rem);
    background: linear-gradient(135deg, var(--accent-color), var(--pink));
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(189, 147, 249, 0.3);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(189, 147, 249, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 24px rgba(189, 147, 249, 0.5);
    }
}

.logo-icon i {
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: var(--text-light);
    z-index: 1;
}

.logo h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--text-light), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-menu-toggle:hover {
    border-color: var(--accent-color);
    background: rgba(189, 147, 249, 0.1);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--text-light);
    border-radius: 2px;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Buy Me a Coffee Enhanced */
.header-cta {
    display: flex;
    align-items: center;
}

.bmc-fallback {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #FFDD00, #FFC107);
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(255, 221, 0, 0.3);
    transition: all 0.3s ease;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

.bmc-fallback:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 221, 0, 0.4);
    filter: brightness(1.1);
}

.bmc-emoji { 
    line-height: 1; 
    font-size: 1.1em;
}
.bmc-label { 
    font-size: 0.9rem;
    font-weight: 700;
}

/* Header Main Section */
.header-main {
    padding: 1.5rem 0;
    background: linear-gradient(180deg, 
        rgba(189,147,249,0.05) 0%, 
        transparent 100%
    );
}

.brand-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tagline {
    color: var(--text-muted);
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
}

/* Live Stats */
.live-stats {
    display: flex;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    flex-wrap: wrap;
}

.stat-pill {
    background: linear-gradient(135deg, 
        rgba(189,147,249,0.15), 
        rgba(255,107,53,0.1)
    );
    border: 1px solid rgba(189,147,249,0.3);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-pill:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 16px rgba(189, 147, 249, 0.2);
}

.stat-value {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: var(--cyan);
}

.stat-label {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header Search Section */
.header-search-section {
    margin-top: 1.5rem;
}

.header-search {
    max-width: 500px;
    margin: 0;
}

.header-search input {
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: all 0.3s ease;
}

.header-search input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(189, 147, 249, 0.2);
}

.header-search i {
    left: 1.25rem;
    font-size: 1.1rem;
}

/* Header Filters Section */
.header-filters {
    padding: 1rem 0;
    background: linear-gradient(180deg, 
        rgba(68,71,90,0.3) 0%, 
        rgba(68,71,90,0.1) 100%
    );
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-actions {
    display: flex;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    flex-wrap: wrap;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.05), 
        rgba(255,255,255,0.02)
    );
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-light);
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, 
        rgba(189,147,249,0.2), 
        rgba(255,107,53,0.1)
    );
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(189, 147, 249, 0.2);
}

.quick-action-btn i {
    font-size: 1em;
    color: var(--accent-color);
}

/* Status Info */
.status-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 1rem;
}

.refresh-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: clamp(0.75rem, 2vw, 0.85rem);
}

#refreshStatusIcon {
    font-size: 0.9em;
    animation: slowSpin 3s linear infinite;
}

@keyframes slowSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav.open {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-header h3 {
    color: var(--text-light);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.mobile-nav-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-nav-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-content {
    flex: 1;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mobile-search {
    margin-bottom: 1rem;
}

.mobile-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-quick-action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, 
        rgba(189,147,249,0.1), 
        rgba(255,107,53,0.05)
    );
    border: 1px solid rgba(189,147,249,0.3);
    color: var(--text-light);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-quick-action-btn:hover {
    background: linear-gradient(135deg, 
        rgba(189,147,249,0.2), 
        rgba(255,107,53,0.1)
    );
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.mobile-quick-action-btn i {
    font-size: 1.25rem;
    color: var(--accent-color);
    width: 24px;
    text-align: center;
}

.mobile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.mobile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cyan);
}

.mobile-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-main {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .header-search-section {
        margin-top: 0;
        width: 100%;
    }
    
    .header-search {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-cta {
        display: none;
    }
    
    .header-main {
        padding: 1rem 0;
    }
    
    .brand-section {
        text-align: center;
        align-items: center;
    }
    
    .live-stats {
        justify-content: center;
    }
    
    .header-search-section {
        margin-top: 1rem;
    }
    
    .quick-actions {
        justify-content: center;
    }
    
    .status-info {
        justify-content: center;
        margin-top: 0.75rem;
    }
    
    .header-filters {
        padding: 0.75rem 0;
    }
}

@media (max-width: 640px) {
    .header-top {
        padding: 0.5rem 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .logo-icon i {
        font-size: 1.25rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .stat-pill {
        padding: 0.375rem 0.75rem;
        gap: 0.375rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .quick-action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        gap: 0.375rem;
    }
    
    .quick-action-btn i {
        font-size: 0.9em;
    }
    
    .mobile-nav-content {
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .mobile-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .header {
        position: sticky;
    }
    
    .header-top {
        padding: 0.375rem 0;
    }
    
    .header-content {
        padding: 0 0.75rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .live-stats {
        gap: 0.5rem;
    }
    
    .stat-pill {
        padding: 0.25rem 0.5rem;
    }
    
    .quick-actions {
        gap: 0.375rem;
    }
    
    .quick-action-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .refresh-status {
        font-size: 0.7rem;
    }
}

/* Filters */
.filters {
    background: linear-gradient(180deg, rgba(68,71,90,0.35), rgba(68,71,90,0));
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.filter-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem clamp(1rem, 3vw, 2rem) 0.5rem clamp(1rem, 3vw, 2rem);
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: space-between;
}

.filter-content {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 300ms ease, padding 300ms ease;
}

/* Quick filters chip row */
.quick-filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.quick-filters .chip {
    background: var(--card-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
}
.quick-filters .chip.active { border-color: var(--accent-color); background: rgba(189,147,249,0.15); }

.filter-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.filter-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem) 1rem clamp(1rem, 3vw, 2rem);
    display: grid;
    grid-template-columns: 1fr repeat(3, minmax(140px, 200px));
    gap: 0.5rem 0.75rem;
}

/* Filters toggle button */
/* Collapse toggle buttons */
.collapse-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-muted);
    padding: 0.375rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
}

.collapse-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-light);
    border-color: var(--accent-color);
}

.collapse-toggle svg {
    transition: transform 300ms ease;
}

.collapse-toggle[aria-expanded="false"] svg {
    transform: rotate(180deg);
}

/* Filters toggle button */
.filters-toggle {
    display: none;
    background: var(--card-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    align-items: center;
}

.filters-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 1rem 2rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 220ms ease, opacity 220ms ease;
}

.filters-panel .panel-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 220ms ease;
}

.filters-overlay.open { opacity: 1; }

@media (max-width: 640px) {
    .filters-toggle { display: inline-flex; }
    .filter-bar { grid-template-columns: 1fr; }
    .filter-bar .search-group,
    .filter-bar .filter-group,
    .filter-bar #refreshBtn { display: block; }
    .filters-panel { padding: 0 1rem 1rem 1rem; }
    .filters-panel .panel-row { grid-template-columns: 1fr; }
}

/* Animated open state */
.filters-panel.open {
    max-height: 80vh;
    opacity: 1;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .filters-panel { transition: none; }
    .filters-overlay { transition: none; }
}

/* Mobile slide-in variant */
@media (max-width: 640px) {
    .filters-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 60vh; /* Reduced from 70vh for more compact layout */
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        border: 1px solid var(--border-color);
        transform: translateY(100%);
        transition: transform 280ms ease, opacity 280ms ease;
        opacity: 1; /* we control with transform on mobile */
        background: var(--secondary-color);
        padding: 0.5rem 0.75rem 0.75rem 0.75rem; /* Reduced top padding */
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }
    .filters-panel.open { transform: translateY(0); }

    .filters-panel .panel-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem; /* Reduced gap */
    }

    .filters-panel .search-group,
    .filters-panel .filter-group {
        margin-bottom: 0.25rem; /* Reduced margin */
    }

    .filters-panel .search-group input,
    .filters-panel .filter-group select {
        padding: 0.625rem 0.75rem; /* Slightly smaller padding */
        font-size: 0.9rem;
    }

    .filters-panel .refresh-btn {
        width: 44px; /* Slightly smaller */
        height: 44px;
        align-self: center;
        justify-self: center;
    }
}

/* Compact filter bar on small screens */
@media (max-width: 640px) {
    .filters { padding: 0.75rem 0; } /* Reduced from 1.5rem */
    .filter-header { padding: 0.75rem 0.75rem 0.375rem 0.75rem; }
    .filter-content { max-height: none; } /* Allow natural height on mobile */
    .filter-bar {
        padding: 0 0.75rem 1rem 0.75rem; /* Reduced from 1rem */
        gap: 0.375rem; /* Reduced from 0.5rem */
    }
    .filters-toggle {
        padding: 0.375rem 0.625rem; /* Reduced padding */
        font-size: 0.85rem;
        min-height: 36px; /* Smaller touch target */
    }
    .filters-toggle svg {
        width: 16px; /* Smaller icon */
        height: 16px;
    }
    .collapse-toggle {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    .search-group { order: 2; width: 100%; }
    .filter-group { flex: 1 1 48%; }
    #refreshBtn { order: 3; }
    /* Minimize initial footprint on phones */
    .filter-bar .search-group,
    .filter-bar .filter-group,
    .filter-bar #refreshBtn { display: none; }
    .filters-toggle { display: inline-flex; }
}

.search-group {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-group input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-group input::placeholder {
    color: var(--text-muted);
}

/* Clear button inside search inputs */
.search-clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
    width: 1.75rem;
    height: 1.75rem;
}

/* Optional: fine-tune inside mobile nav */
.mobile-nav .search-clear-btn {
    right: 0.75rem;
}

@media (max-width: 480px) {
    .search-clear-btn {
        font-size: 1.2rem;
        right: 0.75rem;
        width: 2rem;
        height: 2rem;
    }
}

/* AutoComplete Dropdown Styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: -1px;
}

.autocomplete-category {
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-category:last-child {
    border-bottom: none;
}

.category-header {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--accent-color);
    color: white;
}

.autocomplete-item.selected {
    background: var(--accent-color);
}

.suggestion-text {
    font-weight: 500;
    font-size: 0.9rem;
}

.suggestion-text mark {
    background: rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

.autocomplete-item:hover .suggestion-text mark,
.autocomplete-item.selected .suggestion-text mark {
    background: rgba(255, 255, 255, 0.4);
}

.suggestion-meta {
    font-size: 0.75rem;
    opacity: 0.8;
    color: var(--text-muted);
}

.autocomplete-item:hover .suggestion-meta,
.autocomplete-item.selected .suggestion-meta {
    color: rgba(255, 255, 255, 0.9);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .autocomplete-dropdown {
        max-height: 250px;
    }
    
    .autocomplete-item {
        padding: 0.6rem 0.8rem;
    }
    
    .suggestion-text {
        font-size: 0.85rem;
    }
    
    .suggestion-meta {
        font-size: 0.7rem;
    }
}

/* Flash highlight when jumping to a show */
@keyframes flashHighlight {
    0% { background-color: rgba(112, 86, 151, 0.18); }
    60% { background-color: rgba(112, 86, 151, 0.10); }
    100% { background-color: transparent; }
}

li.show.flash-highlight {
    animation: flashHighlight 1.2s ease-out 1;
    outline: 2px solid rgba(112, 86, 151, 0.25);
    outline-offset: -2px;
    border-radius: var(--border-radius);
}

.filter-group select {
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
    min-width: 150px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.filter-group select option {
    background: var(--secondary-color);
    color: var(--text-light);
}

.refresh-btn {
    padding: 0.75rem;
    background: var(--pink);
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
}

.refresh-btn:hover {
    background: var(--cyan);
    transform: rotate(180deg);
}

.force-refresh-btn {
    background: var(--orange);
    color: var(--text-light);
    margin-left: 4px;
}

.force-refresh-btn:hover {
    background: var(--red);
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.refresh-btn i {
    font-size: 0.9rem;
}

/* Ensure refresh button icons are visible on all backgrounds */
.refresh-btn svg path {
    fill: currentColor;
}

/* Respect reduced motion for refresh button rotation */
@media (prefers-reduced-motion: reduce) {
    .refresh-btn:hover {
        transform: none;
    }
}

/* Stats Section */
.stats-section { margin-bottom: 1.25rem; }

.stats-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.stats-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}

.stats-content {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 300ms ease, margin-bottom 300ms ease;
}

.stats-content.collapsed {
    max-height: 0;
    margin-bottom: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

/* API stats styles removed since all shows are API-sourced */

.stat-item:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

.stat-number {
    font-size: clamp(1.25rem, 5vw, 2rem);
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Loading and Error States */
.loading, .error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
}

.error i {
    font-size: 2rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error p {
    color: var(--error-color);
    margin: 0;
}

/* Shows Grid */
.shows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-flow: row;
    gap: 1.25rem;
    overflow: visible;
    padding-bottom: 1rem;
}

/* Custom scrollbar for webkit browsers */
/* Remove horizontal scrollbars from card grid on WebKit */
.shows-grid::-webkit-scrollbar { height: 0; }

.shows-grid::-webkit-scrollbar-track { background: transparent; }

.shows-grid::-webkit-scrollbar-thumb { background: transparent; }

.shows-grid::-webkit-scrollbar-thumb:hover { background: transparent; }

.show-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
    width: 100%;
}

.show-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color);
    transition: var(--transition);
}

.show-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow);
}

.show-card:hover::before {
    width: 6px;
}

/* Enhanced API Data Styles - Data source indicators removed since all shows are API-sourced */

.show-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(189, 147, 249, 0.1);
    border: 1px solid rgba(189, 147, 249, 0.2);
    border-radius: 8px;
    font-weight: 600;
    color: var(--accent-color);
}

.show-price i {
    color: var(--accent-color);
}

.show-availability {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.show-availability.available {
    background: rgba(80, 250, 123, 0.1);
    border: 1px solid rgba(80, 250, 123, 0.2);
    color: var(--success-color);
}

.show-availability.limited {
    background: rgba(241, 250, 140, 0.1);
    border: 1px solid rgba(241, 250, 140, 0.2);
    color: var(--warning-color);
}

.show-availability.sold-out {
    background: rgba(255, 85, 85, 0.1);
    border: 1px solid rgba(255, 85, 85, 0.2);
    color: var(--error-color);
}

.show-availability.unavailable {
    background: rgba(98, 114, 164, 0.12); /* muted */
    border: 1px solid rgba(98, 114, 164, 0.25);
    color: var(--text-muted);
}

.show-availability i {
    font-size: 0.8rem;
}

.capacity {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 0.25rem;
}

.show-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #E6F3FF; /* subtle info background */
    border: 1px solid #CFE8FF;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--fg);
}

.show-note i {
    color: var(--accent);
    font-size: 0.8rem;
}

/* Enhanced show card variants */
.show-card.api-enhanced {
    border-color: var(--success-color);
    box-shadow: 0 4px 16px rgba(80, 250, 123, 0.1);
}

.show-card.api-enhanced::before {
    background: var(--success-color);
}

.show-card.web-data {
    border-color: var(--text-muted);
}

.reservation-btn.sold-out-btn {
    background: var(--error-color);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.7;
}

.reservation-btn.sold-out-btn:hover {
    transform: none;
    box-shadow: none;
}

.show-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.show-date {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.2;
}

.show-time {
    background: var(--accent-color);
    color: var(--text-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.show-location {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.show-location i {
    color: var(--accent-color);
    font-size: 0.8rem;
}

.comedians-list {
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
}

.comedian {
    background: #f0f0f7;
    color: var(--fg);
    padding: 0.45rem 0.85rem; /* add a touch more vertical padding */
    margin: 0.25rem 0.25rem 0.35rem 0; /* slightly more bottom clearance */
    border-radius: 9999px; /* true pill */
    display: inline-flex;
    align-items: center;
    line-height: 1.15; /* reduce baseline clipping on some engines */
    font-size: 0.85rem;
    font-weight: 600;
    border: none; /* avoid outer border being visually clipped */
    box-shadow: inset 0 0 0 1px #c9d0d9; /* draw border inside to prevent clipping */
    box-sizing: border-box;
    background-clip: padding-box;
    transition: var(--transition);
}

.comedian:hover {
    background: #e9e9f5;
    border-color: var(--accent);
    color: var(--fg);
}

/* Special Show Styling */
.special-show {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 179, 71, 0.3));
    color: var(--text-light);
    padding: 0.5rem 1rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
    border-radius: 16px;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.5);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(10px);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.special-show:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 179, 71, 0.4));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.7);
}

/* Comedian Tooltips */
.comedian-tooltip {
    position: fixed;
    background: var(--secondary-color);
    color: var(--text-light);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 300px;
    word-wrap: break-word;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(-5px);
    transition: all 0.2s ease;
    visibility: hidden;
}

.comedian-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(0);
    visibility: visible;
}

.comedian-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--secondary-color);
    margin-top: -1px;
}

/* Tooltip arrow for bottom positioning */
.comedian-tooltip[data-position="below"]::after {
    top: -5px;
    border-top-color: transparent;
    border-bottom-color: var(--secondary-color);
    margin-top: 0;
}

.reservation-btn {
    background: var(--success-color);
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.reservation-btn:hover {
    background: #22c55e;
    transform: translateY(-2px);
    color: var(--primary-color);
    text-decoration: none;
}

/* Action buttons side-by-side */
.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.reservation-btn.alt {
    background: var(--accent-color);
    color: #1a1b26;
}

.reservation-btn.alt:hover {
    background: #a78bfa;
}

@media (max-width: 480px) {
    .actions-row { grid-template-columns: 1fr; }
    .reservation-btn { min-height: 44px; font-size: 0.95rem; }
}

/* Special show title separate from chips */
.show-title {
    font-weight: 700;
    color: var(--text-light);
    margin: 0.5rem 0 0.25rem 0;
}

/* No Shows State */
.no-shows {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
}

.no-shows i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.no-shows h3 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.no-shows p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    border-top: 1px solid var(--accent-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.support-button {
    margin: 0.5rem auto;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    text-decoration: underline;
}

/* Date Sections */
.date-section {
    margin-bottom: 2rem;
}

.date-header {
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--pink);
}

/* Minimal list: date breaks between days */
.list .date-break {
    list-style: none;
    margin: 1.5rem 0 0.5rem;
}
.date-divider {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid var(--pink);
}
.date-divider .wd {
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.9rem;
}
.date-divider .md {
    color: var(--text-light);
    font-weight: 800;
    font-size: 1.15rem;
}

/* Improve readability on the minimal (light) page */
body.minimal .date-divider { 
    border-bottom-color: #ff79c6; /* ensure visible on white */
}
body.minimal .date-divider .wd { 
    color: #475569; /* slate-600 */
}
body.minimal .date-divider .md { 
    color: #0f172a; /* slate-900 */
}

/* Skeleton loading styles */
.skeleton-card {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    margin-bottom: 1rem;
    overflow: hidden;
}
.skeleton-time { width: 72px; height: 48px; border-radius: 12px; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); animation: shimmer 1.4s infinite; }
.skeleton-main { width: 100%; }
.skeleton-line { height: 14px; border-radius: 7px; margin: 8px 0; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); animation: shimmer 1.4s infinite; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-chip-row { display: flex; gap: 8px; margin-top: 6px; }
.skeleton-chip { width: 72px; height: 20px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); animation: shimmer 1.4s infinite; }
.skeleton-ctas { display: flex; gap: 8px; align-items: center; }
.skeleton-pill { width: 36px; height: 28px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); animation: shimmer 1.4s infinite; }
.skeleton-btn { width: 80px; height: 32px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); animation: shimmer 1.4s infinite; }

@keyframes shimmer {
    0% { background-position: -120px 0; }
    100% { background-position: 120px 0; }
}

/* Light mode skeletons */
body.minimal .skeleton-card { background: #f8fafc; border-color: #e5e7eb; }
body.minimal .skeleton-time,
body.minimal .skeleton-line,
body.minimal .skeleton-chip,
body.minimal .skeleton-pill,
body.minimal .skeleton-btn {
    background: linear-gradient(90deg, #e5e7eb, #f1f5f9, #e5e7eb);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .shows-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .filter-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .search-group {
        min-width: auto;
    }

    .search-group input { width: 100%; }

    .filter-group select { min-width: auto; width: 100%; }

    .stats-section { margin-bottom: 1.5rem; }
    .stats-header { padding: 0 1rem; margin-bottom: 0.75rem; }
    .stats-title { font-size: 1.1rem; }
    .stats-content { max-height: none; } /* Allow natural height on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .stat-item { padding: 1rem 0.75rem; }

    .shows-grid { grid-template-columns: 1fr; }
    
    .show-card {
        scroll-snap-align: start;
    }

    .show-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .show-card {
        padding: 1rem;
    }

    .comedians-list {
        margin-bottom: 1rem;
    }

    .refresh-btn {
        width: 48px;
        height: 48px;
    }
}

/* Ultra-narrow viewports fixes */
/* Responsive adjustments for header */
@media (min-width: 900px) {
  /* Side-by-side layout only on truly wide screens */
  .header-inner { display: flex; align-items: center; gap: 16px; }
  .minimal h1 { margin: 0; flex: 0 0 auto; text-align: left; }
  .header-controls { flex: 1 1 auto; max-width: 640px; }
}

@media (max-width: 480px) {
  .minimal h1 { font-size: clamp(20px, 5vw, 26px); }
  .header-inner { padding: 0 8px; }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.75rem;
        gap: 0.75rem;
    }
    .logo h1 { font-size: clamp(1rem, 4vw, 1.5rem); }
    .filters { padding: 0.5rem 0; }
    .filter-bar { padding: 0 0.5rem; gap: 0.25rem; }
    .filters-toggle {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
        min-height: 32px;
    }
    .filters-toggle svg {
        width: 14px;
        height: 14px;
    }
    .main-content { padding: 0.75rem; }
    .shows-grid { grid-template-columns: 1fr; }
    .show-card { padding: 0.75rem; border-radius: 10px; }
    .show-header { padding-right: 22px; }
    .show-time { font-size: 0.7rem; padding: 0.15rem 0.5rem; }
    .show-location { font-size: 0.85rem; }
    .reservation-btn { min-height: 44px; font-size: 0.9rem; }
    .date-header { font-size: 1rem; }
    input, select, button { font-size: 1rem; }

    /* Even more compact mobile panel for small phones */
    .filters-panel {
        max-height: 55vh;
        padding: 0.375rem 0.5rem 0.5rem 0.5rem;
    }
    .filters-panel .panel-row { gap: 0.375rem; }
    .filters-panel .search-group input,
    .filters-panel .filter-group select {
        padding: 0.5rem 0.625rem;
        font-size: 0.85rem;
    }
    .filters-panel .refresh-btn {
        width: 40px;
        height: 40px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .header-content { padding: 0 0.5rem; }
    .filters { padding: 0.375rem 0; }
    .filter-header { padding: 0.5rem 0.5rem 0.25rem 0.5rem; }
    .filter-bar { padding: 0 0.375rem; }
    .main-content { padding: 0.5rem; }
    .stats-section { margin-bottom: 1rem; }
    .stats-header { padding: 0 0.5rem; margin-bottom: 0.5rem; }
    .stats-title { font-size: 1rem; }
    .stats-grid { gap: 0.5rem; }
    .stat-item { padding: 0.75rem 0.5rem; }
    .show-card { padding: 0.625rem; }
    .comedian { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
    .reservation-btn { min-height: 40px; font-size: 0.85rem; }
}

/* Modal styles for mobile bio */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--card-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: min(90vw, 520px);
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body {
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        padding: 0 1rem;
    }

    .show-time {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .comedian { font-size: 0.85rem; padding: 0.4rem 0.7rem; }

    .comedian-tooltip {
        max-width: 250px;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .reservation-btn {
        min-height: 44px; /* a11y tap target */
        font-size: 0.95rem;
    }
}

/* Very large displays: wider columns for readability */
@media (min-width: 1400px) {
    .main-content { max-width: 1400px; }
    .shows-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.comedian:focus,
.show-card:focus,
.reservation-btn:focus,
input:focus,
select:focus,
button:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .show-card {
        border: 2px solid #000;
    }
    
    .comedian {
        border: 1px solid #000;
    }
    
    .reservation-btn {
        border: 2px solid #000;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #ff6b35;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* (Removed duplicate tooltip styles - using the primary definition above) */

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Success states */
.success-message {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Virtual scrolling container */
.virtual-scroll-container {
    height: 100%;
    overflow: auto;
}

/* Keep the filter bar visible as users scroll the long list */
.main-content { position: relative; }

.virtual-item {
    position: absolute;
    width: 100%;
}

/* PWA specific styles */
@media (display-mode: standalone) {
    .header {
        padding-top: env(safe-area-inset-top);
    }
    
    .footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* Important Message Icon */
.important-message-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #007bff;
    cursor: help;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.important-message-icon:hover {
    opacity: 1;
    color: #0056b3;
}

.important-message-icon i {
    font-size: 16px;
}

/* Show header positioning for icon */
.show-header {
    position: relative;
    padding-right: 30px; /* Make room for the icon */
}

/* Footer responsive */
@media (max-width: 768px) {
    .footer-row {
        flex-direction: column;
    }
    
    .footer-col {
        width: 100%;
        text-align: center;
    }
    
    .support-button {
        margin-top: 1rem;
    }
}
/* Accessible color system and typography */
:root {
  --bg: #F5F5F5;          /* editor.background */
  --fg: #0f172a;          /* default foreground (stronger for readability) */
  --muted: #6c6c6c;       /* list.activeSelectionForeground */
  --border: #e0e0e0;      /* list.hoverBackground as border */
  --accent: #705697;      /* statusBar/background */
}

/* Explicit theme overrides via JS-applied classes */
/* (reverted) explicit theme classes removed */

/* Minimal homepage overrides */
.minimal {
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height: 1.6;
}
.minimal a { color: var(--accent); text-decoration: none; }
.minimal a:hover { text-decoration: underline; }
.minimal header { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 8px 0; border-bottom: 1px solid var(--border); background: var(--bg); box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.header-inner { max-width: 960px; margin: 0 auto; padding: 0 10px; }
.minimal h1 { margin: 0 0 8px 0; font-size: clamp(24px, 3.8vw, 36px); letter-spacing: -0.2px; line-height: 1.1; text-align: center; }
.minimal main { padding-bottom: 88px; }
/* Controls always stack below title for simplicity */
.header-controls { display: grid; gap: 8px; grid-template-columns: 1fr; }
.header-controls .row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.header-controls input, .header-controls select { background: #ffffff; color: var(--fg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.header-controls input::placeholder { color: var(--muted); }
.header-controls input:focus-visible, .header-controls select:focus-visible,
.btn:focus-visible { outline: 3px solid color-mix(in oklab, var(--accent), white 30%); outline-offset: 2px; }

/* Retain legacy .controls styles if used elsewhere */
.controls { display: grid; gap: 10px; grid-template-columns: 1fr; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.controls .row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.controls input, .controls select { background: #ffffff; color: var(--fg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.controls input::placeholder { color: var(--muted); }
.controls input:focus-visible, .controls select:focus-visible,
.btn:focus-visible { outline: 3px solid color-mix(in oklab, var(--accent), white 30%); outline-offset: 2px; }
.error { color: #b42318; background: #ffefef; border: 1px solid #f3d2cf; padding: 10px 12px; margin: 12px 16px; border-radius: 10px; }
.list { list-style: none; padding: 0 16px 56px; margin: 0; }
.show { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: center; }
.show-time { color: #fff; font-variant-numeric: tabular-nums; background: var(--accent); border-radius: 999px; padding: 6px 10px; text-align: center; font-weight: 700; box-shadow: 0 1px 0 rgba(0,0,0,.06); display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; flex-shrink: 0; }
.show-time .t { font-weight: 800; }
.show-time .d { font-size: 12px; font-weight: 600; opacity: 0.95; margin-top: 2px; }
.show-venue { font-weight: 700; }
.show-series { color: var(--muted); font-style: italic; margin-top: 2px; }
.show-title { background: #EDEDF5; border: 1px solid #C9D0D9; color: var(--fg); padding: 8px 12px; border-radius: 10px; margin-top: 4px; font-weight: 700; }
.show-note { color: var(--fg); font-size: 13px; margin-top: 2px; }
/* Important notes use the same style as regular notes for consistency */
.show-note.important { background: #E6F3FF; border: 1px solid #CFE8FF; color: var(--fg); padding: 10px 12px; border-radius: 10px; }
.show-comedians { color: var(--muted); font-size: 14px; margin-top: 4px; margin-bottom: 8px; }
.badge { display: inline-block; margin-left: 8px; padding: 2px 6px; border-radius: 999px; font-size: 12px; background: #f0f0f7; color: var(--accent); border: 1px solid #c9d0d9; vertical-align: middle; }
.badge.mint { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge.almost { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.badge.holiday { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.price { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 28px; padding: 0 8px; border-radius: 8px; background: #F2F2F2; color: var(--fg); margin-right: 8px; border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; box-shadow: 0 1px 0 rgba(0,0,0,.1); font-size: 14px; line-height: 1; }
.btn:link, .btn:visited { color: #fff !important; }
.btn:hover { filter: brightness(0.92); }
.btn:focus-visible { outline: 3px solid rgba(31,111,235,.35); outline-offset: 2px; }
.btn-secondary { background: #475569; }
.btn-secondary:hover { filter: brightness(0.95); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.footer { padding: 16px; border-top: 1px solid var(--border); color: var(--muted); background: var(--bg); }

/* Minimal footer overrides for readability */
.minimal .footer { 
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    background: var(--bg);
    color: var(--fg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 -1px 0 rgba(0,0,0,.02);
}
.minimal .footer a { color: #0b62ff; text-decoration: none; font-weight: 600; }
.minimal .footer a:hover { text-decoration: underline; }
/* Do not underline the Buy Me a Coffee button on hover */
.minimal .footer a.bmc-btn:hover { text-decoration: none; }

/* (reverted) theme toggle styles removed */

/* Buy Me a Coffee button */
.bmc-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #FFDD00; color: #1f2937;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 10px; padding: 8px 12px; font-weight: 700;
}
.bmc-btn:hover { filter: brightness(0.95); text-decoration: none; }

/* Tooltip for comedian bios */
.tooltip { position: fixed; max-width: min(320px, 80vw); background: #111827; color: #f9fafb; border: 1px solid rgba(255,255,255,.1); padding: 8px 10px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100; }
.tooltip.hidden { display: none; }
.comedian { text-decoration: none; border-bottom: 0; cursor: help; }

/* Responsive: compact mobile layout */
@media (max-width: 640px) {
.minimal header { padding: calc(env(safe-area-inset-top, 0px) + 6px) 0 6px; position: fixed; }
  .header-inner { padding: 0 12px; display: grid; gap: 6px; }
  .minimal h1 { font-size: 16px; }
  .header-controls { gap: 6px; }
  .header-controls .row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
  .header-controls input, .header-controls select { padding: 6px 10px; border-radius: 8px; font-size: 14px; height: 36px; }
  
  /* Stack search and toggle on mobile */
  .search-toggle-row {
    grid-template-columns: 1fr;
  }
  
  .toggle-filter-compact {
    justify-content: center;
  }

  .list { padding: 0 12px 72px; }
  .show { grid-template-columns: max-content 1fr; gap: 10px; padding: 12px 0; align-items: start; }
  .show-time { padding: 4px 8px; border-radius: 12px; }
  .show-time .t { font-size: 13px; }
  .show-time .d { font-size: 11px; white-space: nowrap; }
  .show-title { padding: 6px 10px; font-size: 15px; }
  .show-note { font-size: 13px; }
  .show-series { font-size: 12px; }
  .show-comedians { gap: 6px; font-size: 13px; }

  .show-ctas { grid-column: 2; margin-top: 8px; }
  .price { min-width: 44px; height: 24px; font-size: 12px; padding: 0 6px; border-radius: 6px; }
  .btn { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
  .btn-secondary { background: #64748b; }

  .tooltip { max-width: 90vw; font-size: 12px; }

  .minimal .footer { padding: 10px 12px; }
  .bmc-btn { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
}
.show-comedians { display: flex; flex-wrap: wrap; gap: 6px 8px; }

/* Constrain layout width on desktops for readability */
@media (min-width: 1100px) {
  .minimal #error,
  .minimal main,
  .minimal .footer { max-width: 960px; margin-left: auto; margin-right: auto; }
}

/* Header controls layout (mirrors .controls) */
.header-controls { display: grid; gap: 10px; grid-template-columns: 1fr; padding-top: 8px; }
.header-controls .row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.header-controls input, .header-controls select { background: #ffffff; color: var(--fg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.header-controls input::placeholder { color: var(--muted); }

/* Toggle filter row */
.toggle-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Hide default checkbox */
.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Toggle switch styling */
.toggle-label {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--fg);
  padding-left: 50px;
  margin: 0;
}

.toggle-label::before {
  content: '';
  position: absolute;
  left: 0;
  width: 42px;
  height: 24px;
  background: #e0e0e0;
  border-radius: 12px;
  transition: background 0.3s ease;
}

.toggle-label::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: left 0.3s ease;
}

.toggle-checkbox:checked + .toggle-label::before {
  background: var(--accent);
}

.toggle-checkbox:checked + .toggle-label::after {
  left: 21px;
}

.toggle-checkbox:focus + .toggle-label::before {
  outline: 3px solid color-mix(in oklab, var(--accent), white 30%);
  outline-offset: 2px;
}

/* Compact toggle for search row */
.toggle-filter-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: nowrap;
  min-width: fit-content;
  flex-shrink: 0;
}

/* Adjust search+toggle row layout */
.search-toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-toggle-row #filter-search {
  flex: 1;
  min-width: 0;
}

/* Make toggle label more compact */
.toggle-filter-compact .toggle-label {
  font-size: 0.85rem;
  padding-left: 46px;
}

.toggle-filter-compact .toggle-label::before {
  width: 38px;
  height: 22px;
}

.toggle-filter-compact .toggle-label::after {
  width: 16px;
  height: 16px;
  left: 3px;
}

.toggle-filter-compact .toggle-checkbox:checked + .toggle-label::after {
  left: 19px;
}

/* Ensure CTA container lays out price + button nicely */
.show-ctas { display: grid; grid-template-columns: auto min-content; column-gap: 8px; row-gap: 6px; align-items: start; }
.price-col { grid-column: 1; grid-row: 1; }
.buttons-col { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
