/**
 * Stundenplan PWA – Apple Liquid Glass Design System
 * ===================================================
 * Inspired by Apple's Liquid Glass UI from iOS 26 / macOS Tahoe.
 * Uses backdrop-filter, SVG displacement filters, and animated gradients
 * to create a refractive, translucent glass aesthetic.
 *
 * [TAURI NOTE] All CSS is vanilla – no build tools required.
 * Works out of the box in Tauri's WebView.
 */

/* ==============================
   CSS CUSTOM PROPERTIES (TOKENS)
   ============================== */
:root {
  /* — Color Palette — */
  --color-bg-start: #0a0618;
  --color-bg-mid: #120b2e;
  --color-bg-end: #0d1f3c;

  /* Glass surface colors */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-hover: rgba(255, 255, 255, 0.12);
  --glass-bg-active: rgba(255, 255, 255, 0.16);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-border-bright: rgba(255, 255, 255, 0.25);
  --glass-shadow: rgba(0, 0, 0, 0.3);

  /* Accent colors */
  --accent-purple: #a855f7;
  --accent-blue: #3b82f6;
  --accent-teal: #06b6d4;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;

  /* Text colors */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-tertiary: rgba(255, 255, 255, 0.4);
  --text-on-accent: #ffffff;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Glass blur */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 24px;
  --blur-xl: 40px;

  /* Subject colors (translucent) */
  --subject-mathe: rgba(168, 85, 247, 0.25);
  --subject-deutsch: rgba(59, 130, 246, 0.25);
  --subject-englisch: rgba(6, 182, 212, 0.25);
  --subject-physik: rgba(249, 115, 22, 0.25);
  --subject-chemie: rgba(16, 185, 129, 0.25);
  --subject-biologie: rgba(34, 197, 94, 0.25);
  --subject-geschichte: rgba(234, 179, 8, 0.25);
  --subject-sport: rgba(239, 68, 68, 0.25);
  --subject-kunst: rgba(236, 72, 153, 0.25);
  --subject-musik: rgba(139, 92, 246, 0.25);
  --subject-default: rgba(148, 163, 184, 0.2);

  /* Break styling */
  --break-bg: rgba(255, 255, 255, 0.03);
  --break-border: rgba(255, 255, 255, 0.08);
  --break-text: rgba(255, 255, 255, 0.35);
}


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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--color-bg-start);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ==============================
   ANIMATED BACKGROUND
   ============================== */
/* 
 * The background uses multiple layered gradients that animate
 * to create a living, breathing canvas behind the glass UI.
 */
.app-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 80%, rgba(168, 85, 247, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(59, 130, 246, 0.25) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 90% 70% at 70% 90%, rgba(236, 72, 153, 0.12) 0%, transparent 50%),
    linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-mid) 50%, var(--color-bg-end) 100%);
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(15deg) brightness(1.05); }
  100% { filter: hue-rotate(-10deg) brightness(0.95); }
}

/* Floating orbs for extra depth */
.app-background::before,
.app-background::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 15s ease-in-out infinite;
}

.app-background::before {
  width: 400px;
  height: 400px;
  background: rgba(168, 85, 247, 0.2);
  top: -100px;
  right: -100px;
  animation-delay: -5s;
}

.app-background::after {
  width: 500px;
  height: 500px;
  background: rgba(6, 182, 212, 0.15);
  bottom: -150px;
  left: -150px;
  animation-duration: 18s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}


/* ==============================
   LIQUID GLASS SURFACES
   ============================== */
/*
 * Core glass card component. Uses backdrop-filter for blur
 * and SVG displacement for the liquid refraction effect.
 */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-lg)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(1.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 8px 32px var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  transition: 
    background var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-normal);
}

/* Specular highlight – simulates light on glass surface */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 1;
}

.glass:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-bright);
  box-shadow: 
    0 12px 40px var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Elevated glass variant (for modals, admin panel) */
.glass-elevated {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(var(--blur-xl)) saturate(1.8);
  -webkit-backdrop-filter: blur(var(--blur-xl)) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 16px 64px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Subtle glass (for inline elements, table cells) */
.glass-subtle {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(var(--blur-sm)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur-sm)) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}


/* ==============================
   TYPOGRAPHY
   ============================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.text-display {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-purple) 50%, var(--accent-teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
}

.text-subtitle {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.text-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.text-caption {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}


/* ==============================
   LAYOUT
   ============================== */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  min-height: 100dvh;
}

.section {
  margin-bottom: var(--space-lg);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.flex-between {
  justify-content: space-between;
  align-items: center;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }


/* ==============================
   LOGIN / PASSWORD SCREEN
   ============================== */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
}

.login-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue), var(--accent-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 32px rgba(168, 85, 247, 0.3);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(168, 85, 247, 0.3); }
  50% { box-shadow: 0 8px 48px rgba(168, 85, 247, 0.5); }
}

.login-title {
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  margin-bottom: var(--space-xl);
}

.login-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  margin-top: var(--space-sm);
  opacity: 0;
  transform: translateY(-5px);
  transition: all var(--transition-normal);
}

.login-error.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ==============================
   FORM ELEMENTS
   ============================== */
.input-group {
  position: relative;
  margin-bottom: var(--space-md);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

input::placeholder {
  color: var(--text-tertiary);
}

select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select option {
  background: #1a1030;
  color: var(--text-primary);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

textarea {
  resize: vertical;
  min-height: 80px;
}


/* ==============================
   BUTTONS
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: var(--text-on-accent);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-bright);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: var(--text-on-accent);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}


/* ==============================
   HEADER / TOP BAR
   ============================== */
.app-header {
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: default;
  user-select: none;
  /* Triple-tap target for admin access */
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.week-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.week-a {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--accent-purple);
}

#class-badge {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: var(--accent-pink);
}

.week-b {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-teal);
}

.online-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.online-indicator.offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: offlinePulse 2s ease-in-out infinite;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* ==============================
   DAY TABS / NAVIGATION
   ============================== */
.day-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.day-tabs::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex: 1;
  min-width: 60px;
  padding: 10px 6px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
  position: relative;
  outline: none;
}

.day-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.day-tab.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(59, 130, 246, 0.15));
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2);
}

.day-tab.today {
  position: relative;
}

.day-tab.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-teal);
}

.day-tab-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}


/* ==============================
   TIMETABLE GRID
   ============================== */
.timetable-day {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  animation: fadeSlideIn 0.3s ease-out;
}

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

/* Individual period/class row */
.period-card {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-normal);
  position: relative;
  min-height: 64px;
}

.period-card:hover {
  transform: translateX(4px);
}

/* Period time column */
.period-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  min-width: 70px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.period-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.period-time-text {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
}

/* Period content (subject, teacher, room) */
.period-content {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.period-info {
  flex: 1;
  min-width: 0;
}

.period-subject {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.period-details {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.period-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.period-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* Subject color indicator */
.subject-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* A/B week indicator on period */
.week-indicator {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-indicator-a {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.week-indicator-b {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-teal);
  border: 1px solid rgba(6, 182, 212, 0.3);
}


/* ==============================
   DOUBLE-PERIOD (BLOCK) STYLING
   ============================== */
.period-card.block-2 {
  min-height: 100px;
}

.period-card.block-2 .period-number {
  font-size: 0.9rem;
}

.block-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-tertiary);
  white-space: nowrap;
}


/* ==============================
   CURRENT PERIOD HIGHLIGHT
   ============================== */
.period-card.current {
  border: 1px solid rgba(168, 85, 247, 0.4) !important;
  box-shadow: 
    0 0 20px rgba(168, 85, 247, 0.15),
    inset 0 0 20px rgba(168, 85, 247, 0.05);
  animation: currentGlow 3s ease-in-out infinite;
}

@keyframes currentGlow {
  0%, 100% { 
    box-shadow: 
      0 0 20px rgba(168, 85, 247, 0.15),
      inset 0 0 20px rgba(168, 85, 247, 0.05);
  }
  50% { 
    box-shadow: 
      0 0 30px rgba(168, 85, 247, 0.25),
      inset 0 0 30px rgba(168, 85, 247, 0.08);
  }
}

/* Progress bar inside current period */
.period-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-teal));
  border-radius: 0 3px 0 0;
  transition: width 1s linear;
  z-index: 2;
}

/* "Jetzt" / "Now" badge */
.now-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  animation: nowPulse 2s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes nowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}


/* ==============================
   BREAK ROWS
   ============================== */
.break-card {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--break-bg);
  border: 1px dashed var(--break-border);
  border-radius: var(--radius-sm);
  min-height: 36px;
  gap: var(--space-md);
}

.break-card .period-time {
  background: transparent;
  border-right: 1px dashed rgba(255, 255, 255, 0.06);
  min-width: 70px;
  padding: var(--space-xs) var(--space-md);
}

.break-label {
  font-size: 0.75rem;
  color: var(--break-text);
  font-weight: 500;
  font-style: italic;
  flex: 1;
}

.break-duration {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
}

.break-card.current {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.break-card.current .break-label {
  color: var(--accent-green);
}


/* ==============================
   OVERRIDE / REPLACEMENT MARKERS
   ============================== */
.period-card.replaced {
  border-left: 3px solid var(--accent-orange) !important;
}

.period-card.cancelled {
  border-left: 3px solid var(--accent-red) !important;
  opacity: 0.6;
}

.period-card.event {
  border-left: 3px solid var(--accent-teal) !important;
}

.override-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.override-badge.replacement {
  background: rgba(249, 115, 22, 0.2);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.override-badge.cancellation {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.override-badge.event-badge {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-teal);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.original-subject {
  text-decoration: line-through;
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.override-note {
  font-size: 0.72rem;
  color: var(--accent-orange);
  font-style: italic;
}


/* ==============================
   EMPTY STATE
   ============================== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
  font-weight: 500;
}


/* ==============================
   CURRENT TIME / DATE INFO BAR
   ============================== */
.info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.info-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
}

.info-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.current-time-display {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.next-period-info {
  font-size: 0.78rem;
  color: var(--text-secondary);
}


/* ==============================
   ADMIN & SUBSTITUTE PANELS
   ============================== */
#admin-panel,
#substitute-panel {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#admin-panel.active,
#substitute-panel.active {
  display: flex;
}

.admin-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#substitute-panel .admin-header {
  border-bottom: 1px solid rgba(16, 185, 129, 0.3);
}
#substitute-panel .admin-header h2 {
  color: var(--accent-green);
}

.admin-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto;
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: adminSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes adminSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-header h2 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.admin-body::-webkit-scrollbar {
  width: 6px;
}

.admin-body::-webkit-scrollbar-track {
  background: transparent;
}

.admin-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  padding: var(--space-xs);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: wrap;
}

.admin-tab {
  flex: 1;
  min-width: fit-content;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  outline: none;
}

.admin-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.admin-tab.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(59, 130, 246, 0.2));
  color: var(--text-primary);
}

.admin-section {
  display: none;
  animation: fadeSlideIn 0.25s ease-out;
}

.admin-section.active {
  display: block;
}

/* Admin form groups */
.admin-form-group {
  margin-bottom: var(--space-lg);
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 500px) {
  .admin-form-row {
    grid-template-columns: 1fr;
  }
}

/* Admin timetable editor grid */
.admin-period-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.admin-period-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

.admin-period-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.admin-period-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 30px;
  text-align: center;
}

.admin-period-fields {
  flex: 1;
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.admin-period-fields select,
.admin-period-fields input {
  padding: 8px 12px;
  font-size: 0.82rem;
  min-width: 0;
}

.admin-period-fields select {
  flex: 2;
  min-width: 100px;
}

.admin-period-fields input[type="text"] {
  flex: 1;
  min-width: 60px;
}

.admin-period-actions {
  display: flex;
  gap: var(--space-xs);
}

/* Admin color picker */
.color-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

/* Override list in admin */
.override-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.override-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.override-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* Subject chip in admin */
.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.subject-chip .subject-dot {
  width: 8px;
  height: 8px;
}


/* ==============================
   ADMIN LOGIN (separate from main)
   ============================== */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-md);
}

.admin-login-overlay.active {
  display: flex;
}

.admin-login-card {
  max-width: 340px;
  width: 100%;
  padding: var(--space-xl);
  text-align: center;
}


/* ==============================
   TOGGLE SWITCH
   ============================== */
.toggle-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all var(--transition-normal);
}

.toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-color: transparent;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-spring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.toggle input:checked ~ .toggle-knob {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}


/* ==============================
   CHIP / TAG SELECTORS
   ============================== */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
  font-family: inherit;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.chip.selected {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(59, 130, 246, 0.15));
  border-color: rgba(168, 85, 247, 0.4);
  color: var(--text-primary);
}


/* ==============================
   TOAST / NOTIFICATION
   ============================== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-md);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.success {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.toast.error {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.toast.info {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-blue);
}

.toast-exit {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
}


/* ==============================
   DIALOG / MODAL
   ============================== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: var(--space-md);
}

.dialog-overlay.active {
  display: flex;
}

.dialog {
  max-width: 480px;
  width: 100%;
  padding: var(--space-xl);
  animation: adminSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dialog h3 {
  margin-bottom: var(--space-md);
}

.dialog-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}


/* ==============================
   RESPONSIVE DESIGN
   ============================== */
@media (max-width: 600px) {
  .app-container {
    padding: var(--space-sm);
  }

  .period-card {
    min-height: 56px;
  }

  .period-time {
    min-width: 55px;
    padding: var(--space-xs) var(--space-sm);
  }

  .period-content {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-sm);
  }

  .period-subject {
    font-size: 0.88rem;
  }

  .period-details {
    font-size: 0.72rem;
    gap: var(--space-sm);
  }

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

  .admin-container {
    max-height: 95vh;
    max-height: 95dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: auto;
    margin-bottom: 0;
  }

  .admin-header {
    padding: var(--space-md);
  }

  .admin-body {
    padding: var(--space-md);
  }

  .admin-form-row {
    grid-template-columns: 1fr;
  }

  .admin-period-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .login-card {
    padding: var(--space-xl) var(--space-lg);
  }
}

@media (min-width: 768px) {
  .app-container {
    padding: var(--space-xl);
  }

  .day-tabs {
    gap: var(--space-sm);
  }

  .day-tab {
    padding: 12px 8px;
    font-size: 0.85rem;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .login-card {
    padding: var(--space-md);
  }

  .login-icon {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    margin-bottom: var(--space-sm);
  }
}


/* ==============================
   PWA INSTALL PROMPT
   ============================== */
.install-prompt {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  z-index: 800;
  display: none;
  align-items: center;
  gap: var(--space-md);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 500;
}

.install-prompt.visible {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.install-prompt .btn-small {
  padding: 6px 12px;
}

.install-dismiss {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
}


/* ==============================
   SCROLLBAR STYLING
   ============================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* ==============================
   UTILITY: HIDDEN / VIEW TOGGLE
   ============================== */
.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Fade transition for views */
.fade-enter {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Week view full grid (desktop) */
.week-grid {
  display: none;
}

@media (min-width: 900px) {
  .week-grid {
    display: grid;
    grid-template-columns: auto repeat(5, 1fr);
    gap: 2px;
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .week-grid-header {
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.06);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .week-grid-cell {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
    min-height: 50px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: background var(--transition-fast);
  }

  .week-grid-cell:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .week-grid-time {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.7rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
}

/* Print styles (in case someone wants to print the timetable) */
@media print {
  .app-background,
  .app-header,
  .day-tabs,
  .install-prompt,
  .toast-container,
  #admin-panel,
  #substitute-panel,
  .admin-login-overlay {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .glass, .glass-subtle {
    background: white;
    backdrop-filter: none;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .glass::before {
    display: none;
  }
}
