/* ============================================
   Campus Smart Hub v2 - Main Stylesheet
   한신대학교 보라색 테마 + 다크모드
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables (Light - 한신대 보라색 테마) --- */
:root {
  --color-bg: #f6f4fa;
  --color-surface: #ffffff;
  --color-surface-alt: #eee9f5;
  --color-border: #d8d0e5;
  --color-border-light: #ece7f3;
  --color-text: #1a1428;
  --color-text-secondary: #5e5470;
  --color-text-muted: #9089a0;

  --color-primary: #6b3fa0;
  --color-primary-light: #ede4f8;
  --color-primary-hover: #8252c0;
  --color-primary-glow: rgba(107, 63, 160, 0.15);

  --color-accent: #e05d44;
  --color-accent-light: #fdf0ed;

  --color-tag-haksa: #6b3fa0;
  --color-tag-janghak: #1a7a5c;
  --color-tag-gisuksa: #b8860b;
  --color-tag-chwieop: #c04080;
  --color-tag-default: #6b6b6b;

  /* Typography */
  --font-display: 'Outfit', 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', 'Outfit', sans-serif;

  /* Spacing */
  --nav-height: 64px;
  --container-max: 1120px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(80,40,120,0.04), 0 1px 2px rgba(80,40,120,0.06);
  --shadow-md: 0 4px 12px rgba(80,40,120,0.07), 0 1px 3px rgba(80,40,120,0.04);
  --shadow-lg: 0 8px 30px rgba(80,40,120,0.10);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light dark;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --color-bg: #110e1a;
  --color-surface: #1c1728;
  --color-surface-alt: #251e35;
  --color-border: #362c4e;
  --color-border-light: #2a2240;
  --color-text: #e8e2f0;
  --color-text-secondary: #a89cc0;
  --color-text-muted: #7a6e94;

  --color-primary: #a87ee0;
  --color-primary-light: #2a1e45;
  --color-primary-hover: #c09df0;
  --color-primary-glow: rgba(168, 126, 224, 0.15);

  --color-accent: #f07060;
  --color-accent-light: #2a1a18;

  --color-tag-haksa: #b88ee8;
  --color-tag-janghak: #5cc9a0;
  --color-tag-gisuksa: #e0c050;
  --color-tag-chwieop: #f070b0;
  --color-tag-default: #9089a0;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
}

[data-theme="dark"] .nav {
  background: rgba(17, 14, 26, 0.9);
}

[data-theme="dark"] .nav-links {
  background: var(--color-bg);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: var(--nav-height);
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea { font-family: inherit; font-size: inherit; }

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-bg);
  background: rgba(246, 244, 250, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border-light);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
  width: 100%;
  max-width: var(--container-max);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.nav-logo .logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--color-primary), #9060d0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Dark mode toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border-light);
  background: var(--color-surface);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
  color: var(--color-primary);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* --- Container --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px var(--color-primary-glow);
}

.btn-secondary {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border-light);
}

.btn-secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* --- Page Header --- */
.page-header {
  padding: 48px 0 32px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: 8px;
}

.page-header p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --- Notice Card --- */
.notice-card {
  position: relative;
  cursor: pointer;
}

.notice-card .notice-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.notice-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.category-학사 { background: var(--color-primary-light); color: var(--color-tag-haksa); }
.category-장학 { background: #e0f4ec; color: var(--color-tag-janghak); }
.category-기숙사 { background: #fdf5e0; color: var(--color-tag-gisuksa); }
.category-취업 { background: #fce4f0; color: var(--color-tag-chwieop); }
.category-default { background: var(--color-surface-alt); color: var(--color-tag-default); }
.category-혁신 { background: #e4e0f8; color: #6840b0; }

[data-theme="dark"] .category-장학 { background: #1a3028; }
[data-theme="dark"] .category-기숙사 { background: #2a2510; }
[data-theme="dark"] .category-취업 { background: #2a1520; }
[data-theme="dark"] .category-혁신 { background: #201835; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.notice-pin {
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.notice-dday {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.dday-urgent { background: #fde8e8; color: #c0392b; }
.dday-soon { background: #fef3e2; color: #e67e22; }
.dday-normal { background: var(--color-surface-alt); color: var(--color-text-secondary); }
.dday-passed { background: var(--color-surface-alt); color: var(--color-text-muted); }

[data-theme="dark"] .dday-urgent { background: #2a1010; color: #f08080; }
[data-theme="dark"] .dday-soon { background: #2a2010; color: #f0b040; }

.notice-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--color-text);
}

.notice-card .notice-summary {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notice-card .notice-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.notice-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.notice-actions { display: flex; gap: 6px; }

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
  background: var(--color-surface);
}

.btn-icon:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.btn-icon.bookmarked {
  color: #e67e22;
  background: #fef3e2;
  border-color: #fcd9a8;
}

.btn-icon.cal-added {
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-color: rgba(107, 63, 160, 0.3);
}

[data-theme="dark"] .btn-icon.bookmarked {
  background: #2a2010;
  border-color: #4a3520;
}

/* --- Notice Grid & Toolbar --- */
.notice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding-bottom: 60px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* --- Notice Detail Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-slow);
  border: 1px solid var(--color-border-light);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  padding-right: 40px;
}

.modal-body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

.modal-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.modal-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.modal-loading .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Ask Page --- */
.ask-container { max-width: 700px; margin: 0 auto; padding-bottom: 60px; }

.ask-input-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.ask-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.ask-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-glow);
}

.ask-submit {
  width: 52px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.ask-submit:hover {
  background: var(--color-primary-hover);
}

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.ask-suggestion-btn {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.ask-suggestion-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(107, 63, 160, 0.3);
}

.ask-results-title {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

/* --- Calendar --- */
.calendar-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
}

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

.calendar-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.calendar-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border-light);
}

.calendar-nav-btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-height: 56px;
}

.calendar-day:hover { background: var(--color-surface-alt); }
.calendar-day.other-month { color: var(--color-text-muted); opacity: 0.4; }
.calendar-day.today {
  background: var(--color-primary);
  color: white;
  font-weight: 700;
}
.calendar-day.today:hover { background: var(--color-primary-hover); }
.calendar-day.selected {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.calendar-day.has-event::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-top: 4px;
}

.calendar-day.today.has-event::after { background: white; }

/* Calendar event panel */
.event-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.event-panel h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.event-add-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
}

.event-add-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.event-list { list-style: none; }

.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--color-bg);
  transition: all var(--transition-fast);
}

.event-item:hover { background: var(--color-surface-alt); }

.event-item span { font-size: 0.9rem; font-weight: 500; }

.event-item .event-source {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: 8px;
  font-weight: 400;
}

.event-delete {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.event-delete:hover { background: #fde8e8; color: #c0392b; }

/* --- Academic Calendar Auto-Register --- */
.academic-calendar-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(107, 63, 160, 0.2);
}

.academic-calendar-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.academic-event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.academic-event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.academic-event-item .ae-title { font-weight: 500; flex: 1; }
.academic-event-item .ae-date { color: var(--color-text-muted); font-size: 0.8rem; margin: 0 12px; }
.academic-event-item .ae-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.academic-event-item .ae-btn.ae-add {
  background: var(--color-primary);
  color: white;
}
.academic-event-item .ae-btn.ae-add:hover { background: var(--color-primary-hover); }
.academic-event-item .ae-btn.ae-added {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  cursor: default;
}

/* --- Home Page --- */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 14px;
  color: var(--color-text);
  line-height: 1.2;
}

.hero h1 em {
  font-style: normal;
  color: var(--color-primary);
}

.hero p {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 500px;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-section { margin-bottom: 48px; }

/* Quick Links Grid */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
}

.quick-link-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-link-card .ql-icon { font-size: 1.6rem; }
.quick-link-card .ql-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.quick-link-card:hover .ql-label { color: var(--color-primary); }

/* Two column layout */
.home-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.home-mini-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.home-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-section-header a {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 500;
}

.home-section-header a:hover { text-decoration: underline; }

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state .empty-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p { font-size: 0.95rem; }

/* --- Bookmarks --- */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding-bottom: 60px;
}

/* --- Timetable Page --- */
.timetable-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-x: auto;
  margin-bottom: 32px;
}

.timetable {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.timetable th {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border-light);
  background: var(--color-bg);
}

.timetable td {
  padding: 0;
  border: 1px solid var(--color-border-light);
  height: 48px;
  vertical-align: top;
  position: relative;
  min-width: 100px;
}

.timetable td.time-col {
  width: 60px;
  min-width: 60px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  vertical-align: middle;
  padding: 4px;
  background: var(--color-bg);
}

.tt-cell {
  position: absolute;
  inset: 1px;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 1;
}

.tt-cell:hover {
  filter: brightness(0.95);
  transform: scale(1.02);
}

.tt-cell .tt-room {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}

.tt-colors-0 { background: #ede4f8; color: #5a309a; }
.tt-colors-1 { background: #e0f4ec; color: #1a6a4c; }
.tt-colors-2 { background: #fce4f0; color: #a03060; }
.tt-colors-3 { background: #e4eef8; color: #2060a0; }
.tt-colors-4 { background: #fef3e2; color: #a06020; }
.tt-colors-5 { background: #e0f0f0; color: #206060; }
.tt-colors-6 { background: #f8e4e4; color: #a03030; }
.tt-colors-7 { background: #e8e8f8; color: #4040a0; }

[data-theme="dark"] .tt-colors-0 { background: #2a1e45; color: #c8a8f0; }
[data-theme="dark"] .tt-colors-1 { background: #1a3028; color: #70d0a8; }
[data-theme="dark"] .tt-colors-2 { background: #2a1520; color: #f080b0; }
[data-theme="dark"] .tt-colors-3 { background: #152030; color: #80b0e0; }
[data-theme="dark"] .tt-colors-4 { background: #2a2010; color: #e0b060; }
[data-theme="dark"] .tt-colors-5 { background: #102828; color: #60c0c0; }
[data-theme="dark"] .tt-colors-6 { background: #2a1515; color: #f08080; }
[data-theme="dark"] .tt-colors-7 { background: #1a1a30; color: #a0a0e0; }

.timetable-add-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.timetable-add-form h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.tt-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.tt-form-group { display: flex; flex-direction: column; gap: 4px; }
.tt-form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.tt-form-group input,
.tt-form-group select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--color-bg);
  color: var(--color-text);
}
.tt-form-group input:focus,
.tt-form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* --- Shuttle Bus --- */
.shuttle-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.shuttle-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.shuttle-card-header {
  padding: 16px 20px;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shuttle-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.shuttle-card-header .shuttle-icon { font-size: 1.3rem; }

.shuttle-times {
  padding: 16px 20px;
}

.shuttle-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.88rem;
}

.shuttle-time-row:last-child { border-bottom: none; }

.shuttle-time-row .st-time { font-weight: 600; color: var(--color-primary); }
.shuttle-time-row .st-note { color: var(--color-text-muted); font-size: 0.8rem; }

.shuttle-time-row.next-bus {
  background: var(--color-primary-light);
  margin: 0 -20px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.shuttle-time-row.next-bus .st-badge {
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* --- Notification Banner --- */
.notif-banner {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 900;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-banner.show { transform: translateY(0); }

.notif-banner-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-primary);
  color: white;
  font-size: 0.88rem;
  font-weight: 500;
}

.notif-banner-inner .notif-close {
  margin-left: auto;
  color: white;
  opacity: 0.7;
  font-size: 1rem;
}
.notif-banner-inner .notif-close:hover { opacity: 1; }

/* --- Toast Notification --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--color-text);
  color: var(--color-bg);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--transition-slow), toastOut 0.3s 2.2s ease forwards;
  max-width: 340px;
}

@keyframes toastIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

/* --- Meal Page --- */
.meal-body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.meal-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

/* --- Footer --- */
.footer {
  margin-top: 60px;
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* --- Scroll fade-in animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.5s ease forwards;
}

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

.notice-grid .card:nth-child(1) { animation-delay: 0s; }
.notice-grid .card:nth-child(2) { animation-delay: 0.05s; }
.notice-grid .card:nth-child(3) { animation-delay: 0.1s; }
.notice-grid .card:nth-child(4) { animation-delay: 0.15s; }
.notice-grid .card:nth-child(5) { animation-delay: 0.2s; }
.notice-grid .card:nth-child(6) { animation-delay: 0.25s; }

/* --- Responsive --- */
@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border-light);
    flex-direction: column;
    padding: 12px 24px;
    gap: 4px;
    display: none;
    z-index: 999;
  }

  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 0.95rem; }
  .page-header h1 { font-size: 1.6rem; }

  .notice-grid,
  .bookmark-grid,
  .home-card-grid {
    grid-template-columns: 1fr;
  }

  .toolbar { flex-direction: column; align-items: stretch; }

  .calendar-day { min-height: 44px; font-size: 0.8rem; }
  .modal { padding: 24px; margin: 16px; }
  .event-add-form { flex-direction: column; }
  .shuttle-container { grid-template-columns: 1fr; }
  .tt-form-grid { grid-template-columns: 1fr; }
  .home-two-col { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .calendar-wrap { padding: 16px; }
  .event-panel { padding: 20px; }
}
