:root {
    --primary-color: #4A90E2;
    --text-color: #333;
    --light-text-color: #666;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --border-color: #dee2e6;
    --font-family: 'Inter', sans-serif;
}

/* ### NEW: Use CSS Grid for the main page layout ### */
html {
    height: 100%;
}
body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    
    /* Setup a grid that has a header and content that fills the rest */
    display: grid;
    grid-template-rows: auto 1fr; /* Header is auto-sized, content area (1fr) takes all remaining space */
    height: 100vh; /* Make the body fill the entire viewport height */
}

header {
    background-color: var(--surface-color);
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    grid-row: 1; /* Assign header to the first grid row */
}

header h1 {
    margin: 0;
    font-weight: 700;
    color: var(--primary-color);
}

/* The main container now fills the second grid row */
.container {
    grid-row: 2;
    display: flex;
    gap: 30px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Prevent overflow issues */
}

/* Make the calendar container and the calendar itself fill the height */
#calendar-container {
    flex: 3;
    min-width: 300px;
    height: 100%;
}
#calendar {
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    height: 100%;
    box-sizing: border-box;
}

/* Event list styles (unchanged) */
#event-list-container { flex: 1; background-color: var(--surface-color); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); min-width: 300px; height: fit-content; }
#event-list-container h2 { margin-top: 0; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; font-size: 1.2rem; }
#event-list { list-style: none; padding: 0; margin: 0; }
#event-list li { padding: 15px 10px; border-bottom: 1px solid var(--border-color); }
#event-list li:last-child { border-bottom: none; }
#event-list .event-title { font-weight: 500; display: block; }
#event-list .event-date { font-size: 0.9rem; color: var(--light-text-color); margin-top: 5px; display: block; }

/* Media Query for Mobile (unchanged) */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 10px;
        gap: 15px;
    }

    #calendar-container, #event-list-container {
        flex: none;
        width: 100%;
    }

    #event-list-container {
        display: none;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc .fc-toolbar .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        gap: 10px;
    }
}
