/* ============================================
   College Tour Road Trip — Mobile-First Styles
   ============================================ */

/* --- CSS Custom Properties (Light Theme) --- */
:root,
[data-theme="light"] {
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --card-border: #e0e0e0;
  --text: #1a1a2e;
  --text-secondary: #555;
  --accent: #1a73e8;
  --accent-light: #e8f0fe;
  --highlight-bg: #fff8e1;
  --highlight-border: #ffd54f;
  --drive-bg: #e8f5e9;
  --drive-border: #66bb6a;
  --badge-bg: #1a73e8;
  --badge-text: #fff;
  --header-bg: #1a73e8;
  --header-text: #fff;
  --timeline-line: #ccc;
  --timeline-dot: #1a73e8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  --link-color: #1a73e8;
  --poi-bg: #f8f9fa;
  --chevron-color: #888;
  --divider: #e0e0e0;
  --footer-bg: #f0f2f5;
  --footer-text: #888;
  --toggle-bg: rgba(255, 255, 255, 0.2);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
  --bg: #121212;
  --card-bg: #1e1e1e;
  --card-border: #333;
  --text: #e0e0e0;
  --text-secondary: #aaa;
  --accent: #8ab4f8;
  --accent-light: #1e3a5f;
  --highlight-bg: #2e2a1a;
  --highlight-border: #b8960c;
  --drive-bg: #1a2e1a;
  --drive-border: #4caf50;
  --badge-bg: #8ab4f8;
  --badge-text: #121212;
  --header-bg: #1a1a2e;
  --header-text: #e0e0e0;
  --timeline-line: #444;
  --timeline-dot: #8ab4f8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
  --link-color: #8ab4f8;
  --poi-bg: #252525;
  --chevron-color: #888;
  --divider: #333;
  --footer-bg: #121212;
  --footer-text: #666;
  --toggle-bg: rgba(255, 255, 255, 0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

ul {
  list-style: none;
}

/* --- Header --- */
header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

.header-left h1 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.subtitle {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}

/* Theme Toggle */
#theme-toggle {
  background: var(--toggle-bg);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon {
  display: inline;
}

/* --- Main --- */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem 0.75rem 2rem;
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

/* --- Quick Reference --- */
.quick-ref .ref-block {
  border-bottom: 1px solid var(--divider);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.quick-ref .ref-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.conf {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.conf strong {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  background: var(--accent-light);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.flight {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.flight-leg {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.flight-label {
  font-weight: 600;
  font-size: 0.88rem;
}

.flight-detail {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-left: 0.5rem;
}

.hotel-summary p {
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.ref-block p {
  font-size: 0.88rem;
}

/* --- Day Cards --- */
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.day-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.day-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

.day-title h2 {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.day-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.chevron {
  font-size: 1.2rem;
  color: var(--chevron-color);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.day-header[aria-expanded="false"] .chevron {
  transform: rotate(-90deg);
}

.day-content {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 3000px;
  opacity: 1;
}

.day-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
}

.day-content:not(.collapsed) {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--divider);
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 2px;
  background: var(--timeline-line);
}

.timeline-item {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.85rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--timeline-dot);
  border: 2px solid var(--card-bg);
  z-index: 1;
}

.timeline-item.highlight {
  background: var(--highlight-bg);
  border-left: 3px solid var(--highlight-border);
  border-radius: 0 8px 8px 0;
  margin-left: -1rem;
  padding-left: 2.25rem;
  margin-right: -0.25rem;
}

.timeline-item.highlight::before {
  left: calc(1rem - 5px);
  background: var(--highlight-border);
}

.timeline-item.drive {
  background: var(--drive-bg);
  border-left: 3px solid var(--drive-border);
  border-radius: 0 8px 8px 0;
  margin-left: -1rem;
  padding-left: 2.25rem;
  margin-right: -0.25rem;
}

.timeline-item.drive::before {
  left: calc(1rem - 5px);
  background: var(--drive-border);
}

.time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 68px;
  padding-top: 0.15rem;
}

.event {
  flex: 1;
}

.event strong {
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.15rem;
}

.event .note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.event .note a {
  font-size: 0.82rem;
}

.maps-link {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

/* --- POI Section --- */
.poi-section {
  background: var(--poi-bg);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.poi-section h3 {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.poi-group {
  margin-bottom: 0.75rem;
}

.poi-group:last-child {
  margin-bottom: 0;
}

.poi-group h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.poi-group ul li {
  font-size: 0.82rem;
  padding: 0.25rem 0;
  padding-left: 0.75rem;
  position: relative;
  color: var(--text-secondary);
}

.poi-group ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.poi-group ul li a {
  font-weight: 500;
}

/* --- Links Card --- */
.link-group {
  margin-bottom: 0.75rem;
}

.link-group:last-child {
  margin-bottom: 0;
}

.link-group h3 {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.link-group ul li {
  font-size: 0.85rem;
  padding: 0.3rem 0;
  padding-left: 0.75rem;
  position: relative;
}

.link-group ul li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* --- Tips Card --- */
.tips-card ul li {
  font-size: 0.85rem;
  padding: 0.4rem 0;
  padding-left: 0.75rem;
  position: relative;
  border-bottom: 1px solid var(--divider);
}

.tips-card ul li:last-child {
  border-bottom: none;
}

.tips-card ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* --- Footer --- */
footer {
  background: var(--footer-bg);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--footer-text);
  border-top: 1px solid var(--divider);
  transition: background 0.3s ease;
}

.offline-status {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-style: italic;
}

/* --- Responsive / Tablet+ --- */
@media (min-width: 640px) {
  main {
    padding: 1.5rem 1rem 3rem;
  }
  .card {
    padding: 1.5rem;
  }
  .header-left h1 {
    font-size: 1.4rem;
  }
}

/* --- Print --- */
@media print {
  header {
    position: static;
    box-shadow: none;
  }
  #theme-toggle {
    display: none;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  .day-content.collapsed {
    max-height: none;
    opacity: 1;
  }
  .chevron {
    display: none;
  }
  footer {
    display: none;
  }
}
