:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Base color system - Dark mode defaults */
  --bg-page: #0a0e17;
  --bg-card: #121826;
  --bg-card-hover: #182235;
  --bg-subtle: #1a2333;
  --bg-elevated: #1f2c42;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --warning: #f59e0b;
  --danger: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --nav-height: 64px;
  --bottom-nav-height: 68px;

  /* Week grid sizing */
  --hour-height: 60px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-subtle: #edf2f7;
  --bg-elevated: #e2e8f0;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 20px -3px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 14px 30px -4px rgba(0, 0, 0, 0.1);
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* App layout wrapper */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1300px;
  margin: 0 auto;
  padding: 18px 20px 80px 20px;
}

@media (max-width: 768px) {
  .app-container {
    padding: 14px 12px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 20px) 12px;
  }
}

/* ========================================================
   Header
   ======================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-page);
  backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.logo-badge svg {
  width: 24px;
  height: 24px;
}

.header-titles h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.header-titles .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  width: 260px;
  transition: all 0.2s ease;
  position: relative;
}

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

.search-box .search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  margin-right: 8px;
  flex-shrink: 0;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* View Switch buttons */
.view-switch-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.view-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-switch-btn svg {
  width: 15px;
  height: 15px;
}

.view-switch-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Icon button */
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

/* Theme switch icons */
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Mobile Search */
.mobile-search-bar {
  margin-bottom: 12px;
}

.mobile-search-bar .search-box {
  width: 100%;
}

/* ========================================================
   Live Status Banner
   ======================================================== */
.live-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.live-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  border-radius: 4px 0 0 4px;
}

.live-banner.status-ongoing::before { background: var(--success); }
.live-banner.status-ongoing { border-color: rgba(16, 185, 129, 0.3); background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.05)); }
.live-banner.status-none::before { background: var(--text-dim); }

.live-banner-content {
  flex: 1;
  min-width: 0;
}

.live-pulse-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulseDot 2s infinite ease-in-out;
}

.live-banner.status-ongoing .live-pulse-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.live-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-light);
}

.live-banner.status-ongoing .live-label {
  color: #34d399;
}

.live-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.live-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.live-badge {
  font-size: 0.775rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.time-badge {
  font-family: var(--font-mono);
  color: var(--primary-light);
}

.room-badge {
  color: #38bdf8;
}

.live-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  min-width: 90px;
  text-align: center;
  flex-shrink: 0;
}

.countdown-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-light);
  line-height: 1.1;
}

.countdown-caption {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ========================================================
   Day & Week Navigation Strip
   ======================================================== */
.day-navigation-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

/* Search Strip */
.search-strip {
  margin-bottom: 12px;
}

.search-strip .search-box {
  width: 100%;
  max-width: 100%;
}

.week-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.week-nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.icon-button-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.nav-arrow-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-arrow-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.nav-arrow-btn svg {
  width: 16px;
  height: 16px;
}

.current-week-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.today-jump-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--primary-light);
  font-size: 0.775rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.today-jump-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Day Pills list (Mobile & Desktop) */
.day-pills-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

@media (max-width: 600px) {
  .day-pills-container {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }
}

.day-pill-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-width: 52px;
  flex: 1;
}

.day-pill-btn:hover {
  background: var(--bg-card-hover);
}

.day-pill-weekday {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.day-pill-daynum {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.day-pill-dots {
  display: flex;
  gap: 2px;
  height: 4px;
  margin-top: 5px;
}

.pill-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary-light);
}

.day-pill-btn.is-today .day-pill-weekday {
  color: var(--primary-light);
}

.day-pill-btn.active {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.day-pill-btn.active .day-pill-weekday,
.day-pill-btn.active .day-pill-daynum {
  color: #ffffff;
}

.day-pill-btn.active .pill-dot {
  background: #ffffff;
}

/* ========================================================
   Owner Filter Switcher Strip (Tymofii vs Wera)
   ======================================================== */
.schedule-owner-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.owner-filter-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 3px;
  overflow-x: auto;
}

.owner-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.owner-pill-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.owner-pill-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.owner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-all { background: linear-gradient(135deg, #3b82f6, #ec4899); }
.dot-me { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }
.dot-friend { background: #ec4899; box-shadow: 0 0 6px rgba(236, 72, 153, 0.6); }

/* Owner Tags on event cards */
.event-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-owner-me {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-owner-friend {
  background: rgba(236, 72, 153, 0.18);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.35);
}

/* ========================================================
   Filter Chips
   ======================================================== */
.filter-chips-wrapper {
  margin-bottom: 16px;
  overflow: hidden;
}

.filter-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
}

.filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--bg-elevated);
  border-color: var(--border-focus);
  color: var(--text-main);
}

.chip-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========================================================
   Day View (Mobile & Day view mode)
   ======================================================== */
.day-header-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.day-header-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.day-header-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.day-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Event Card (Day view & Agenda view) */
.event-card {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

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

.event-card-color-stripe {
  width: 6px;
  flex-shrink: 0;
}

.event-card-body {
  padding: 14px 16px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.event-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
}

.event-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.event-card-time {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--primary-light);
}

.event-duration-tag {
  font-size: 0.725rem;
  color: var(--text-dim);
  font-family: var(--font-main);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
}

.event-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}

.meta-item.room-meta strong {
  color: #38bdf8;
  font-weight: 600;
}

.event-user-note-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.725rem;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
}

/* ========================================================
   Weekly Grid View (Desktop & Tablet)
   ======================================================== */
.week-grid-container {
  display: grid;
  grid-template-columns: 60px repeat(5, 1fr);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  position: relative;
  min-width: 800px;
}

.week-grid-header {
  display: contents;
}

.week-header-cell {
  background: var(--bg-subtle);
  padding: 12px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.week-header-cell.is-today {
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.1);
}

.week-header-dayname {
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

.week-time-col {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.week-time-slot {
  height: var(--hour-height);
  padding-right: 8px;
  text-align: right;
  font-size: 0.725rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  border-bottom: 1px dashed var(--border-subtle);
  box-sizing: border-box;
}

.week-day-col {
  border-right: 1px solid var(--border-subtle);
  position: relative;
  height: calc(14 * var(--hour-height)); /* 7:00 to 21:00 = 14 hours */
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(var(--hour-height) - 1px),
    var(--border-subtle) calc(var(--hour-height) - 1px),
    var(--border-subtle) var(--hour-height)
  );
}

.week-day-col:last-child {
  border-right: none;
}

/* Event block in Weekly Grid */
.week-grid-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: var(--radius-md);
  padding: 8px;
  overflow: hidden;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
  border-left: 4px solid var(--card-color, var(--primary));
  display: flex;
  flex-direction: column;
}

.week-grid-event:hover {
  transform: scale(1.02);
  z-index: 20;
  box-shadow: var(--shadow-md);
}

.week-grid-event-title {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 3px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.week-grid-event-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.9;
  margin-bottom: 2px;
}

.week-grid-event-room {
  font-weight: 600;
  color: #38bdf8;
  font-size: 0.7rem;
}

/* Current time indicator line on weekly grid */
.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 15;
  pointer-events: none;
}

.current-time-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

/* ========================================================
   Agenda View
   ======================================================== */
.agenda-day-group {
  margin-bottom: 20px;
}

.agenda-day-heading {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-day-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.agenda-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========================================================
   Empty State
   ======================================================== */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}

.empty-illustration {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto 16px auto;
}

/* ========================================================
   Mobile Bottom Navigation Bar
   ======================================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(18, 24, 38, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
}

[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.9);
}

.bottom-nav-item {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  flex: 1;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item.active {
  color: var(--primary-light);
}

.bottom-nav-item.active svg {
  stroke-width: 2.5;
}

/* ========================================================
   Modals & Bottom Sheet
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Bottom sheet variant on mobile */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content.bottom-sheet {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 100%;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-overlay.open .modal-content.bottom-sheet {
    transform: translateY(0);
  }

  .bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    margin: 10px auto 0 auto;
  }
}

.bottom-sheet-handle {
  display: none;
}

@media (max-width: 640px) {
  .bottom-sheet-handle {
    display: block;
  }
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}

.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.modal-header {
  padding: 24px 20px 14px 20px;
}

.subject-category-badge {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-glow);
  color: var(--primary-light);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
}

.modal-body {
  padding: 0 20px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

/* Comprehensive Location Card in Modal */
.detail-location-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-location-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.campus-badge {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.campus-badge.campus-ckd {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.campus-badge.campus-mazowiecka {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.25);
}

.location-extra-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.825rem;
}

.loc-info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loc-info-label {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-dim);
}

.loc-info-row strong,
.loc-info-row span:not(.loc-info-label) {
  color: var(--text-main);
  word-break: break-word;
}

.location-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-location-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-building-name {
  font-size: 0.775rem;
  color: #38bdf8;
  font-weight: 600;
}

.card-address-text {
  font-size: 0.725rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-icon svg {
  width: 20px;
  height: 20px;
}

.time-icon { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.room-icon { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.teacher-icon { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.detail-content {
  flex: 1;
  min-width: 0;
}

.detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.detail-subtext {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.copy-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.copy-action-btn svg {
  width: 14px;
  height: 14px;
}

.copy-action-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* User Notes area in modal */
.modal-notes-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-label svg {
  width: 15px;
  height: 15px;
}

#modal-user-notes {
  width: 100%;
  min-height: 80px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  outline: none;
}

#modal-user-notes:focus {
  border-color: var(--border-focus);
}

.notes-status {
  font-size: 0.725rem;
  color: var(--success);
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}

.notes-status.visible {
  opacity: 1;
}

/* Modal action buttons */
.modal-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

@media (max-width: 480px) {
  .modal-footer-actions {
    flex-direction: column;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  flex: 1;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

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

/* ========================================================
   Settings / Tabs Modal
   ======================================================== */
.standard-modal {
  max-width: 580px;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 16px 0 16px;
  gap: 6px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
  padding: 20px;
}

.tab-pane.active {
  display: block;
}

.settings-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.settings-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-icon {
  width: 32px;
  height: 32px;
  color: var(--primary-light);
  margin-bottom: 8px;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quick-ics-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.raw-ics-input {
  width: 100%;
  height: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-main);
  resize: vertical;
}

/* Radio groups */
.option-select-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.radio-label input {
  accent-color: var(--primary);
}

/* Subjects list in modal */
.subjects-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subject-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subject-item-info {
  flex: 1;
}

.subject-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subject-item-meta {
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* ========================================================
   Toast Notification
   ======================================================== */
.toast-notification {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (min-width: 769px) {
  .toast-notification {
    bottom: 24px;
  }
}

/* Responsive Visibility Helpers */
.desktop-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  
  .mobile-search-bar.mobile-only {
    display: block !important;
  }

  /* On mobile, default to Day view */
  .week-view {
    overflow-x: auto;
  }
}

/* ========================================================
   Print Stylesheet
   ======================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .mobile-bottom-nav,
  .day-navigation-strip,
  .filter-chips-wrapper,
  .live-banner,
  .search-box,
  .icon-button {
    display: none !important;
  }

  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .week-grid-container {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .week-header-cell,
  .week-time-col,
  .week-day-col {
    background: #fff !important;
    border-color: #ddd !important;
    color: #000 !important;
  }

  .week-grid-event {
    box-shadow: none !important;
    border: 1px solid #999 !important;
    background: #f4f4f4 !important;
  }

  .week-grid-event-title,
  .week-grid-event-time,
  .week-grid-event-room {
    color: #000000 !important;
  }
}
