/* CSS Custom Properties */
:root {
    /* Dark Theme - Neutral */
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #666666;
    --highlight-color: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --border-color: #404040;
    --button-primary: #4a4a4a;
    --button-primary-hover: #5a5a5a;
    --button-text: #ffffff;
}

/* Light Theme - Neutral */
:root.light-theme {
    --primary-color: #f0f0f0;
    --secondary-color: #e0e0e0;
    --accent-color: #999999;
    --highlight-color: #000000;
    --text-primary: #000000;
    --text-secondary: #333333;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #f0f0f0;
    --border-color: #d0d0d0;
    --button-primary: #666666;
    --button-primary-hover: #555555;
    --button-text: #ffffff;
}

/* Promotion colors now loaded dynamically from promotions.json */

:root {
    /* Typography */
    --font-primary: 'Roboto Condensed', sans-serif;
    --font-display: 'Oswald', sans-serif;
    
    /* Spacing */
    --padding-xs: 0.25rem;
    --padding-sm: 0.5rem;
    --padding-md: 1rem;
    --padding-lg: 1.5rem;
    --padding-xl: 2rem;
    
    /* Breakpoints */
    --mobile-max: 767px;
    --tablet-max: 1023px;
    /* Motion system */
    --motion-duration-fast: 160ms;
    --motion-duration: 260ms;
    --motion-duration-long: 420ms;
    --motion-ease: cubic-bezier(.2,.9,.2,1);
    --motion-ease-smooth: cubic-bezier(.22,.8,.3,1);
    /* Responsive typography scale */
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 22px;
    --font-size-badge: 0.85rem;
}

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

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    font-size: var(--font-size-base);
}

/* Loading Screen Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
    max-width: 400px;
    padding: var(--padding-xl);
}

.loading-logo h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: var(--padding-sm);
    color: var(--highlight-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.loading-tagline {
    font-size: 1.1rem;
    margin-bottom: var(--padding-xl);
    opacity: 0.9;
}

.loading-progress-container {
    margin: var(--padding-xl) 0;
}

.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--padding-md);
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--highlight-color), var(--accent-color));
    width: 0%;
    transition: width var(--motion-duration-long, 420ms) var(--motion-ease, cubic-bezier(.2,.9,.2,1));
}

.loading-status, .loading-percentage {
    margin: var(--padding-sm) 0;
    font-size: 0.9rem;
}

/* App Header */
.app-header {
    background: var(--bg-secondary);
    padding: var(--padding-md) var(--padding-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}


.header-controls {
    display: flex;
    gap: var(--padding-md);
    align-items: center;
}

/* Icon Button Group */
.icon-button-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.icon-button {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    touch-action: manipulation;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button.active {
    background: var(--accent-color);
}

.icon-button:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Calendar Icon */
.icon-button#calendar-view-btn::before {
    content: '';
    width: 18px;
    height: 16px;
    border: 2px solid;
    border-color: var(--text-secondary);
    border-radius: 2px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: 
        linear-gradient(var(--text-secondary) 0 0) 4px 8px / 2px 6px,
        linear-gradient(var(--text-secondary) 0 0) 8px 8px / 2px 6px,
        linear-gradient(var(--text-secondary) 0 0) 12px 8px / 2px 6px,
        linear-gradient(var(--text-secondary) 0 0) 4px 4px / 10px 2px;
    background-repeat: no-repeat;
}

.icon-button#calendar-view-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    margin-top: -10px;
}

.icon-button#calendar-view-btn.active::before,
.icon-button#calendar-view-btn.active::after {
    border-color: white;
    background-color: white;
    background-image: 
        linear-gradient(white 0 0),
        linear-gradient(white 0 0),
        linear-gradient(white 0 0),
        linear-gradient(white 0 0);
}

/* List Icon */
.icon-button#list-view-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 10px;
    background: 
        linear-gradient(var(--text-secondary) 0 0) 0 0 / 100% 2px,
        linear-gradient(var(--text-secondary) 0 0) 0 4px / 100% 2px,
        linear-gradient(var(--text-secondary) 0 0) 0 8px / 100% 2px;
    background-repeat: no-repeat;
}

.icon-button#list-view-btn.active::before {
    background: 
        linear-gradient(white 0 0) 0 0 / 100% 2px,
        linear-gradient(white 0 0) 0 4px / 100% 2px,
        linear-gradient(white 0 0) 0 8px / 100% 2px;
    background-repeat: no-repeat;
}

/* Filter Icon */
.icon-button#filter-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 9px 0 9px;
    border-color: var(--text-secondary) transparent transparent transparent;
    margin-top: -4px;
}

.icon-button#filter-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 8px;
    background: var(--text-secondary);
    margin-top: 4px;
}

.icon-button#filter-button.active::before {
    border-color: white transparent transparent transparent;
}

.icon-button#filter-button.active::after {
    background: white;
}


/* Theme Toggle (Sun/Moon) Icon */
.icon-button#theme-toggle-btn {
    position: relative;
}

.icon-button#theme-toggle-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all 0.3s ease;
}

/* Sun rays using after pseudo-element */
.icon-button#theme-toggle-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    background: 
        /* Long rays */
        linear-gradient(var(--text-secondary), var(--text-secondary)) 50% 0/2px 4px no-repeat,
        linear-gradient(var(--text-secondary), var(--text-secondary)) 100% 50%/4px 2px no-repeat,
        linear-gradient(var(--text-secondary), var(--text-secondary)) 50% 100%/2px 4px no-repeat,
        linear-gradient(var(--text-secondary), var(--text-secondary)) 0% 50%/4px 2px no-repeat,
        /* Short rays */
        linear-gradient(45deg, var(--text-secondary), var(--text-secondary)) 85% 15%/3px 1px no-repeat,
        linear-gradient(45deg, var(--text-secondary), var(--text-secondary)) 85% 85%/3px 1px no-repeat,
        linear-gradient(45deg, var(--text-secondary), var(--text-secondary)) 15% 85%/3px 1px no-repeat,
        linear-gradient(45deg, var(--text-secondary), var(--text-secondary)) 15% 15%/3px 1px no-repeat;
    transition: all 0.3s ease;
}

/* Light theme: crescent moon icon */
:root.light-theme .icon-button#theme-toggle-btn::before {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    box-shadow: 4px 0 0 0 var(--text-secondary);
    transform: translate(-50%, -50%) rotate(-25deg);
}

/* Hide sun rays in light theme */
:root.light-theme .icon-button#theme-toggle-btn::after {
    background: none;
}

.icon-button#theme-toggle-btn.active::before {
    background: white;
}

/* List View Ad Containers */
.timeline-ad-container {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: var(--padding-md);
    margin-bottom: var(--padding-md);
    border-left: 4px solid var(--border-color);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timeline-ad-container::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-primary);
}

.promotion-ad-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: var(--padding-md);
    border-left: 4px solid var(--border-color);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-content {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.ad-placeholder-native {
    width: 100%;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--padding-xs);
}

.ad-label-native {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Interstitial Ad Overlay */
.interstitial-ad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

.interstitial-ad-overlay.active {
    display: flex;
}

.interstitial-ad-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--padding-xl);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    animation: slideIn 0.4s ease-out;
}

.interstitial-ad-header {
    margin-bottom: var(--padding-lg);
}

.interstitial-ad-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--padding-xs);
}

.interstitial-ad-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.interstitial-ad-content {
    margin-bottom: var(--padding-lg);
}

.interstitial-ad-placeholder {
    width: 100%;
    height: 250px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--padding-md);
}

.interstitial-ad-placeholder .loading-icon {
    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: var(--padding-sm);
}

.interstitial-ad-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.interstitial-ad-actions {
    display: flex;
    gap: var(--padding-sm);
    justify-content: center;
}

.interstitial-close-btn {
    background: var(--button-primary);
    color: var(--button-text);
    border: none;
    padding: var(--padding-sm) var(--padding-lg);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--motion-duration) var(--motion-ease);
    min-width: 100px;
}

.interstitial-close-btn:hover {
    background: var(--button-primary-hover);
}

.interstitial-close-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Sort toggles for list view */
.sort-toggles {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.sort-button {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: var(--padding-xs) var(--padding-md);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--motion-duration) var(--motion-ease);
    font-size: 0.9rem;
    touch-action: manipulation;
    min-height: 40px;
}

.sort-button.active {
    background: var(--accent-color);
    color: white;
    font-weight: 600;
}

.sort-button:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Filter Panel */
.filter-panel {
    background: var(--bg-secondary);
    padding: var(--padding-lg);
    margin: var(--padding-md);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--motion-duration-long, 420ms) var(--motion-ease, cubic-bezier(.2,.9,.2,1)), padding var(--motion-duration, 260ms) var(--motion-ease, cubic-bezier(.2,.9,.2,1));
}

.filter-panel:not(.hidden) {
    max-height: 500px;
}

.filter-panel.hidden {
    padding: 0 var(--padding-lg);
}

.filter-content h3 {
    color: var(--highlight-color);
    margin-bottom: var(--padding-md);
    font-family: var(--font-display);
}

/* Filter Panel Tabs */
.filter-header {
    padding: 0 0 var(--padding-md) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--padding-md);
}

.filter-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0;
    padding: 0;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: var(--padding-sm) var(--padding-md);
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: var(--font-size-md);
    font-weight: 600;
    white-space: nowrap;
    min-width: fit-content;
    flex-shrink: 0;
    position: relative;
}

.filter-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.filter-tab.active {
    color: var(--highlight-color);
    border-bottom-color: currentColor;
}

.filter-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--padding-sm);
    margin-bottom: var(--padding-lg);
}

.filter-option {
    display: flex;
    align-items: center;
    gap: var(--padding-xs);
    padding: var(--padding-xs);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.filter-option label {
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: var(--padding-sm);
    justify-content: center;
}

/* Main Content */
.main-content {
    padding: var(--padding-lg);
    min-height: calc(100vh - 120px);
}

/* List View Styles */
.list-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--padding-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.list-controls {
    margin-bottom: var(--padding-lg);
    display: flex;
    justify-content: center;
}

.timeline-view,
.promotion-blocks-view {
    max-height: 70vh;
    overflow-y: auto;
    transition: opacity var(--motion-duration) var(--motion-ease), transform var(--motion-duration) var(--motion-ease);
}

.calendar-container,
.list-container {
    transition: opacity var(--motion-duration) var(--motion-ease), transform var(--motion-duration) var(--motion-ease);
}

/* Timeline View Styles */
.timeline-section {
    margin-bottom: var(--padding-xl);
    position: relative;
}

.timeline-section.highlight-target {
    box-shadow: 0 6px 30px rgba(102, 102, 102, 0.18);
    border-radius: 10px;
    transform: translateY(-4px);
    transition: all var(--motion-duration) var(--motion-ease);
}

.timeline-header {
    background: var(--bg-tertiary);
    color: var(--highlight-color);
    padding: var(--padding-md);
    border-radius: 8px;
    margin-bottom: var(--padding-md);
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.timeline-events {
    position: relative;
    padding-left: var(--padding-xl);
}

.timeline-events::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-color);
}

.timeline-event {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: var(--padding-md);
    margin-bottom: var(--padding-md);
    border-left: 4px solid var(--accent-color);
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    min-height: 60px;
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--bg-primary);
}

.timeline-event:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 18px rgba(102, 102, 102, 0.18);
}

.timeline-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--padding-xs);
}

.timeline-event-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.timeline-event-promotion {
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.timeline-event-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: var(--padding-xs) 0 0 0;
}

/* Promotion Blocks View Styles */
.promotion-block {
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: var(--padding-lg);
    overflow: hidden;
    border: 2px solid transparent;
    transition: all var(--motion-duration) var(--motion-ease);
}

.promotion-header {
    padding: var(--padding-lg);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.promotion-toggle {
    font-size: 1.5rem;
    transition: transform var(--motion-duration) var(--motion-ease);
}

.promotion-block.collapsed .promotion-toggle {
    transform: rotate(-90deg);
}

.promotion-events {
    padding: var(--padding-md) var(--padding-lg) var(--padding-lg) var(--padding-lg);
    display: grid;
    gap: var(--padding-md);
}

.promotion-block.collapsed .promotion-events {
    display: none;
}

.promotion-event-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: var(--padding-md);
    border-left: 4px solid;
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    min-height: 60px;
}

.promotion-event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.promotion-event-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--padding-xs) 0;
}

.promotion-event-date {
    color: var(--highlight-color);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--padding-xs);
}

.promotion-event-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Calendar Styles */
.calendar-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--padding-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--padding-lg);
    padding: var(--padding-md);
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.calendar-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--highlight-color);
}

.calendar-nav {
    background: var(--button-primary);
    color: var(--button-text);
    border: none;
    padding: var(--padding-sm) var(--padding-md);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    min-width: 40px;
    transition: background 0.3s ease;
}

.calendar-nav:hover {
    background: var(--button-primary-hover);
}

.calendar-grid {
    display: grid;
    gap: 1px;
    background: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--padding-lg);
}

.calendar-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
    background: var(--bg-tertiary);
    padding: var(--padding-md);
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.calendar-day {
    background: var(--bg-secondary);
    height: 100px;
    padding: var(--padding-xs);
    position: relative;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.05);
}

.calendar-day.empty {
    background: var(--bg-primary);
    cursor: default;
}

.calendar-day.empty:hover {
    background: var(--bg-primary);
}




.day-number {
    font-weight: bold;
    margin-bottom: var(--padding-xs);
    font-size: 0.8rem;
}

/* Day banded layout (stacked promotion color bands inside a day cell) */
.calendar-day {
    position: relative; /* allow overlays and positioned day number */
    overflow: hidden;
}

.day-bands-container {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.day-band {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    box-sizing: border-box;
    padding: 2px 4px;
    color: var(--text-primary);
}

.day-band span {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 
        0 1px 3px rgba(0,0,0,0.8),
        0 0 1px rgba(0,0,0,1);
}

/* Keep the day number visible and readable above the color bands */
.calendar-day .day-number {
    position: absolute;
    top: 6px;
    left: 6px;
    margin: 0;
    z-index: 3;
    background: rgba(0,0,0,0.5);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.day-extra-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 4;
    background: rgba(0,0,0,0.65);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* Improve contrast for very light promotion colors by adding a subtle inset overlay */
.day-band.light-bg {
    box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.15);
}

@media (max-width: 767px) {
    .day-band span {
        font-size: 0.7rem;
    }
    .calendar-day .day-number {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

.calendar-day.current-day {
    background: var(--accent-color);
    color: white;
}

.calendar-day.current-day .day-number {
    color: white;
}

.calendar-day.past-day {
    opacity: 0.6;
}

.shows-container {
    /* Compact grid of small badges so multiple events fit in a day cell */
    --day-grid-gap: 6px;
    --day-grid-rows: 2; /* try to show up to 2 rows by default */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 28px;
    gap: var(--day-grid-gap);
    align-items: center;
    justify-items: stretch;
    margin-top: 6px;
    padding-top: 4px;
    max-height: calc(var(--day-grid-rows) * 36px + var(--day-grid-gap));
    overflow-y: auto;
}

.event-bar {
    height: 4px;
    border-radius: 2px;
    cursor: pointer;
    transition: all var(--motion-duration-fast,160ms) var(--motion-ease);
    min-width: 100%;
    position: relative;
}

.event-bar:hover {
    height: 6px;
    opacity: 0.9;
    transform: scaleY(1.2);
}

/* Keep the old show-item class for backward compatibility but hide text */
.show-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    min-height: 28px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform var(--motion-duration) var(--motion-ease), box-shadow var(--motion-duration) var(--motion-ease), opacity var(--motion-duration) var(--motion-ease);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

.show-item:hover {
    opacity: 0.95;
    transform: translateY(-2px) scale(1.02);
}

/* Tooltip for event bars */
.event-bar::after,
.show-item::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: var(--padding-xs) var(--padding-sm);
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.event-bar:hover::after,
.show-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Promotion colors now applied dynamically via JavaScript */

/* Calendar Legend */
.calendar-legend {
    background: var(--bg-tertiary);
    padding: var(--padding-lg);
    border-radius: 8px;
}

.calendar-legend h4 {
    margin-bottom: var(--padding-md);
    color: var(--highlight-color);
    font-family: var(--font-display);
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: var(--padding-xs);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Event Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--motion-duration) var(--motion-ease), visibility var(--motion-duration) var(--motion-ease);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 560px;
    width: 94%;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
    color: var(--highlight-color);
    font-family: var(--font-display);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--padding-xs);
}

.modal-body {
    padding: var(--padding-lg);
}

.event-detail-item {
    margin-bottom: var(--padding-sm);
    padding-bottom: var(--padding-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.event-detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.event-detail-item strong {
    color: var(--highlight-color);
}

.modal-actions {
    padding: var(--padding-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--padding-sm);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
    background: var(--button-primary);
    color: var(--button-text);
    border: none;
    padding: var(--padding-sm) var(--padding-md);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: var(--button-primary-hover);
}

/* Accessibility & Touch Improvements */
:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.22);
    outline-offset: 2px;
}

button,
.icon-button,
.sort-button,
.calendar-nav,
.modal-close {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Smooth native scrolling for lists on iOS */
.timeline-view,
.promotion-events,
.calendar-grid,
.timeline-events {
    -webkit-overflow-scrolling: touch;
}

/* Disable hover-tooltips on touch-only devices */
@media (hover: none) {
    .event-bar::after,
    .show-item::after {
        display: none;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 767px) {
    :root {
        --padding-sm: 0.6rem;
        --padding-md: 0.9rem;
        --padding-lg: 1.1rem;
    }

    .app-header {
        padding: var(--padding-sm) var(--padding-md);
    }

    .icon-button,
    .sort-button,
    .calendar-nav {
        min-height: 48px;
        font-size: 1rem;
    }
    
    .icon-button {
        width: 48px;
        height: 48px;
    }
    
    .sort-button,
    .calendar-nav {
        padding: 10px 12px;
    }

    .calendar-grid {
        gap: 6px;
    }

    .calendar-day {
        height: auto;
        min-height: 90px;
        padding: 8px;
    }

    .shows-container {
        gap: 8px;
    }

    /* Make event bars easier to tap */
    .event-bar {
        min-height: 18px;
        height: 18px;
        border-radius: 6px;
    }

    .show-item {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    /* Modal goes full-screen on small devices for easier reading and actions */
    .modal-content {
        border-radius: 12px 12px 0 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .modal-body {
        padding: calc(var(--padding-lg) + env(safe-area-inset-bottom, 12px));
        overflow-y: auto;
        flex: 1 1 auto;
    }

    .modal-header {
        padding: 14px;
    }

    .modal-close {
        font-size: 1.6rem;
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Mobile typography tweaks */
@media (max-width: 767px) {
    :root {
        --font-size-base: 15px;
        --font-size-sm: 13px;
        --font-size-md: 15px;
        --font-size-lg: 17px;
        --font-size-xl: 20px;
        --font-size-badge: 0.78rem;
    }

    .app-header h1 { font-size: var(--font-size-lg); }
    .calendar-header h3 { font-size: var(--font-size-md); }
    .timeline-event-title, .promotion-event-title { font-size: var(--font-size-md); }
    .day-number { font-size: 0.75rem; padding: 2px 6px; }
    .day-band span { font-size: 0.7rem; }
    .show-item { font-size: var(--font-size-badge); min-height: 30px; height: 30px; }
    .modal-content { padding: 0; }
    .modal-body { font-size: var(--font-size-md); }
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: var(--padding-sm) var(--padding-md);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease, color 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-cta {
    background: var(--highlight-color);
    color: var(--bg-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.btn-cta:hover {
    background: #e6e6e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
}

/* Event Count Display */
.event-count {
    background: var(--bg-tertiary);
    color: var(--highlight-color);
    padding: var(--padding-xs) var(--padding-sm);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    margin-top: 2px;
    border: 1px solid var(--border-color);
}

/* Day Modal Styles */
.day-event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--padding-md);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--motion-duration-fast,160ms) var(--motion-ease);
    min-height: 60px;
}

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

.day-event-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.day-event-header {
    display: flex;
    align-items: center;
    gap: var(--padding-sm);
    flex: 1;
}

.day-event-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.day-event-info {
    flex: 1;
}

.day-event-title {
    margin: 0 0 var(--padding-xs) 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.day-event-promotion {
    margin: 0 0 var(--padding-xs) 0;
    color: var(--highlight-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.day-event-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
}

.day-event-more-info {
    flex-shrink: 0;
    min-height: 44px;
    min-width: 100px;
    font-size: 0.9rem;
    padding: var(--padding-sm) var(--padding-md);
    touch-action: manipulation;
    border-radius: 8px;
    background: var(--button-primary);
    color: var(--button-text);
    border: none;
    cursor: pointer;
}

/* External Link Warning Modal */
.external-link-warning {
    text-align: center;
    padding: var(--padding-lg) 0;
}

.warning-icon {
    font-size: 3rem;
    margin-bottom: var(--padding-md);
    animation: pulse 2s infinite;
}

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

.external-link-url {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: var(--padding-md);
    margin: var(--padding-md) 0;
    word-break: break-all;
    font-family: monospace;
    color: var(--highlight-color);
    font-size: var(--font-size-sm);
}

.warning-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--padding-md);
}

.external-link-warning p:first-child {
    margin-bottom: var(--padding-md);
}

/* App Footer */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--padding-lg) 0;
    margin-top: var(--padding-xl);
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--padding-md);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--padding-md);
    margin-bottom: var(--padding-md);
    flex-wrap: wrap;
}

.footer-link {
    color: var(--highlight-color);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: color var(--motion-duration) var(--motion-ease);
}

.footer-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.footer-divider {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: var(--padding-xs);
}

.footer-text {
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    margin: 0;
}

/* Responsive footer */
@media (max-width: 480px) {
    .footer-links {
        flex-direction: column;
        gap: var(--padding-sm);
    }
    
    .footer-divider {
        display: none;
    }
    
    .app-footer {
        padding: var(--padding-md) 0;
        margin-top: var(--padding-lg);
    }
}

/* Modal Tabbed Interface */
.modal-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0;
    padding: 0;
}

.modal-tabs::-webkit-scrollbar {
    display: none;
}

.modal-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: var(--padding-sm) var(--padding-md);
    cursor: pointer;
    transition: all var(--motion-duration) var(--motion-ease);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: var(--font-size-md);
    font-weight: 600;
    white-space: nowrap;
    min-width: fit-content;
    flex-shrink: 0;
    position: relative;
}

.modal-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-tab.active {
    color: var(--highlight-color);
    border-bottom-color: currentColor;
}

/* Mobile specific modal styles */
@media (max-width: 767px) {
    .day-event-item {
        padding: var(--padding-md);
        min-height: 70px;
    }
    
    .day-event-more-info {
        min-height: 48px;
        min-width: 110px;
        font-weight: 600;
    }
    
    .day-event-title {
        font-size: 0.95rem;
    }
    
    .day-event-promotion {
        font-size: 0.85rem;
    }
    
    .modal-tab {
        padding: var(--padding-xs) var(--padding-sm);
        font-size: var(--font-size-sm);
        min-width: 60px;
    }
}
    
    .event-count {
        font-size: 0.9rem;
        padding: var(--padding-sm);
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
}

/* AdMob Banner Ad */
.banner-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    transition: transform 0.3s ease;
}

.banner-ad.hidden {
    transform: translateY(100%);
}

.ad-placeholder {
    width: 320px;
    height: 50px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin: var(--padding-xs) auto;
}

.ad-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--padding-sm); }
.mt-2 { margin-top: var(--padding-md); }
.mt-3 { margin-top: var(--padding-lg); }

/* Mobile Responsive Design */
@media (max-width: 767px) {
    .app-header {
        padding: var(--padding-sm) var(--padding-md);
        justify-content: center;
    }
    
    .header-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--padding-sm);
    }
    
    .icon-button-group,
    .sort-toggles {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .sort-button {
        flex: 1;
        min-height: 44px;
        font-weight: 600;
    }
    
    .timeline-event,
    .promotion-event-card {
        min-height: 80px;
        padding: var(--padding-md);
    }
    
    .timeline-event-title,
    .promotion-event-title {
        font-size: 1.1rem;
    }
    
    .promotion-header {
        min-height: 60px;
        font-size: 1.1rem;
    }
    
    .list-container {
        padding: var(--padding-md);
    }
    
    .timeline-view,
    .promotion-blocks-view {
        max-height: 60vh;
    }
    
    .main-content {
        padding: var(--padding-sm);
    }
    
    .calendar-container {
        padding: var(--padding-sm);
    }
    
    .calendar-header {
        padding: var(--padding-sm);
    }
    
    .calendar-header h3 {
        font-size: 1.2rem;
    }
    
    .calendar-day {
        height: 70px;
        padding: var(--padding-xs);
        cursor: pointer;
        min-height: 70px;
    }

/* Performance & Motion Hints */
.show-item, .timeline-event, .promotion-block, .modal, .calendar-container {
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-duration-fast: 0ms;
        --motion-duration: 0ms;
        --motion-duration-long: 0ms;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}
    
    .calendar-day.empty {
        cursor: default;
    }
    
    .day-number {
        font-size: 0.7rem;
        margin-bottom: 1px;
    }
    
    .show-item,
    .event-bar {
        height: 16px;
        min-height: 16px;
        font-size: 0.6rem;
        line-height: 16px;
    }
    
    .shows-container {
        gap: 1px;
    }
    
    
    .legend-items {
        grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
        gap: 0px;
    }
    
    .legend-item {
        gap: 2px;
        font-size: 0.7rem;
        padding: 2px;
    }
    
    .legend-color {
        width: 6px;
        height: 6px;
    }
    
    .modal-content {
        width: 95%;
        margin: var(--padding-sm);
    }
    
    .modal-header,
    .modal-body,
    .modal-actions {
        padding: var(--padding-md);
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn-cta,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        margin-bottom: var(--padding-xs);
        text-align: center;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .banner-ad {
        position: sticky;
        bottom: auto;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        height: 55px;
    }
    
    .calendar-day-header {
        padding: var(--padding-xs);
        font-size: 0.8rem;
    }
    
    .loading-logo h1 {
        font-size: 2rem;
    }
    
    .filter-actions {
        flex-direction: column;
        margin-top: var(--padding-md);
    }
    
    .filter-panel:not(.hidden) {
        max-height: 400px;
    }
    
    .filter-content {
        padding: var(--padding-sm) 0;
    }
    
    .filter-options {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: var(--padding-xs);
    }
}

/* Tablet Responsive Design */
@media (min-width: 768px) and (max-width: 1023px) {
    .calendar-day {
        height: 90px;
    }
    
    .legend-items {
        grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    }
}

/* Large Screen Optimizations */
@media (min-width: 1024px) {
    .main-content {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .calendar-day {
        height: 120px;
    }
    
    .shows-container {
        flex: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme by default */
}

/* Print Styles */
@media print {
    .header-controls,
    .filter-panel,
    .banner-ad,
    .modal {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .calendar-container {
        box-shadow: none !important;
        border: 1px solid #666 !important;
    }
}