:root {
    --bg: #0b0d17;
    --panel: #151827;
    --border: #1f2435;
    --text: #e8eaed;
    --text-dim: #8b8fa3;
    --accent: #4da3ff;
    --accent-glow: rgba(77, 163, 255, 0.2);
    --today: #1a2e1a;
    --today-border: #2d6a2d;
}

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

body {
    background: linear-gradient(135deg, #0b0d17 0%, #1a1a2e 50%, #16213e 100%);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    min-height: 100vh;
}

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0; font-weight: 600; }

.meta { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 1.25rem; }

/* Search */
.search { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.search input {
    flex: 1; padding: 0.6rem 0.8rem; font-size: 0.95rem;
    background: var(--panel); border: 1px solid var(--border);
    color: var(--text); border-radius: 8px; outline: none;
    transition: border-color 0.2s;
}
.search input:focus { border-color: var(--accent); }
.search button {
    padding: 0.6rem 1.2rem; font-size: 0.95rem;
    background: var(--accent); border: none; color: #06121f;
    font-weight: 600; border-radius: 8px; cursor: pointer;
    transition: filter 0.2s;
}
.search button:hover { filter: brightness(1.15); }

/* Calendar Nav */
.cal-nav {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; margin-bottom: 0.75rem;
}
.nav-btn {
    color: var(--accent); text-decoration: none; font-size: 1.3rem;
    padding: 0.2rem 0.7rem; border: 1px solid var(--border);
    border-radius: 8px; transition: background 0.2s;
}
.nav-btn:hover { background: rgba(77, 163, 255, 0.1); }

/* Calendar Grid */
.calendar {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--border); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
}
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-header {
    background: var(--panel); font-size: 0.75rem;
    color: var(--text-dim); text-align: center; text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cal-header div { padding: 0.5rem 0; }

.cal-cell {
    background: var(--panel); min-height: 6rem; padding: 0.35rem;
    display: flex; flex-direction: column; gap: 0.2rem;
    transition: background 0.15s;
}
.cal-cell:hover { background: #1c2038; }
.cal-cell.other-month { opacity: 0.3; }
.cal-cell.today { background: var(--today); border: 1px solid var(--today-border); }
.cell-day { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.1rem; }

/* Event Bars */
.event {
    display: block; background: rgba(77, 163, 255, 0.12);
    color: var(--text); text-decoration: none;
    font-size: 0.7rem; padding: 0.2rem 0.35rem;
    border-radius: 4px; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer; transition: background 0.15s;
}
.event:hover { background: rgba(77, 163, 255, 0.22); }
.event-time { color: var(--accent); margin-right: 0.25rem; font-weight: 600; }
.event-badge { color: var(--text-dim); margin-left: 0.25rem; font-size: 0.65rem; }

/* === Modal === */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.visible { display: flex; animation: fadeIn 0.2s ease; }

.modal-card {
    background: linear-gradient(145deg, #181c2e 0%, #12152a 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px; width: 100%; max-width: 750px;
    max-height: 85vh; overflow-y: auto; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUp 0.25s ease;
}

.modal-close {
    position: absolute; top: 0.8rem; right: 1rem;
    background: none; border: none; color: var(--text-dim);
    font-size: 1.8rem; cursor: pointer; line-height: 1;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }

.modal-header {
    padding: 1.5rem 2rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-header h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.6rem; }

.modal-badges { display: flex; gap: 0.5rem; }
.badge {
    font-size: 0.75rem; padding: 0.25rem 0.7rem; border-radius: 20px;
    font-weight: 600; letter-spacing: 0.03em;
}
.badge-program { background: rgba(77,163,255,0.15); color: var(--accent); }
.badge-type { background: rgba(255,255,255,0.06); color: var(--text-dim); }

.modal-body { padding: 1.2rem 2rem; display: flex; flex-direction: column; gap: 1rem; }

.modal-row {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.95rem; color: var(--text);
}
.modal-icon { font-size: 1.1rem; }

.modal-section {
    background: rgba(0,0,0,0.2); padding: 1rem 1.2rem;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.04);
}
.modal-section h3 {
    font-size: 0.78rem; color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.06em; margin-bottom: 0.5rem; font-weight: 600;
}
.modal-section p { font-size: 0.92rem; line-height: 1.65; }
.thesis-text { font-style: italic; }

/* Toggle Full Info */
.toggle-full-btn {
    width: 100%; background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.12);
    color: var(--text-dim); padding: 0.6rem; border-radius: 8px;
    font-family: inherit; font-size: 0.85rem; font-weight: 500;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 0.4rem; transition: all 0.2s;
}
.toggle-full-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.toggle-arrow { transition: transform 0.25s; }

.full-info {
    display: flex; flex-direction: column; gap: 1rem;
    overflow: hidden; max-height: 2000px; opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}
.full-info.collapsed { max-height: 0; opacity: 0; pointer-events: none; }

/* Committee rows */
.committee-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.45rem 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9rem;
}
.committee-row:last-child { border-bottom: none; }
.cm-name { font-weight: 500; }
.cm-uni {
    font-size: 0.78rem; color: var(--text-dim);
    background: rgba(255,255,255,0.06); padding: 0.2rem 0.55rem;
    border-radius: 10px; white-space: nowrap;
}

.dim { color: var(--text-dim); }

.modal-footer {
    padding: 1rem 2rem 1.5rem; text-align: center;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.btn-primary {
    display: inline-block; background: var(--accent); color: #06121f;
    text-decoration: none; padding: 0.65rem 1.8rem; border-radius: 25px;
    font-weight: 600; font-size: 0.9rem; transition: all 0.2s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* Scrollbar */
.modal-card::-webkit-scrollbar { width: 6px; }
.modal-card::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

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

@media (max-width: 600px) {
    body { padding: 1rem 0.4rem; }
    .cal-cell { min-height: 4rem; padding: 0.2rem; }
    .cell-day { font-size: 0.7rem; }
    .event { font-size: 0.62rem; }
    .cal-header { font-size: 0.65rem; }
    .modal-card { max-width: 100%; }
    .modal-header, .modal-body, .modal-footer { padding-left: 1.2rem; padding-right: 1.2rem; }
}
