/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === Design Tokens (Dark Mode default) === */
:root {
  --bg:         #0f0f17;
  --surface:    #1a1a2e;
  --surface2:   #242438;
  --text:       #e2e2f0;
  --text-muted: #7a7a9a;
  --border:     rgba(255,255,255,0.08);
  --header-bg:  #12122a;
  --shadow:     0 4px 16px rgba(0,0,0,0.6);

  /* Event gradients */
  --axa-bg:      linear-gradient(160deg, #1565c0 0%, #1e88e5 100%);
  --mainframe-bg:linear-gradient(160deg, #6a1b9a 0%, #ab47bc 100%);
  --ctf-bg:      linear-gradient(160deg, #b71c1c 0%, #ef5350 100%);
  --ml-bg:       linear-gradient(160deg, #00695c 0%, #26a69a 100%);
  --ptp-bg:      linear-gradient(160deg, #2e7d32 0%, #66bb6a 100%);
  --webdev-bg:   linear-gradient(160deg, #283593 0%, #5c6bc0 100%);
  --erp-bg:      linear-gradient(160deg, #bf360c 0%, #ff7043 100%);
  --comnet-bg:   linear-gradient(160deg, #006064 0%, #26c6da 100%);
  --english-bg:  linear-gradient(160deg, #4a148c 0%, #ce93d8 100%);

  /* Time grid: 1.5 px per minute, 6:00–19:00 = 780 min */
  --scale:      1.5px;
  --day-height: 1170px;
}

/* Light mode — applied by JS via class when toggle is used or prefers-color-scheme:light */
:root.light {
  --bg:         #f0f0f8;
  --surface:    #ffffff;
  --surface2:   #e4e4f0;
  --text:       #1a1a2e;
  --text-muted: #5a5a7a;
  --border:     rgba(0,0,0,0.08);
  --header-bg:  #12122a;
  --shadow:     0 4px 16px rgba(0,0,0,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* === Header === */
header {
  background: var(--header-bg);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  position: sticky;
  top: 0;
  z-index: 200;
}

header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #e0e0f4;
  letter-spacing: 0.04em;
}

.theme-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 1rem;
  cursor: pointer;
  color: #e0e0f4;
  transition: background 0.2s;
}
.theme-btn:hover { background: rgba(255,255,255,0.2); }

/* === DESKTOP SCHEDULE === */
.desktop-schedule {
  padding: 1.25rem 1.5rem 2rem;
  overflow-x: auto;
}

/* Grid: time-axis col + 5 day cols */
.day-headers,
.schedule-body {
  display: grid;
  grid-template-columns: 52px repeat(5, 1fr);
  min-width: 580px;
  gap: 0 6px;
  position: sticky;
}

.day-headers {
  margin-bottom: 6px;
}

.day-header-cell {
  background: var(--surface2);
  text-align: center;
  padding: 0.5rem 0.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  letter-spacing: 0.03em;
}

/* Time axis */
.time-axis {
  position: relative;
  height: var(--day-height);
  flex-shrink: 0;
}

.time-label {
  position: absolute;
  right: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  transform: translateY(-50%);
  white-space: nowrap;
  user-select: none;
}

/* Day track (content column) */
.day-track {
  position: relative;
  height: var(--day-height);
  background: var(--surface);
  border-radius: 8px;
  /* Subtle hour lines every 90px (= 60 min × 1.5px) */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(90px - 1px),
    var(--border) calc(90px - 1px),
    var(--border) 90px
  );
  overflow: hidden;
}

/* Event block */
.event {
  position: absolute;
  left: 5px;
  right: 5px;
  border-radius: 7px;
  padding: 6px 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}
.event:hover {
  transform: scale(1.025);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  z-index: 10;
}

.event-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  position: sticky;
}
.event-time {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.78);
  margin-top: 2px;
  position: sticky;
}

/* === Event colour classes === */
.ev-axa      { background: var(--axa-bg); }
.ev-mainframe{ background: var(--mainframe-bg); }
.ev-ctf      { background: var(--ctf-bg); }
.ev-ml       { background: var(--ml-bg); }
.ev-ptp      { background: var(--ptp-bg); }
.ev-webdev   { background: var(--webdev-bg); }
.ev-erp      { background: var(--erp-bg); }
.ev-comnet   { background: var(--comnet-bg); }
.ev-english  { background: var(--english-bg); }

/* === MOBILE SCHEDULE === */
.mobile-schedule {
  display: none;
  padding: 1rem;
  flex-direction: column;
  gap: 0.85rem;
}

.day-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.day-card-header {
  background: var(--surface2);
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.event-list {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.85rem;
  border-radius: 9px;
}

.time-badge {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  min-width: 100px;
  font-feature-settings: "tnum";
}

.subject {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

/* === Responsive breakpoint === */
@media screen and (max-width: 768px) {
  .desktop-schedule { display: none; }
  .mobile-schedule  { display: flex; }
}
