:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.container {
    display: grid;
    grid-template-areas: 
        "header header"
        "main sidebar";
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 16px;
    padding: 16px;
    max-width: 1800px;
    margin: 0 auto;
}

/* Header Styles */
header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    height: 60px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.today-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.today-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--border);
    transform: scale(1.05);
}

#currentPeriod {
    font-size: 20px;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-container input {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    width: 200px;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-container select {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

.view-controls {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}

.view-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
}

.view-btn.active {
    background: var(--background);
    color: var(--primary-color);
    box-shadow: 0 1px 3px var(--shadow);
}

.view-btn:hover:not(.active) {
    color: var(--text-primary);
}

.theme-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--border);
    transform: rotate(20deg);
}

/* Main Content */
main {
    grid-area: main;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: auto;
    box-shadow: 0 2px 8px var(--shadow);
    height: calc(100vh - 92px);
    min-height: 0;
    border: 1px solid var(--border);
    position: relative;
}

main::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.view-container {
    display: none;
    height: 100%;
    padding: 16px;
    overflow-y: auto;
}

.view-container.active {
    display: block;
}

/* Month View */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.weekdays > div {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 0;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    height: calc(100% - 48px);
}

.calendar-day {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    min-height: 80px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--primary-color);
}

.calendar-day.other-month {
    opacity: 0.4;
}

.calendar-day.today {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
}

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

.day-number {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-item {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: var(--transition);
}

.event-item:hover {
    transform: translateX(2px);
}

/* Week & Day View */
.week-header,
.day-header {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    padding-bottom: 16px;
}

.time-label {
    width: 60px;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    flex: 1;
}

.week-content,
.day-content {
    display: flex;
    height: calc(100% - 60px);
    overflow-y: auto;
    position: relative;
}

.time-column {
    width: 60px;
    display: flex;
    flex-direction: column;
}

.time-slot {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.week-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    position: relative;
}

.day-events {
    position: relative;
    height: 1440px; /* 24 hours * 60px */
    border-left: 1px solid var(--border);
    flex: 0 0 auto;
    width: 100%;
}

.all-day-events-fixed {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

/* List View */
.list-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.export-btn {
    padding: 8px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.export-btn:hover {
    background: #475569;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-event-item {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    transition: var(--transition);
    cursor: pointer;
}

.list-event-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px var(--shadow);
}

.event-date-block {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    min-width: 60px;
}

.event-date-block .month {
    font-size: 12px;
    color: var(--text-muted);
}

.event-date-block .day {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.event-details {
    flex: 1;
}

.event-details h4 {
    margin-bottom: 4px;
    color: var(--text-primary);
}

.event-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Sidebar */
aside {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100vh - 92px);
    overflow-y: auto;
}

.mini-calendar,
.upcoming-events,
.legend {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    flex-shrink: 0;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.mini-calendar::after,
.upcoming-events::after,
.legend::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.mini-calendar {
    height: 240px;
}

.upcoming-events h3,
.legend h3 {
    margin-bottom: 16px;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    padding-bottom: 8px;
}

.upcoming-events h3::after,
.legend h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

#upcomingList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upcoming-event {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--background);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    margin-bottom: 8px;
}

.upcoming-event:hover {
    transform: translateX(4px);
    border-color: var(--border);
    box-shadow: 0 2px 4px var(--shadow);
}

.upcoming-date {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 16px;
    line-height: 1;
}

.upcoming-details {
    flex: 1;
}

.upcoming-details h5 {
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-weight: 500;
}

.upcoming-details p {
    font-size: 12px;
    color: var(--text-secondary);
}

#categoryLegend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--transition);
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.legend-item:hover {
    background: var(--background);
    border-color: var(--border);
    transform: translateX(2px);
}

.legend-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-hover);
}

.legend-item.active .legend-label {
    color: white;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.legend-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--background);
    margin: 10% auto;
    padding: 0;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px var(--shadow);
    animation: modalSlide 0.3s ease-out;
}

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

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

.modal-header h2 {
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

/* Event Colors */
.event-work { background: #3b82f6; color: white; }
.event-personal { background: #10b981; color: white; }
.event-meeting { background: #f59e0b; color: white; }
.event-holiday { background: #ef4444; color: white; }
.event-camp { background: #8b5cf6; color: white; }
.event-education { background: #06b6d4; color: white; }
.event-health { background: #ec4899; color: white; }
.event-social { background: #f97316; color: white; }

/* 手機版即將到來事件 - 默認隱藏 */
.mobile-upcoming {
    display: none;
}

/* Loader */
.loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

[data-theme="dark"] .loader {
    background: rgba(15, 23, 42, 0.9);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Week View Specific Styles */
.week-day-header {
    text-align: center;
    padding: 8px;
}

.week-day-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.week-day-date {
    font-size: 20px;
    font-weight: 600;
    margin-top: 4px;
}

.week-day-date.today {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px auto 0;
}

.week-day-column {
    position: relative;
    border-left: 1px solid var(--border);
    height: 1440px; /* 24 hours * 60px */
}

.hour-slot {
    height: 60px;
    border-bottom: 1px solid var(--border);
    pointer-events: none;
}

.week-event {
    position: absolute;
    left: 4px;
    right: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.week-event:hover {
    transform: scale(1.02);
    z-index: 10;
}

.event-time {
    font-weight: 600;
    font-size: 11px;
}

.event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Day View Specific Styles */
.day-event {
    position: absolute;
    left: 8px;
    right: 8px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.day-event:hover {
    transform: scale(1.02);
    z-index: 10;
}

.all-day-events {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.all-day-events h4 {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Mini Calendar */
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-top: 12px;
}

.mini-calendar h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-align: center;
}

.mini-weekday {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 0;
    font-weight: 500;
}

.mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 24px;
    position: relative;
    color: var(--text-primary);
}

.mini-day:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.mini-day.today {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.mini-day.selected {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
    font-weight: 600;
    border: 2px solid var(--primary-color);
}

.mini-day.today.selected {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-hover);
}

.mini-day.has-events {
    position: relative;
    font-weight: 500;
}

.mini-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 50%;
}

.mini-day.today.has-events::after {
    background: white;
}

.mini-day:hover.has-events::after {
    background: white;
}

/* Event Details Modal */
.event-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.event-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    align-self: flex-start;
}

.event-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.info-label {
    font-weight: 600;
    min-width: 100px;
    color: var(--text-secondary);
}

.event-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.event-actions {
    display: flex;
    gap: 12px;
}

.register-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}

.register-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* List View Specific */
.list-date-header {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text-primary);
}

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

.event-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.event-category {
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
}

.no-events {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .container {
        grid-template-areas: 
            "header"
            "main"
            "sidebar";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        padding: 12px;
    }
    
    main {
        height: auto;
        min-height: 60vh;
    }
    
    aside {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        height: auto;
        overflow: visible;
    }
    
    .mini-calendar,
    .upcoming-events,
    .legend {
        height: auto;
        min-height: 200px;
    }
}

@media (max-width: 992px) {
    .header-left h1 {
        font-size: 20px;
    }
    
    .search-container input {
        width: 150px;
    }
    
    aside {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .container {
        padding: 8px;
        gap: 8px;
        height: 100vh;
        grid-template-areas: 
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    /* 簡化標題 */
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        height: auto;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .header-left h1 {
        font-size: 18px;
        margin: 0;
    }
    
    .today-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* 顯示主題切換按鈕 */
    .header-right {
        display: flex;
    }
    
    .theme-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* 隱藏其他標題元素 */
    .header-center,
    .search-container,
    .filter-container,
    .view-controls {
        display: none;
    }
    
    /* 隱藏主要內容視圖 */
    main .view-container {
        display: none;
    }
    
    main {
        display: block;
        background: var(--background);
        height: calc(100vh - 80px);
        overflow: hidden;
    }
    
    /* 隱藏側邊欄 */
    aside {
        display: none;
    }
    
    /* 手機版只顯示即將到來的事件 */
    .mobile-upcoming {
        display: block !important;
        background: var(--surface);
        height: 100%;
        padding: 16px;
        overflow-y: auto;
        border: 2px solid red; /* 調試用邊框 */
    }
    
    .mobile-upcoming h3 {
        font-size: 20px;
        margin-bottom: 16px;
        color: var(--text-primary);
        font-weight: 600;
        text-align: center;
    }
    
    .mobile-upcoming-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .mobile-upcoming-event {
        display: flex;
        gap: 12px;
        padding: 16px;
        background: var(--surface);
        border-radius: var(--radius);
        cursor: pointer;
        transition: var(--transition);
        border: 1px solid var(--border);
        box-shadow: 0 2px 8px var(--shadow);
    }
    
    .mobile-upcoming-event:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px var(--shadow);
        border-color: var(--primary-color);
    }
    
    .mobile-upcoming-date {
        font-weight: 700;
        color: var(--primary-color);
        min-width: 45px;
        text-align: center;
        background: rgba(59, 130, 246, 0.1);
        border-radius: 8px;
        padding: 12px 6px;
        font-size: 16px;
        line-height: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .mobile-upcoming-details {
        flex: 1;
    }
    
    .mobile-upcoming-details h5 {
        font-size: 16px;
        margin-bottom: 4px;
        color: var(--text-primary);
        font-weight: 600;
    }
    
    .mobile-upcoming-details p {
        font-size: 14px;
        color: var(--text-secondary);
        margin-bottom: 2px;
    }
    
    .mobile-upcoming-details .event-category {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 12px;
        font-size: 12px;
        color: white;
        margin-top: 4px;
    }
    
    /* 模態視窗居中調整 */
    .modal-content {
        margin: 10% auto;
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
        position: relative;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .modal-header,
    .modal-body {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 4px;
        gap: 4px;
    }
    
    .header-left h1 {
        font-size: 16px;
    }
    
    .today-btn {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .search-container input {
        width: 100px;
    }
    
    .view-btn {
        padding: 3px 6px;
        font-size: 12px;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 2px;
    }
    
    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .event-item {
        font-size: 9px;
        padding: 1px 2px;
        margin-bottom: 1px;
    }
    
    .mini-calendar {
        height: 140px;
    }
    
    .mini-calendar h4 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .mini-day {
        font-size: 10px;
    }
    
    .upcoming-events h3,
    .legend h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .upcoming-event {
        padding: 8px;
        gap: 8px;
    }
    
    .upcoming-details h5 {
        font-size: 12px;
    }
    
    .upcoming-details p {
        font-size: 10px;
    }
    
    #currentPeriod {
        font-size: 14px;
        min-width: 120px;
    }
}