/* ═══════════════════════════════════════════════════════════════════════
   WhichBandWhichTown — Premium Dark Theme Design System
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────────── */
:root {
    /* Background layers */
    --bg-base: #0a0a0f;
    --bg-surface: #12121a;
    --bg-elevated: #1a1a2e;
    --bg-hover: #222240;
    --bg-active: #2a2a4e;

    /* Accent palette */
    --accent-primary: #8b5cf6;
    --accent-primary-hover: #a78bfa;
    --accent-secondary: #ec4899;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f97316 100%);
    --accent-gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(236, 72, 153, 0.10) 100%);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-accent: #a78bfa;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.10);
    --border-accent: rgba(139, 92, 246, 0.3);

    /* Glassmorphism */
    --glass-bg: rgba(18, 18, 26, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(139, 92, 246, 0.15);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Map accent */
    --hub-circle-fill: rgba(139, 92, 246, 0.12);
    --hub-circle-stroke: rgba(139, 92, 246, 0.5);
    --route-color: #a78bfa;

    /* Layout */
    --sidebar-width: 400px;
    --header-height: 64px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

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

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ── Header ────────────────────────────────────────────────────────── */
.app-header {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    z-index: 100;
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
    animation: gentle-pulse 3s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ── Main Layout ───────────────────────────────────────────────────── */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-height));
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Panel (Glass Card) ────────────────────────────────────────────── */
.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.panel:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.panel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-icon {
    font-size: 1rem;
}

/* ── Search ────────────────────────────────────────────────────────── */
#band-search-panel {
    position: relative;
    z-index: 10;
}

.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.search-spinner {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    transform: translateY(-50%);
    display: none;
    animation: search-spin 0.6s linear infinite;
}

.search-spinner.active {
    display: block;
}

@keyframes search-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

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

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    list-style: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.search-results.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

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

.search-result-item:hover,
.search-result-item.highlighted {
    background: var(--bg-hover);
    color: var(--text-accent);
}

/* ── Bands List ────────────────────────────────────────────────────── */
.bands-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.band-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.band-item:hover {
    border-color: var(--border-accent);
}

.band-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.band-checkbox:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.band-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.band-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.band-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.band-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.empty-state {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    text-align: center;
    padding: 8px 0;
    font-style: italic;
}

/* ── Constraints ───────────────────────────────────────────────────── */
.constraint-group {
    margin-bottom: 14px;
}

.constraint-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.constraint-value {
    font-weight: 700;
    color: var(--text-accent);
    font-variant-numeric: tabular-nums;
}

/* ── Range Slider ──────────────────────────────────────────────────── */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-hover);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.6);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* ── Checkbox ──────────────────────────────────────────────────────── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.checkbox-custom {
    display: none; /* using direct styling instead */
}

/* ── Hub Cards ─────────────────────────────────────────────────────── */
.hub-count {
    margin-left: auto;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    display: none;
}

.hub-count.active {
    display: inline-block;
}

.hubs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hub-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.hub-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.hub-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.hub-card:hover::before {
    opacity: 1;
}

.hub-card.active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow), 0 0 0 1px var(--accent-primary);
    background: var(--bg-active);
}

.hub-card.active::before {
    opacity: 1;
}

.hub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.hub-region {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hub-active-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--accent-gradient);
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    display: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hub-card.active .hub-active-badge {
    display: inline-block;
}

.hub-dates {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.hub-show-count {
    font-size: 0.78rem;
    color: var(--text-accent);
    font-weight: 500;
}

.hub-concerts {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hub-concert-item {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    padding: 3px 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 6px;
}

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

.hub-concert-band {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-concert-venue {
    color: var(--text-tertiary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-concert-date {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* ── Empty & Loading States ────────────────────────────────────────── */
.hubs-empty,
.hubs-loading {
    text-align: center;
    padding: 24px 8px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.hubs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Map Area ──────────────────────────────────────────────────────── */
.map-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.map-container {
    width: 100%;
    height: 100%;
    background: var(--bg-base);
}

.map-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-tertiary);
    background:
        radial-gradient(ellipse at center, rgba(139, 92, 246, 0.05) 0%, transparent 70%),
        var(--bg-base);
}

.map-placeholder-icon {
    font-size: 4rem;
    opacity: 0.3;
    animation: gentle-pulse 4s ease-in-out infinite;
}

.map-placeholder h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.map-placeholder p {
    font-size: 0.85rem;
    max-width: 300px;
    text-align: center;
}

.map-api-note {
    font-size: 0.75rem !important;
    color: var(--text-tertiary) !important;
    margin-top: 8px;
    opacity: 0.7;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: unset;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .map-area {
        min-height: 50vh;
    }
}
