@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Courier+Prime:wght@400;700&display=swap');

:root {
    /* Icy Horror Theme: 1950s Endicott Preparatory */
    --bg-color: #020408;
    --bg-secondary: #0a0f16;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --border-color: rgba(59, 130, 246, 0.2);

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Courier Prime', monospace;

    /* Glassmorphism */
    --glass-bg: rgba(2, 4, 8, 0.85);
    --glass-border: rgba(59, 130, 246, 0.15);
    --glass-blur: 12px;
    --glass-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");

    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes text-pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.1));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.4));
    }
}

@keyframes bg-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.05);
        opacity: 0.4;
    }
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
    z-index: -1;
    animation: bg-pulse 15s ease-in-out infinite alternate;
    pointer-events: none;
}

.calendar-container {
    width: 100%;
    max-width: 1100px;
    background: linear-gradient(rgba(2, 4, 8, 0.6), rgba(2, 4, 8, 0.6)), var(--glass-noise);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* Header */
header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.current-date-display {
    text-align: right;
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.7;
}

.current-date-display strong {
    color: var(--accent-color);
    font-weight: 700;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#month-year-header {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
}

.today-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.today-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Weekdays Grid */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    color: var(--accent-color);
    font-family: var(--font-heading);
    /* Fancy font for days */
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    /* Gap for border effect if using background color on container, but we'll use borders on cells */
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    /* Very faint grid bg */
}

.day {
    background: rgba(10, 15, 22, 0.4);
    height: 150px;
    /* Fixed height */
    padding: 8px;
    position: relative;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
    /* Hide overflow events */
}

.day:hover {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

.day.other-month {
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.5;
    cursor: default;
}

.day-number {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    font-family: var(--font-body);
    display: block;
    margin-bottom: 6px;
}

/* Current Day Highlight */
.day.current-day {
    background: rgba(59, 130, 246, 0.05);
    box-shadow: inset 0 0 0 1px var(--accent-color);
}

.day.current-day .day-number {
    color: var(--accent-color);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Events */
.events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-item {
    font-size: 0.7rem;
    padding: 3px 6px;
    margin-bottom: 3px;
    border-radius: 2px;
    color: #ffffff;
    background: rgba(59, 130, 246, 0.25);
    border-left: 2px solid var(--accent-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.event-item:hover {
    background: rgba(59, 130, 246, 0.4);
    z-index: 2;
    position: relative;
}

/* Multi-day Event Bars */
.event-bar-start {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -9px;
    /* Extend to edge */
    padding-right: 2px;
}

.event-bar-middle {
    border-radius: 0;
    margin-left: -9px;
    margin-right: -9px;
    border-left: none;
    /* Continuity look */
    background: rgba(59, 130, 246, 0.25);
}

.event-bar-end {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -9px;
    border-left: none;
}

.event-bar-continuation {
    color: transparent;
    /* Hide text on continuation days */
}

/* Specific styling for 'Sessions' vs 'Events' if needed */
.session-item {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

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

.modal-content {
    background: linear-gradient(rgba(10, 15, 22, 0.95), rgba(10, 15, 22, 0.95)), var(--glass-noise);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.15);
    position: relative;
    animation: slide-up-fade 0.3s ease-out;
}

@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    color: var(--text-secondary);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

#modal-date {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

#modal-body ul {
    list-style: none;
    padding: 0;
}

#modal-body li {
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--accent-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#modal-body li.session-item {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    font-style: italic;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}