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

:root {
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --accent-color: #ffd23f;
    --dark-bg: #1a1a1a;
    --card-bg: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
    
    --nav-height: 80px;
    --header-height: 120px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #2a1a1a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Layout */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: var(--nav-height);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.schedule-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.day-header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 1.5rem;
    text-align: center;
}

.day-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.date-info {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Stage Filters */
.stage-filters {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.stage-filter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.stage-filter-btn:hover {
    background: rgba(255, 107, 53, 0.2);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.stage-filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}

.stage-filter-btn.active:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

.stage-filter-all {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.stage-filter-all:hover {
    background: var(--accent-color);
    color: var(--dark-bg);
}

.stage-filter-all.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--dark-bg);
}

.stage-filter-favorites {
    background: rgba(255, 210, 63, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.stage-filter-favorites:hover {
    background: rgba(255, 210, 63, 0.2);
    color: var(--accent-color);
}

.stage-filter-favorites.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--dark-bg);
}

.schedule-content {
    padding: 1.5rem;
    min-height: 400px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Event Cards */
.event-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.event-card.now-playing {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2) 0%, rgba(247, 147, 30, 0.2) 100%);
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    position: relative;
    animation: pulse 2s infinite;
}

.event-card.now-playing::before {
    content: '🔴 NOW PLAYING';
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 53, 0.6);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    }
}

.event-time {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.event-time::before {
    content: '🕐';
    font-size: 0.8rem;
}

/* Favorite Button */
.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    position: relative;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.favorite-btn .star {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.favorite-btn.favorited .star {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
    animation: starGlow 2s ease-in-out infinite alternate;
}

.favorite-btn:hover .star {
    color: var(--accent-color);
    transform: scale(1.2);
}

@keyframes starGlow {
    0% {
        text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
    }
    100% {
        text-shadow: 0 0 20px rgba(255, 210, 63, 0.8);
    }
}

.event-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.event-stage {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-stage::before {
    content: '🎵';
    font-size: 0.8rem;
}

.event-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Time Grouping */
.time-group {
    margin-bottom: 2rem;
}

.time-group-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-group-header::before {
    content: '⏰';
    font-size: 0.9rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    height: var(--nav-height);
    backdrop-filter: blur(20px);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    position: relative;
}

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

.nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .schedule-content {
        padding: 1rem;
    }
    
    .stage-filters {
        padding: 0.75rem 1rem;
        gap: 0.4rem;
    }
    
    .stage-filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .event-card {
        padding: 1rem;
    }
    
    .event-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .day-title {
        font-size: 1.5rem;
    }
    
    .nav-label {
        font-size: 0.7rem;
    }
    
    .nav-icon {
        font-size: 1.1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Focus States for Accessibility */
.nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.event-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #666666;
        --text-secondary: #cccccc;
    }
}

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

/* PWA Install Prompt - Now handled with inline styles like bean app */

/* About Page */
.about-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    /* Ensure it respects mobile browser UI */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    width: 100vw;
    width: 100dvw; /* Dynamic viewport width for mobile */
}

.about-page.show {
    opacity: 1;
    visibility: visible;
}

.about-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh; /* Dynamic viewport height for mobile */
    overflow-y: auto;
    position: relative;
    /* Ensure content doesn't bleed under browser UI */
    margin: 0.5rem;
}

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

.about-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.close-about {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.about-body {
    padding: 0 1.5rem 1.5rem;
}

.about-section {
    margin-bottom: 2rem;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.about-section ul {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.about-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ff5f5f 0%, #ff6b6b 100%);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 95, 95, 0.3);
}

.kofi-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 95, 95, 0.4);
    color: white;
    text-decoration: none;
}

.kofi-icon {
    font-size: 1.2rem;
}

.force-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.force-refresh-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.refresh-icon {
    font-size: 1.1rem;
    animation: spin 2s linear infinite;
}

.clear-favorites-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.clear-favorites-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.star-icon {
    font-size: 1.1rem;
}

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

@keyframes fabPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 0 rgba(255, 107, 53, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 10px rgba(255, 107, 53, 0);
        transform: scale(1.05);
    }
}

/* Mobile About Page */
@media (max-width: 768px) {
    .about-page {
        padding: 0.5rem;
        /* Use safe area insets for mobile browsers */
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
    }
    
    .about-content {
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem); /* Dynamic viewport height minus padding */
        margin: 0;
        border-radius: 0.75rem;
    }
    
    .about-header {
        padding: 1rem 1rem 0;
        margin-bottom: 1rem;
        /* Add safe area padding for header */
        padding-top: max(1rem, env(safe-area-inset-top) + 0.5rem);
    }
    
    .about-header h2 {
        font-size: 1.3rem;
    }
    
    .about-body {
        padding: 0 1rem 1rem;
        /* Add safe area padding for bottom */
        padding-bottom: max(1rem, env(safe-area-inset-bottom) + 0.5rem);
    }
    
    .about-section {
        margin-bottom: 1.5rem;
    }
    
    .about-section h3 {
        font-size: 1rem;
    }
    
    .kofi-button,
    .force-refresh-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Floating Now Playing Button (FAB) */
.fab-now-playing {
    position: fixed;
    right: 16px;
    bottom: calc(var(--nav-height) + 16px);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    cursor: pointer;
    z-index: 1100;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
    animation: fabPulse 2s ease-in-out infinite;
}

.fab-now-playing.show {
    opacity: 1;
    pointer-events: auto;
}

.fab-now-playing:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    animation: none; /* Stop pulsing on hover */
}

@media (max-width: 768px) {
    .fab-now-playing {
        right: 12px;
        bottom: calc(var(--nav-height) + 12px);
        padding: 0.5rem 0.8rem;
        border-radius: 20px;
    }
}
