/**
 * Rise of Kingdoms Event Calendar - Main Stylesheet
 * Dark Glassmorphic Theme
 */

:root {
    /* Color Palette - Dark Theme */
    --primary-gold: #FFD700;
    --primary-gold-dark: #FFA500;
    --secondary-blue: #60A5FA;
    --secondary-purple: #A78BFA;
    --accent-red: #F87171;
    --accent-green: #34D399;
    
    /* Glassmorphic Backgrounds */
    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-glass-dark: rgba(0, 0, 0, 0.2);
    --bg-glass-light: rgba(255, 255, 255, 0.15);
    --bg-card: rgba(255, 255, 255, 0.1);
    --bg-card-hover: rgba(255, 255, 255, 0.15);
    --bg-panel: rgba(255, 255, 255, 0.08);
    
    /* Text - Light on Dark */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-light: #ffffff;
    --text-dark: #1f2937;
    
    /* Shadows - Enhanced for glass effect */
    --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-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.3);
    
    /* Borders for glass effect */
    --border-glass: rgba(255, 255, 255, 0.2);
    --border-glass-light: rgba(255, 255, 255, 0.3);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-image: url('../background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* Dark overlay for better contrast */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 1;
}

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

/* Header - Glassmorphic */
.app-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-light);
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.app-header h1 i {
    color: var(--primary-gold);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--spacing-lg) var(--spacing-md);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.filter-group,
.timezone-group,
.export-group {
    flex: 1;
    min-width: 250px;
}

.filter-group label:first-child,
.timezone-group label:first-child,
.export-group label:first-child {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.category-select {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid #dee2e6;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    min-height: 120px;
    transition: border-color 0.2s;
}

.category-select:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.category-select option {
    padding: 0.5rem;
    cursor: pointer;
}

.category-select option:checked {
    background: var(--primary-gold) linear-gradient(0deg, var(--primary-gold) 0%, var(--primary-gold) 100%);
    color: var(--text-primary);
    font-weight: 600;
}

.filter-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.timezone-toggle {
    display: flex;
    gap: var(--spacing-xs);
}

.tz-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--secondary-blue);
    background: white;
    color: var(--secondary-blue);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tz-btn:hover {
    background: var(--secondary-blue);
    color: white;
}

.tz-btn.active {
    background: var(--secondary-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.export-btn {
    padding: 0.6rem 1rem;
    background: rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--primary-gold);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.export-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    color: var(--primary-gold);
}

.category-feeds {
    margin-top: var(--spacing-xs);
    font-size: 0.9rem;
}

.category-feeds summary {
    cursor: pointer;
    color: var(--secondary-blue);
    font-weight: 600;
    padding: 0.5rem 0;
}

.category-feed-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: var(--spacing-xs);
}

.category-feed-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.category-feed-link:hover {
    background: var(--bg-panel);
}

.category-feed-link span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Calendar Layout */
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: var(--spacing-md);
}

/* Sidebar Panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-height: calc(100vh - 300px);
    position: sticky;
    top: var(--spacing-md);
}

.calendar-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    min-height: 600px;
    overflow: visible;
}

/* FullCalendar Overrides */
#calendar {
    font-family: inherit;
    min-height: 600px;
    overflow: visible !important;
}

.fc {
    --fc-border-color: rgba(255, 255, 255, 0.2);
    --fc-today-bg-color: rgba(255, 215, 0, 0.15);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: transparent;
    color: var(--text-light);
}

/* Glassmorphic day header bar */
.fc-scrollgrid-section-header {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.fc-col-header-cell {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
}

.fc-col-header-cell-cushion {
    color: var(--text-light);
    font-weight: 600;
    padding: 0.75rem 0.5rem;
}

/* Force calendar to show all events */
.fc-daygrid-body {
    overflow: visible !important;
}

.fc-toolbar-title {
    font-weight: 700;
    color: var(--text-light);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.fc-button-primary {
    background: rgba(96, 165, 250, 0.3) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(96, 165, 250, 0.4) !important;
    color: var(--text-light) !important;
}

.fc-button-primary:hover {
    background: rgba(167, 139, 250, 0.4) !important;
    border-color: rgba(167, 139, 250, 0.6) !important;
}

.fc-button-primary:disabled {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    opacity: 0.5;
}

.fc-button-primary:not(:disabled):active,
.fc-button-primary:not(:disabled).fc-button-active {
    background: rgba(255, 165, 0, 0.4) !important;
    border-color: rgba(255, 165, 0, 0.6) !important;
}

.fc-event {
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 2px 4px;
    margin-bottom: 2px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.fc-event:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Ensure all events are visible, even on busy days */
.fc-daygrid-day-events {
    min-height: auto !important;
    max-height: none !important;
}

.fc-daygrid-day-frame {
    overflow: visible !important;
    height: auto !important;
    min-height: 120px; /* Minimum height for days */
}

/* Make day cells expand to show all events */
.fc-daygrid-day {
    overflow: visible !important;
    max-height: none !important;
    min-height: 120px; /* Minimum height for days */
    height: auto !important;
}

/* Hide the "more" link completely */
.fc-more-link {
    display: none !important;
}

/* Ensure event container expands */
.fc-daygrid-day-top {
    flex-shrink: 0;
}

.fc-daygrid-day-bottom {
    flex-shrink: 0;
}

/* Allow rows to expand */
.fc-daygrid-body .fc-daygrid-day {
    height: auto !important;
    min-height: 120px;
}

.fc-scrollgrid-section-body {
    overflow: visible !important;
}

.fc-scrollgrid {
    overflow: visible !important;
}

.fc-daygrid-day-number {
    font-weight: 600;
    color: var(--text-light);
}

/* Details Panel */
.details-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Export Panel - matches details panel style but smaller */
.export-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    overflow: hidden;
}

.export-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.export-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.export-content {
    padding: var(--spacing-sm);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.export-panel .export-btn {
    width: 100%;
    justify-content: center;
}


.details-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.details-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-details {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.close-details:hover {
    background: rgba(255,255,255,0.2);
}

.details-content {
    padding: var(--spacing-md);
    overflow-y: auto;
    flex: 1;
}

.details-placeholder {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.details-placeholder i {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.event-detail-view {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.event-detail-view h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-glass);
}

.event-detail-item {
    margin-bottom: var(--spacing-md);
}

.event-detail-item label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-detail-item .value {
    font-size: 1rem;
    color: var(--text-light);
    padding: 0.5rem 0;
}

.event-detail-item .category-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
}

.event-detail-description {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-gold);
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--text-light);
}

/* Footer */
.app-footer {
    background: rgba(0,0,0,0.2);
    color: var(--text-light);
    text-align: center;
    padding: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-panel {
        order: 2;
    }
    
    .details-panel {
        position: relative;
        top: 0;
        max-height: 500px;
    }
    
    .export-panel {
        flex: 0 0 auto;
    }
}

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: var(--spacing-sm);
    }
    
    .controls-panel {
        flex-direction: column;
    }
    
    .filter-group,
    .timezone-group,
    .export-panel {
        width: 100%;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .export-btn {
        justify-content: center;
    }
    
    .calendar-container {
        padding: var(--spacing-xs);
    }
}

