:root {
    --c-primary: #007cba;
    --c-primary-dark: #005a87;
    --c-text: #333;
    --c-text-light: #666;
    --c-text-muted: #777;
    --c-bg: #f5f5f5;
    --c-white: #fff;

    --fs-xs: 0.85em;
    --fs-sm: 0.9em;
    --fs-base: 1em;
    --fs-lg: 1.2em;
    --fs-xl: 1.5em;
    --fs-xxl: 1.8em;
}

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

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

.main-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    flex-shrink: 0;
    background: var(--c-primary);
    color: var(--c-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
    padding: 0 1rem;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: var(--fs-xxl);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
}

.back-arrow {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    font-size: 1.4rem;
    color: var(--c-white);
    cursor: pointer;
}

.back-arrow svg {
    width: 1em;
    height: 1em;
    display: block;
}

.subtitle {
    font-size: var(--fs-base);
    opacity: 0.9;
}

.toolbar {
    background: var(--c-white);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
}



.location-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-filter label {
    font-weight: 500;
    color: #555;
}

.location-filter select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 150px;
    cursor: pointer;
}

.location-filter select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--c-text);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}



.filter-label {
    font-weight: 600;
    color: var(--c-primary);
    white-space: nowrap;
}

.concerts-grid {
    height: 100%;
    overflow-y: auto;
    padding: 0 1rem 70px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.date-group .section-header {
    position: sticky;
    top: 0;
    background: #f3f4f6;
    padding: 0.5rem 0;
    margin: 0;
    z-index: 100;
}

.concert-card {
    background: var(--c-white);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.concert-card.hidden {
    display: none;
}

.concert-card.past {
    opacity: 0.7;
    background: #f9f9f9;
}

.concert-card-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    position: relative;
}

.concert-image-container {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.concert-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.concert-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #6b7280;
    background: #f3f4f6;
}

.concert-image-container.has-image {
    background: transparent;
}

.concert-image-container .concert-musician-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Desktop */
@media (min-width: 769px) {
    .concert-image-container {
        width: 120px;
        height: 120px;
    }
    /* Card as flex container */
    .concert-card {
        display: flex;
        flex-direction: column;
        cursor: default;
    }
    .concert-card-content {
        flex-shrink: 0;
    }
    /* Description row fills remaining space */
    .concert-description-row {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        flex-grow: 1;
    }
    /* Hide toggle chevron on desktop */
    .concert-chevron {
        display: none !important;
    }
}

.concert-musician-name,
.artist-name {
    font-size: var(--fs-lg);
    font-weight: bold;
    color: var(--c-text);
    margin-bottom: 0.25rem;
}

.concert-meta,
.meta {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.concert-time {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    gap: 4px;
}

.concert-time svg {
    width: 14px;
    height: 14px;
}

.table-separator {
    color: #9ca3af;
    font-size: 0.875rem;
}

.date-block {
    flex-shrink: 0;
    width: 48px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.date-block .table-weekday {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
}

.date-block .table-day {
    font-size: 1.5rem;
    font-weight: 900;
    color: #111;
    line-height: 1.1;
}

.content {
    flex: 1;
    min-width: 0;
}

.concert-genre {
    display: inline-block;
    font-weight: 500;
    font-size: var(--fs-sm);
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    line-height: 1.3;
}

.concert-description {
    font-size: var(--fs-xs);
    color: var(--c-text);
    margin: 4px 0;
    white-space: pre-wrap;
    padding-left: 0.5rem;
    border-left: 3px solid #0077b6;
    text-align: left;
}

.concert-description-row {
    padding: 1rem;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.concert-card.expanded .concert-description-row {
    display: flex;
}

.concert-chevron {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: transform 0.2s;
}

.concert-card.expanded .concert-chevron {
    transform: rotate(180deg);
}

.concert-datetime {
    color: #666;
}

.concert-date {
    font-weight: 500;
}

.concert-time {
    font-size: var(--fs-sm);
    color: var(--c-text-muted);
}

.concert-comment {
    font-size: var(--fs-xs);
    color: #555;
    line-height: 1.3;
    margin-bottom: 10px;
    min-height: 2.6em;
}

.concert-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.concert-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.concert-link,
.external-link,
.external-link a {
    display: inline;
    color: var(--c-text);
    font-weight: 600;
    font-size: 0.95em;
    text-decoration: none;
}

.concert-tickets {
    background: var(--c-primary);
    color: var(--c-white);
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: var(--fs-xs);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.concert-tickets:hover {
    background: var(--c-primary-dark);
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: var(--fs-lg);
    color: var(--c-text-light);
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.no-concerts-message {
    background: var(--c-bg);
    color: var(--c-text-light);
    padding: 40px 20px;
    text-align: center;
    font-size: var(--fs-lg);
}

.scroll-to-top {
    position: fixed;
    bottom: 20px;
    left: calc(50% + 235px);
    background: var(--c-primary);
    color: var(--c-white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
    display: block;
}

.scroll-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

.attribution {
    text-align: center;
    font-size: var(--fs-xs);
    color: #888;
    padding: 15px;
}

.attribution a {
    color: var(--c-primary);
    text-decoration: none;
}

.scroll-to-top:hover {
    transform: scale(1.1);
    background: var(--c-primary-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .scroll-to-top {
        left: auto;
        right: 15px;
    }
    .concerts-grid {
        grid-template-columns: 1fr;
    }
    .location-filter {
        flex: 1;
        max-width: 200px;
    }
    .location-filter select {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: var(--fs-xl);
    }
    .back-arrow {
        width: 24px;
    }
}

.section-header {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    background: #f3f4f6;
    padding: 0.5rem 0;
    z-index: 100;
}

.section-header:first-child {
    margin-top: 0;
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.date-group .section-header {
    position: sticky;
    top: 0;
    background: #f3f4f6;
    padding: 0.5rem 0;
    margin: 0;
    z-index: 100;
}

.section-today {
    color: #FF4D4D;
}

.section-tomorrow {
    color: #2563EB;
}

.section-month {
    color: #4B5563;
}

.section-bullet {
    width: 8px;
    height: 8px;
    background: #FF4D4D;
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.time-gap {
    margin-top: 2rem;
}

/* ===== MODE TABLEAU ===== */
body.table-mode {
    background-color: #F3F4F6;
}

body.table-mode .section-header {
    background: #F3F4F6;
}

body.table-mode .section-header:first-child {
    margin-top: 0;
}

body.table-mode .section-today {
    color: #FF4D4D;
}

body.table-mode .section-tomorrow {
    color: #2563EB;
}

body.table-mode .section-month {
    color: #4B5563;
}

body.table-mode .section-bullet {
    width: 8px;
    height: 8px;
    background: #FF4D4D;
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

body.table-mode .scroll-to-top {
    display: none;
}

body.table-mode .concert-card.hidden {
    display: none;
}

body.table-mode .concert-card {
    display: block;
    width: 100%;
    padding: 1rem;
    cursor: default;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.table-mode .concert-card:hover,
body.table-mode .concert-card:active {
    background: #fff;
    transform: none;
}

body.table-mode .concert-card-content {
    padding: 0;
}


body.table-mode .concert-image-container,
body.table-mode .concert-chevron,
body.table-mode .concert-links,
body.table-mode .concert-link,
body.table-mode .concert-image-placeholder {
    display: none;
}

body.table-mode .concert-description-row {
    all: unset;
    display: block;
    margin-top: 0.5rem;
    width: 100%;
}
body.table-mode .concert-description {
    all: unset;
    display: block;
    font-size: var(--fs-xs);
    padding-right: 1rem;
    width: 100%;
    text-align: right;
}

.table-links {
    display: none;
}

body.table-mode .table-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

body.table-mode .table-links a {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
}

body.table-mode .table-links a:hover {
    color: #374151;
}

/* ===== TABLE MODE EXPANDABLE ===== */
body.table-mode .table-description-row {
    display: none;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
    margin-top: 0.5rem;
}

body.table-mode .concert-card.expanded .table-description-row {
    display: block;
}

body.table-mode .table-description {
    font-size: 0.875rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
    padding-left: 0;
    border: none;
}

body.table-mode .table-tickets {
    display: inline-block;
    background: #007cba;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}
