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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --occupied: #6c5ce7;
  --occupied-border: #a29bfe;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---- Controls ---- */
.controls {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.dropdown-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.dropdown-wrap label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-wrap input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  padding-right: 2.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.dropdown-wrap input[type="text"]:focus {
  border-color: var(--accent);
}
.dropdown-wrap input[type="text"]::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.input-wrapper input:not(:placeholder-shown) ~ .clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.clear-btn:hover {
  color: var(--accent);
  transform: translateY(-50%) scale(1.2);
}

.clear-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.clear-icon {
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1;
}

.dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  list-style: none;
}
.dropdown-list.open { display: block; }
.dropdown-list li {
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.1s;
}
.dropdown-list li:hover {
  background: var(--accent);
  color: #fff;
}

/* Scrollbar */
.dropdown-list::-webkit-scrollbar { width: 6px; }
.dropdown-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Schedule info ---- */
#schedule-info {
  margin: 1.25rem 0 0.75rem;
}
#schedule-title {
  font-size: 1.15rem;
  font-weight: 600;
}
.no-classes {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

/* ---- Calendar grid ---- */
.cal-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.cal-header {
  background: var(--surface);
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-time-col { min-width: 72px; }

.cal-time {
  background: var(--surface);
  padding: 0.3rem 0.5rem;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.cal-cell {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0.15rem 0.25rem;
  font-size: 0.78rem;
  transition: background 0.1s;
}
.cal-cell.empty {
  background: var(--bg);
}
.cal-cell.occupied {
  background: color-mix(in srgb, var(--occupied) 25%, var(--bg));
  border-left: 2px solid var(--occupied-border);
}
.cal-cell.occupied.start {
  background: color-mix(in srgb, var(--occupied) 35%, var(--bg));
}
.course-code {
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1.15;
  text-align: center;
  color: var(--accent-light);
}
.course-section {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
  header { padding: 1.25rem 0.75rem 0.75rem; }
  header h1 { font-size: 1.4rem; }
  .controls { flex-direction: column; }
  .dropdown-wrap { min-width: 0; }
  .cal-time { font-size: 0.65rem; min-width: 56px; padding: 0.2rem 0.35rem; }
  .cal-cell { min-height: 26px; font-size: 0.7rem; }
  .course-code { font-size: 0.68rem; }
  .cal-header { font-size: 0.7rem; padding: 0.4rem 0.25rem; }
}
