/* ============================================
   SUPMECA PLANNING — Design System
   Premium dark mode with glassmorphism
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Colors — Dark Theme */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2035;
  --bg-card: rgba(30, 41, 70, 0.6);
  --bg-card-hover: rgba(40, 55, 90, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-strong: rgba(255, 255, 255, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Accent Gradient */
  --accent-purple: #a855f7;
  --accent-indigo: #6366f1;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #a855f7, #6366f1, #06b6d4);
  --gradient-warm: linear-gradient(135deg, #f97316, #ef4444);
  --gradient-cool: linear-gradient(135deg, #6366f1, #3b82f6);

  /* Event Type Colors */
  --color-cm: #a855f7;
  --color-td: #3b82f6;
  --color-tp: #10b981;
  --color-exam: #ef4444;
  --color-projet: #f59e0b;
  --color-reunion: #ec4899;
  --color-cours: #6366f1;

  --color-cm-bg: rgba(168, 85, 247, 0.15);
  --color-td-bg: rgba(59, 130, 246, 0.15);
  --color-tp-bg: rgba(16, 185, 129, 0.15);
  --color-exam-bg: rgba(239, 68, 68, 0.2);
  --color-projet-bg: rgba(245, 158, 11, 0.15);
  --color-reunion-bg: rgba(236, 72, 153, 0.15);
  --color-cours-bg: rgba(99, 102, 241, 0.15);

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Calendar */
  --hour-height: 70px;
  --time-col-width: 60px;
  --header-height: 60px;
  --nav-height: 50px;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-strong: rgba(0, 0, 0, 0.05);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-muted: #cbd5e1;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.08);

  --color-cm-bg: rgba(168, 85, 247, 0.1);
  --color-td-bg: rgba(59, 130, 246, 0.1);
  --color-tp-bg: rgba(16, 185, 129, 0.1);
  --color-exam-bg: rgba(239, 68, 68, 0.1);
  --color-projet-bg: rgba(245, 158, 11, 0.1);
  --color-reunion-bg: rgba(236, 72, 153, 0.1);
  --color-cours-bg: rgba(99, 102, 241, 0.1);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Hide elements with [hidden] attribute */
[hidden] {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* --- Views --- */
.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   LOGIN VIEW
   ============================================ */
#login-view {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  animation: fadeSlideUp 0.6s ease-out;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

/* Branding */
.login-branding {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.login-branding h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Form */
#login-form {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input:focus~.input-icon,
.input-wrapper input:focus+.input-icon {
  color: var(--accent-indigo);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.toggle-pw:hover {
  color: var(--text-primary);
}

.toggle-pw svg {
  width: 18px;
  height: 18px;
}

/* Button */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

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

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.large {
  width: 40px;
  height: 40px;
  border-width: 3px;
  border-color: rgba(99, 102, 241, 0.3);
  border-top-color: var(--accent-indigo);
}

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

/* Error */
.error-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 0.875rem;
  animation: shake 0.4s ease-in-out;
}

[data-theme="light"] .error-message {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-6px);
  }

  80% {
    transform: translateX(4px);
  }
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Background decoration */
.login-bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.bg-orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-purple);
  top: -100px;
  right: -100px;
  animation: orb1 20s ease-in-out infinite;
}

.bg-orb-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-cyan);
  bottom: -50px;
  left: -80px;
  animation: orb2 25s ease-in-out infinite;
}

.bg-orb-3 {
  width: 250px;
  height: 250px;
  background: var(--accent-indigo);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orb3 30s ease-in-out infinite;
}

@keyframes orb1 {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-40px, 60px);
  }
}

@keyframes orb2 {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(50px, -40px);
  }
}

@keyframes orb3 {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* ============================================
   SCHEDULE VIEW — Header
   ============================================ */
#schedule-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

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

.user-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-icon:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-icon.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ============================================
   SCHEDULE VIEW — Navigation
   ============================================ */
#schedule-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

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

.nav-btn:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
}

.today-btn {
  background: var(--gradient-primary);
  color: white;
  border: none;
  font-weight: 600;
}

.today-btn:hover {
  opacity: 0.9;
  color: white;
}

.period-label {
  font-size: 1rem;
  font-weight: 600;
  margin-left: 8px;
  flex: 1;
  white-space: nowrap;
}

.view-toggle {
  display: flex;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-left: auto;
}

.view-btn {
  padding: 6px 14px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: var(--accent-indigo);
  color: white;
}

.view-btn:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-glass-strong);
}

/* ============================================
   DAY SELECTOR (Mobile)
   ============================================ */
.day-selector {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

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

.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  min-width: 54px;
}

.day-chip:hover {
  background: var(--bg-glass-strong);
}

.day-chip.active {
  background: var(--accent-indigo);
  color: white;
  border-color: transparent;
}

.day-chip.today:not(.active) {
  border-color: var(--accent-indigo);
}

.day-chip-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.day-chip-num {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2px;
}

.day-chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  margin-top: 4px;
  opacity: 0;
}

.day-chip.has-events .day-chip-dot {
  opacity: 1;
}

.day-chip.active .day-chip-dot {
  background: white;
}

/* ============================================
   CALENDAR — Week View
   ============================================ */
.calendar-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

.calendar-grid {
  display: grid;
  grid-template-columns: var(--time-col-width) repeat(var(--day-count, 6), 1fr);
  min-height: calc(var(--hour-height) * 13);
  position: relative;
}

.time-column {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-primary);
}

.time-label {
  height: var(--hour-height);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 10px;
  padding-top: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  transform: translateY(-7px);
}

/* Day columns */
.day-column {
  position: relative;
  border-left: 1px solid var(--border-color);
}

.day-column-header {
  position: sticky;
  top: 0;
  z-index: 4;
  text-align: center;
  padding: 8px 4px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.day-column-header .day-num {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.day-column-header.today {
  color: var(--accent-indigo);
}

.day-column-header.today .day-num {
  background: var(--accent-indigo);
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.hour-line {
  height: var(--hour-height);
  border-bottom: 1px solid var(--border-color);
}

.hour-line.half {
  height: calc(var(--hour-height) / 2);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

/* Calendar events */
.cal-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-fast);
  z-index: 3;
  animation: eventAppear 0.3s ease-out both;
  border-left: 3px solid;
}

@keyframes eventAppear {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.cal-event:hover {
  transform: scale(1.02);
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.cal-event .event-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cal-event .event-room {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.cal-event .event-prof {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.cal-event .event-time-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Event type colors */
.cal-event.type-cm {
  background: var(--color-cm-bg);
  border-left-color: var(--color-cm);
}

.cal-event.type-td {
  background: var(--color-td-bg);
  border-left-color: var(--color-td);
}

.cal-event.type-tp {
  background: var(--color-tp-bg);
  border-left-color: var(--color-tp);
}

.cal-event.type-exam {
  background: var(--color-exam-bg);
  border-left-color: var(--color-exam);
}

.cal-event.type-projet {
  background: var(--color-projet-bg);
  border-left-color: var(--color-projet);
}

.cal-event.type-reunion {
  background: var(--color-reunion-bg);
  border-left-color: var(--color-reunion);
}

.cal-event.type-cours {
  background: var(--color-cours-bg);
  border-left-color: var(--color-cours);
}

/* ============================================
   CALENDAR — Day View (Mobile)
   ============================================ */
.day-timeline {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-event-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  animation: slideIn 0.3s ease-out both;
  position: relative;
  overflow: hidden;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.day-event-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.day-event-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.day-event-card.type-cm::before {
  background: var(--color-cm);
}

.day-event-card.type-td::before {
  background: var(--color-td);
}

.day-event-card.type-tp::before {
  background: var(--color-tp);
}

.day-event-card.type-exam::before {
  background: var(--color-exam);
}

.day-event-card.type-projet::before {
  background: var(--color-projet);
}

.day-event-card.type-reunion::before {
  background: var(--color-reunion);
}

.day-event-card.type-cours::before {
  background: var(--color-cours);
}

.day-event-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 55px;
  padding-top: 2px;
}

.day-event-time-start {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.day-event-time-sep {
  width: 2px;
  height: 14px;
  background: var(--border-color);
  margin: 4px 0;
  border-radius: 1px;
}

.day-event-time-end {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

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

.day-event-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.day-event-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-event-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.day-event-meta-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.6;
}

.day-event-type-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 20px;
  opacity: 0.8;
}

.type-cm .day-event-type-badge {
  background: var(--color-cm-bg);
  color: var(--color-cm);
}

.type-td .day-event-type-badge {
  background: var(--color-td-bg);
  color: var(--color-td);
}

.type-tp .day-event-type-badge {
  background: var(--color-tp-bg);
  color: var(--color-tp);
}

.type-exam .day-event-type-badge {
  background: var(--color-exam-bg);
  color: var(--color-exam);
}

.type-projet .day-event-type-badge {
  background: var(--color-projet-bg);
  color: var(--color-projet);
}

.type-reunion .day-event-type-badge {
  background: var(--color-reunion-bg);
  color: var(--color-reunion);
}

.type-cours .day-event-type-badge {
  background: var(--color-cours-bg);
  color: var(--color-cours);
}

/* ============================================
   LIST VIEW
   ============================================ */
.list-view {
  padding: 16px;
}

.list-day-group {
  margin-bottom: 24px;
}

.list-day-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 2;
}

.list-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.list-event:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.list-event-color {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

.list-event.type-cm .list-event-color {
  background: var(--color-cm);
}

.list-event.type-td .list-event-color {
  background: var(--color-td);
}

.list-event.type-tp .list-event-color {
  background: var(--color-tp);
}

.list-event.type-exam .list-event-color {
  background: var(--color-exam);
}

.list-event.type-projet .list-event-color {
  background: var(--color-projet);
}

.list-event.type-reunion .list-event-color {
  background: var(--color-reunion);
}

.list-event.type-cours .list-event-color {
  background: var(--color-cours);
}

.list-event-time {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 90px;
  color: var(--text-secondary);
}

.list-event-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.list-event-room {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ============================================
   NOW INDICATOR
   ============================================ */
.now-indicator {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.now-dot {
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.8);
  }
}

.now-line {
  flex: 1;
  height: 2px;
  background: #ef4444;
  opacity: 0.6;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.schedule-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.loading-content {
  text-align: center;
  color: var(--text-secondary);
}

.loading-content p {
  margin-top: 16px;
  font-size: 0.95rem;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.empty-illustration {
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
  opacity: 0.5;
}

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

/* ============================================
   EVENT DETAIL MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-strong);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-right: 40px;
  line-height: 1.3;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.modal-detail-row svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* On desktop, default to week view */
@media (min-width: 768px) {
  .day-selector {
    display: none;
  }

  .calendar-grid {
    --day-count: 6;
  }

  #schedule-nav {
    padding: 10px 24px;
  }

  .cal-event .event-title {
    font-size: 0.8rem;
  }

  .cal-event .event-room {
    font-size: 0.72rem;
  }

  #schedule-header {
    padding: 12px 24px;
  }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
  :root {
    --hour-height: 60px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  :root {
    --hour-height: 60px;
    --time-col-width: 45px;
  }

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

  .user-badge {
    display: none;
  }

  #schedule-nav {
    padding: 8px 12px;
    gap: 6px;
  }

  .period-label {
    font-size: 0.85rem;
    order: 10;
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 4px;
    text-align: center;
  }

  .view-toggle {
    order: 9;
  }

  .login-branding h1 {
    font-size: 1.6rem;
  }

  #login-form {
    padding: 24px;
  }

  .bg-orb-1 {
    width: 250px;
    height: 250px;
  }

  .bg-orb-2 {
    width: 200px;
    height: 200px;
  }

  .bg-orb-3 {
    width: 150px;
    height: 150px;
  }

  .modal-content {
    padding: 24px;
  }

  .modal-title {
    font-size: 1.15rem;
  }
}