/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-page: #ffffff;
  --bg-calendar: #ffffff;
  --bg-day: #ffffff;
  --bg-day-weekend: #f8f9fa;
  --bg-today: #e8f0fe;
  --border-light: #dadce0;
  --border-medium: #c4c7c5;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  
  /* Event colors - Google Calendar style */
  --event-meeting: #039be5;
  --event-paper: #0b8043;
  --event-review: #8e24aa;
  --event-routine: #616161;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #202124;
    --bg-calendar: #292a2d;
    --bg-day: #292a2d;
    --bg-day-weekend: #35363a;
    --bg-today: #1a3a52;
    --border-light: #5f6368;
    --border-medium: #5f6368;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #80868b;
  }
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--event-meeting);
  color: #ffffff;
}

::-moz-selection {
  background: var(--event-meeting);
  color: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== NAVIGATION ===== */
.nav-tabs {
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  padding: 0;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tab {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 1rem 2rem;
  font-weight: 500;
  font-size: 0.95rem;
  text-transform: none;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.tab.active {
  color: var(--event-meeting);
  border-bottom-color: var(--event-meeting);
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
  flex: 1;
}

/* ===== SCHEDULE HEADER ===== */
.schedule-header {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.schedule-header h1 {
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  text-transform: none;
  letter-spacing: normal;
}

.schedule-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 400;
}

/* ===== WEEK SECTION ===== */
.week-section {
  margin-bottom: 1.5rem;
  background: var(--bg-calendar);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.week-section h2,
.week-title {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-calendar);
  border-bottom: 1px solid var(--border-light);
}

/* ===== CALENDAR HEADER (Day names) ===== */
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--border-medium);
  border-right: 1px solid var(--border-medium);
  border-bottom: 2px solid var(--border-medium);
  background: var(--bg-day-weekend);
}

.day-name-cell {
  padding: 6px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-right: 1px solid var(--border-light);
}

.day-name-cell:last-child {
  border-right: none;
}

/* ===== WEEK GRID ===== */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  min-height: 150px;
}

/* ===== DAY CARD ===== */
.day-card {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-day);
  min-height: 80px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background-color 0.2s ease;
  min-width: 0;
  overflow: hidden;
}

.day-card:nth-child(7n) {
  border-right: none;
}

.day-card:hover {
  background-color: var(--bg-day-weekend);
}

/* Weekend styling - Sunday (1st) and Saturday (7th) */
.day-card:nth-child(7n+1),
.day-card:nth-child(7n) {
  background-color: var(--bg-day-weekend);
}

/* ===== DAY HEADER ===== */
.day-header {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-bottom: 4px;
  padding: 0;
  border: none;
  background: none;
}

.day-date {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.day-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  display: none;
}

/* ===== DAY EVENTS CONTAINER ===== */
.day-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

/* ===== EVENT CARDS (Google Calendar style bars) ===== */
.event-card,
.event-pill {
  display: block;
  padding: 3px 6px;
  margin-bottom: 2px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  color: #ffffff;
  border-left: none;
  box-shadow: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  cursor: pointer;
  line-height: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.event-card:hover,
.event-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.event-card h3 {
  font-size: 0.7rem;
  font-weight: 500;
  color: #ffffff;
  margin: 0;
  padding: 0;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card .event-desc {
  font-size: 0.55rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin: 1px 0 0 0;
  padding: 0;
  line-height: 1.2;
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.event-card time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.9);
  display: none; /* Hide time in compact view */
}

/* Event type colors */
.event-card.meeting {
  background-color: var(--event-meeting);
}

.event-card.paper {
  background-color: var(--event-paper);
}

.event-card.review {
  background-color: var(--event-review);
}

.event-pill.routine {
  background-color: var(--event-routine);
  color: #ffffff;
  border: none;
  text-align: center;
}

/* ===== EMPTY DAY ===== */
.empty-day {
  color: var(--border-light);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem 0;
  opacity: 0.3;
}

/* ===== BACKUP IDEAS PAGE ===== */
.content-page {
  background: var(--bg-calendar);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  max-width: 900px;
  margin: 0 auto;
}

.content-page h1 {
  color: var(--text-primary);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-light);
}

.content-page h2 {
  color: var(--event-meeting);
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-page h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content-page p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.content-page ul,
.content-page ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.content-page li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.content-page code {
  background: var(--bg-day-weekend);
  color: var(--event-meeting);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.content-page pre {
  background: var(--bg-day-weekend);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border-light);
}

.content-page pre code {
  background: none;
  padding: 0;
}

.content-page a {
  color: var(--event-meeting);
  text-decoration: none;
  transition: color 0.2s ease;
}

.content-page a:hover {
  color: var(--event-review);
  text-decoration: underline;
}

/* ===== FOOTER ===== */
footer {
  background: var(--bg-calendar);
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .week-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .calendar-header {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .day-name-cell:nth-child(n+5) {
    display: none;
  }
  
  .container {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .calendar-header {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .day-name-cell:nth-child(n+3) {
    display: none;
  }
  
  .schedule-header h1 {
    font-size: 1.5rem;
  }
  
  .day-date {
    font-size: 1.25rem;
  }
  
  .container {
    padding: 1rem;
  }
  
  .tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
