/* ─── Reset & Variables ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #16a34a;
  --success-dark: #15803d;
  --warning: #d97706;
  --warning-dark: #b45309;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --soft: #f8fafc;
  --radius: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.09);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.13);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #e8eeff 0%, #f1f5f9 50%, #f8fafc 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 45%, #1d4ed8 100%);
  border-radius: 28px;
  padding: 48px 44px 40px;
  margin-bottom: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15,23,42,0.35);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(99,102,241,0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(29,78,216,0.2) 0%, transparent 55%);
  pointer-events: none;
}

.hero-top-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 4px 14px rgba(249,115,22,0.45);
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-text {
  color: rgba(255,255,255,0.72);
  max-width: 560px;
  margin: 0 auto 22px;
  font-size: 1.05rem;
  font-weight: 400;
}

.quote-of-day {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px 22px;
  max-width: 640px;
  margin: 0 auto 26px;
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
  line-height: 1.5;
  backdrop-filter: blur(6px);
}

.quote-mark {
  font-size: 1.4rem;
  font-weight: 700;
  color: #818cf8;
  line-height: 1;
  margin-right: 4px;
  vertical-align: -4px;
}

.hero-highlights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 4px;
}

.highlight-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 18px 20px;
  text-align: left;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease;
}

.highlight-card:hover {
  background: rgba(255,255,255,0.13);
}

.highlight-icon {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.highlight-title {
  display: block;
  font-weight: 700;
  color: #a5b4fc;
  font-size: 0.92rem;
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.highlight-card p {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ─── Grid Layout ───────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.full-width { grid-column: 1 / -1; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

/* ─── Form ──────────────────────────────────────────────────────────────── */
form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: 0.97rem;
  font-family: inherit;
  background: var(--soft);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

button {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: white;
  margin-top: 6px;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}

button:active { transform: translateY(0); }

button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-btn { background: #64748b; }
.secondary-btn:hover { background: #475569; box-shadow: 0 4px 12px rgba(100,116,139,0.3); }
.delete-btn { background: var(--danger); }
.delete-btn:hover { background: var(--danger-dark); box-shadow: 0 4px 12px rgba(220,38,38,0.35); }
.edit-btn { background: var(--warning); color: white; }
.edit-btn:hover { background: var(--warning-dark); box-shadow: 0 4px 12px rgba(217,119,6,0.35); }
.complete-btn { background: var(--success); }
.complete-btn:hover { background: var(--success-dark); box-shadow: 0 4px 12px rgba(22,163,74,0.35); }

.hidden { display: none !important; }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ─── Stats ─────────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}

.stat-box h3 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}

.stat-box p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-box--success { background: #f0fdf4; border-color: #bbf7d0; }
.stat-box--success h3 { color: var(--success); }
.stat-box--warning { background: #fffbeb; border-color: #fde68a; }
.stat-box--warning h3 { color: var(--warning); }

/* ─── Progress Bar ──────────────────────────────────────────────────────── */
.progress-section { margin-top: 4px; }

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.progress-percent-label {
  font-weight: 800;
  color: var(--primary);
  font-size: 1rem;
}

.progress-bar {
  width: 100%;
  height: 16px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f46e5, #818cf8, #6366f1, #4f46e5);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressShimmer 2.5s linear infinite;
}

@keyframes progressShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.mini-summary {
  margin-top: 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 12px 16px;
  color: #3730a3;
  font-size: 0.92rem;
  font-weight: 500;
}

/* ─── Dashboard ─────────────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input {
  width: 100%;
  padding-left: 18px;
}

.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid var(--border);
  margin-top: 0;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: none;
}

.filter-btn:hover {
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

/* ─── Task List ─────────────────────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.task-item {
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  background: #fff;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: fadeSlideIn 0.25s ease both;
}

.task-item:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.09);
  transform: translateY(-1px);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.task-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.task-status-text { font-weight: 600; }

.task-item.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.task-item.completed .task-header h3 {
  opacity: 0.7;
  text-decoration: line-through;
}

.completed-text { color: var(--success); font-weight: 700; }

.task-item.overdue {
  border-left: 5px solid var(--danger);
  background: #fff5f5;
}

.task-item.due-soon {
  border-left: 5px solid var(--warning);
  background: #fffcf0;
}

.task-item.safe {
  border-left: 5px solid #818cf8;
}

/* ─── Task Actions ──────────────────────────────────────────────────────── */
.task-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.task-actions button {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 10px;
}

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.urgent {
  background: #fee2e2;
  color: #b91c1c;
  animation: pulse-urgent 1.6s ease-in-out infinite;
}

.high { background: #fef3c7; color: #92400e; }
.normal { background: #e0e7ff; color: #3730a3; }

@keyframes pulse-urgent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(185,28,28,0); }
}

/* ─── Nudge ─────────────────────────────────────────────────────────────── */
.nudge-box {
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  border: 1.5px solid #fbbf24;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #78350f;
  line-height: 1.4;
}

/* ─── Pomodoro ──────────────────────────────────────────────────────────── */
.pomodoro-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.pomodoro-btn {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  letter-spacing: 0.01em;
}

.pomodoro-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

.pomodoro-timer {
  font-size: 1.2rem;
  font-weight: 800;
  color: #7c3aed;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* ─── Empty States ──────────────────────────────────────────────────────── */
.empty-state-block {
  text-align: center;
  padding: 40px 20px;
}

.empty-emoji {
  display: block;
  font-size: 2.8rem;
  margin-bottom: 12px;
  line-height: 1;
}

.empty-state-block h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state-block p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ─── AI Coach header ───────────────────────────────────────────────────── */
.coach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.coach-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coach-title-row h2 { margin-bottom: 0; }

.coach-avatar {
  font-size: 2rem;
  line-height: 1;
  display: inline-block;
  transform-origin: bottom center;
}

.coach-avatar.is-thinking {
  animation: avatarThink 0.7s ease-in-out infinite;
}

.coach-avatar.is-bouncing {
  animation: avatarBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes avatarThink {
  0%, 100% { transform: rotate(-8deg) scale(0.95); }
  50%       { transform: rotate(8deg)  scale(1.05); }
}

@keyframes avatarBounce {
  0%   { transform: translateY(0)     scale(1); }
  35%  { transform: translateY(-14px) scale(1.18); }
  65%  { transform: translateY(-5px)  scale(0.95); }
  100% { transform: translateY(0)     scale(1); }
}

.refresh-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-top: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
              transform 0.35s ease, box-shadow 0.2s ease;
}

.refresh-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: rotate(180deg);
  box-shadow: 0 2px 10px rgba(79,70,229,0.3);
}

.refresh-btn.is-spinning {
  animation: spinRefresh 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spinRefresh {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}

/* ─── TTS Controls ──────────────────────────────────────────────────────── */
.tts-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0;
  letter-spacing: 0.01em;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.speak-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14,165,233,0.4);
}

.speak-btn.speaking {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.2);
}

.speak-btn.speaking:hover {
  box-shadow: 0 4px 14px rgba(220,38,38,0.4);
}

.auto-speak-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.auto-speak-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

/* Speaking border pulse on the coach card */
#coachCard.is-speaking {
  border-color: #0ea5e9;
  animation: speakingPulse 2s ease-in-out infinite;
}

@keyframes speakingPulse {
  0%, 100% { box-shadow: var(--shadow-md), 0 0 0 0   rgba(14,165,233,0.45); }
  50%       { box-shadow: var(--shadow-md), 0 0 0 8px rgba(14,165,233,0);   }
}

/* ─── Typewriter cursor ─────────────────────────────────────────────────── */
.tw-cursor {
  display: inline-block;
  color: var(--primary);
  font-weight: 700;
  margin-left: 1px;
  animation: twBlink 0.75s step-end infinite;
}

@keyframes twBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── Suggestion & Reminder Boxes ───────────────────────────────────────── */
.suggestion-box {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 18px;
}

.suggestion-box p {
  color: #1e1b4b;
  font-size: 0.95rem;
  line-height: 1.75;
}

.reminder-box {
  background: var(--soft);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s;
}

.reminder-box:hover { box-shadow: var(--shadow-sm); }
.reminder-box.reminder-urgent { background: #fff5f5; border-color: #fca5a5; }
.reminder-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.reminder-course { color: var(--muted); font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; }
.reminder-due { font-size: 0.9rem; font-weight: 600; }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  padding: 14px 32px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 8px 28px rgba(79,70,229,0.45);
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.38s ease;
  white-space: nowrap;
}

.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Confetti ──────────────────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  animation: confettiBurst 1.4s ease-out forwards;
  user-select: none;
}

@keyframes confettiBurst {
  0%   { transform: translateY(0) scale(1);   opacity: 1; }
  100% { transform: translateY(-180px) scale(0.4); opacity: 0; }
}

/* ─── Task Header Badges & Bottom Actions ──────────────────────────────── */
.task-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #3730a3;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  border: 1px solid #c7d2fe;
}

.task-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.session-start-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 12px rgba(79,70,229,0.35);
  white-space: nowrap;
}

.session-start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,0.45);
}

.session-start-btn:active {
  transform: translateY(0);
}

/* ─── Steps — Form ─────────────────────────────────────────────────────── */
.steps-section-form {
  margin-top: 6px;
  margin-bottom: 4px;
}

.steps-section-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 10px;
}

.step-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.step-num {
  min-width: 22px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.step-input {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--soft);
  color: var(--text);
  transition: border-color 0.18s ease;
}

.step-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.remove-step-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.remove-step-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

.add-step-btn {
  background: none;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
  margin-top: 2px;
}

.add-step-btn:hover {
  border-color: var(--primary);
  background: #eef2ff;
}

.steps-nudge {
  font-size: 0.78rem;
  color: var(--warning);
  margin-top: 8px;
  padding: 7px 12px;
  background: #fffbeb;
  border-radius: 8px;
  border: 1px solid #fde68a;
}

.steps-nudge.hidden {
  display: none;
}

/* ─── Steps — Task Card ─────────────────────────────────────────────────── */
.steps-section-card {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.steps-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.steps-mini-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.steps-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #34d399);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.steps-count-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.steps-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  line-height: 1.45;
}

.step-check-row input[type="checkbox"] {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  accent-color: var(--success);
  cursor: pointer;
  flex-shrink: 0;
}

.step-check-row span {
  transition: color 0.18s, text-decoration 0.18s;
}

.step-done span {
  color: var(--muted);
  text-decoration: line-through;
}

/* ─── Study Session Overlay ─────────────────────────────────────────────── */
.session-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.25s ease;
}

.session-overlay.hidden {
  display: none;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.session-modal {
  background: #fff;
  border-radius: 28px;
  padding: 40px 44px;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(15,23,42,0.35);
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from { transform: translateY(32px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.session-task-info {
  margin-bottom: 28px;
  text-align: center;
}

.session-label {
  display: inline-block;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.session-task-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.session-task-course {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

.session-prompt {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 500;
}

#sessionSetup textarea,
#sessionWrapup textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--soft);
  resize: vertical;
  transition: border-color 0.18s;
  margin-bottom: 20px;
}

#sessionSetup textarea:focus,
#sessionWrapup textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* Duration picker */
.duration-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.duration-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.duration-buttons {
  display: flex;
  gap: 8px;
}

.dur-btn {
  background: var(--soft);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dur-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

.dur-btn.active {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 12px rgba(79,70,229,0.4);
}

/* Session action buttons */
.session-btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.start-session-action-btn {
  flex: 1;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(79,70,229,0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.start-session-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79,70,229,0.5);
}

.start-session-action-btn:active {
  transform: translateY(0);
}

.session-cancel-btn {
  background: var(--soft);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.session-cancel-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff;
}

/* Active phase */
.session-timer-display {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  text-align: center;
  line-height: 1;
  margin: 12px 0 18px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.session-timer-display.timer-warning {
  color: var(--danger);
  animation: timerPulse 1.1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.04); opacity: 0.82; }
}

.session-motivational {
  min-height: 40px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 20px;
  transition: opacity 0.4s ease;
}

.session-msg-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.session-msg-warning {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.session-msg-success {
  background: #f0fdf4;
  color: var(--success-dark);
  border: 1px solid #bbf7d0;
}

.end-session-btn {
  display: block;
  width: 100%;
  background: none;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.end-session-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff1f2;
}

/* Wrap-up phase */
.session-done-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 8px;
}

.session-done-title {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
}

/* ─── AI Loading State ──────────────────────────────────────────────────── */
.suggestion-loading {
  color: var(--muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

.loading-dots span {
  display: inline-block;
  animation: dotBounce 1.2s ease-in-out infinite;
  font-size: 1.3rem;
  line-height: 1;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}
/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { padding: 36px 24px 32px; }
  .hero h1 { font-size: 2rem; }
  .hero-highlights { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.7rem; }
  .hero { padding: 28px 18px 26px; }
  .hero-top-row { flex-direction: column; gap: 8px; }
  .stats { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
}
/* ─── Task AI Buttons Row ───────────────────────────────────────────────── */
.task-ai-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quiz-start-btn {
  background: linear-gradient(135deg, #0891b2, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 12px rgba(8,145,178,0.35);
  white-space: nowrap;
}
.quiz-start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(8,145,178,0.45);
}

/* ─── Schedule Button in Coach Card ────────────────────────────────────── */
.schedule-btn-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.schedule-gen-btn {
  width: 100%;
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(29,78,216,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.schedule-gen-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(29,78,216,0.5); }
.schedule-gen-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* ─── Assignment Analyzer ───────────────────────────────────────────────── */
.analyzer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.analyzer-subtitle { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.ai-powered-badge {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
#assignmentText {
  width: 100%;
  min-height: 130px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--soft);
  resize: vertical;
  transition: border-color 0.18s;
  margin-bottom: 14px;
}
#assignmentText:focus { outline: none; border-color: var(--primary); background: #fff; }
.analyzer-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.analyze-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(79,70,229,0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.analyze-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79,70,229,0.5); }
.analyze-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.analyzer-status { font-size: 0.88rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.analyzer-status.hidden { display: none; }
.analyzer-success { color: var(--success); }
.analyzer-error   { color: var(--danger); }
.analyzer-preview {
  margin-top: 20px;
  background: #f8faff;
  border: 2px solid #c7d2fe;
  border-radius: 16px;
  padding: 20px 22px;
}
.analyzer-preview.hidden { display: none; }
.preview-label { font-size: 0.88rem; font-weight: 700; color: var(--success-dark); margin-bottom: 14px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.preview-field {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.preview-key { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.preview-val { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.preview-steps-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.preview-steps { padding-left: 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 5px; }
.preview-steps li { font-size: 0.88rem; color: var(--text); }
.preview-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.preview-cancel-btn {
  background: none;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.preview-cancel-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ─── Quiz Modal ────────────────────────────────────────────────────────── */
.quiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.25s ease;
}
.quiz-overlay.hidden { display: none; }
.quiz-modal {
  background: #fff;
  border-radius: 28px;
  padding: 36px 40px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(15,23,42,0.35);
  position: relative;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--soft);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-x:hover { background: #fee2e2; color: var(--danger); }
.quiz-modal-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.quiz-modal-icon { font-size: 2.2rem; line-height: 1; }
.quiz-modal-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.quiz-task-label { font-size: 0.84rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
#quizNotes {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--soft);
  resize: vertical;
  transition: border-color 0.18s;
  margin-bottom: 18px;
}
#quizNotes:focus { outline: none; border-color: var(--primary); background: #fff; }
.quiz-loading-anim { text-align: center; padding: 40px 20px; }
.quiz-loading-anim span { font-size: 3rem; display: block; margin-bottom: 16px; animation: avatarBounce 0.8s ease-in-out infinite; }
.quiz-loading-anim p { font-size: 1rem; font-weight: 600; color: var(--muted); }
.quiz-progress-bar-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.quiz-progress-track { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}
.quiz-progress-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.quiz-question-text { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.5; margin-bottom: 18px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.quiz-option {
  background: var(--soft);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.quiz-opt-correct { background: #f0fdf4 !important; border-color: var(--success) !important; color: var(--success-dark) !important; }
.quiz-opt-wrong   { background: #fff1f2 !important; border-color: var(--danger)  !important; color: var(--danger-dark)  !important; }
.quiz-feedback { border-radius: 12px; padding: 12px 16px; font-size: 0.88rem; font-weight: 600; line-height: 1.5; margin-bottom: 16px; }
.quiz-feedback.hidden { display: none; }
.quiz-fb-correct { background: #f0fdf4; color: var(--success-dark); border: 1px solid #bbf7d0; }
.quiz-fb-wrong   { background: #fff1f2; color: var(--danger-dark);   border: 1px solid #fecaca; }
.quiz-results-icon  { font-size: 3.5rem; text-align: center; margin-bottom: 10px; }
.quiz-results-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 6px; }
.quiz-results-sub   { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.quiz-results-breakdown { display: flex; flex-direction: column; gap: 8px; }
.result-row { padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; }
.result-correct { background: #f0fdf4; color: var(--success-dark); }
.result-wrong   { background: #fff1f2; color: var(--danger-dark); }

/* ─── Schedule Modal ────────────────────────────────────────────────────── */
.schedule-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.25s ease;
}
.schedule-overlay.hidden { display: none; }
.schedule-modal {
  background: #fff;
  border-radius: 28px;
  padding: 36px 40px;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(15,23,42,0.35);
  position: relative;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.schedule-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.schedule-modal-header h2 { font-size: 1.35rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.schedule-subtitle { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.schedule-content { display: flex; flex-direction: column; }
.schedule-block {
  display: grid;
  grid-template-columns: 52px 28px 1fr;
  gap: 0 12px;
  align-items: flex-start;
}
.schedule-time {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  padding-top: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.schedule-connector { display: flex; flex-direction: column; align-items: center; }
.schedule-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.schedule-block-work .schedule-dot  { background: var(--primary); }
.schedule-block-break .schedule-dot { background: var(--success); }
.schedule-block-done .schedule-dot  { background: var(--muted); }
.schedule-line { flex: 1; width: 2px; background: var(--border); min-height: 30px; margin-top: 4px; }
.schedule-info { padding-bottom: 20px; }
.schedule-task-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.schedule-emoji { font-size: 1.1rem; }
.schedule-task-name { font-size: 0.95rem; font-weight: 700; color: var(--text); flex: 1; }
.schedule-duration { font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.schedule-block-work .schedule-duration  { background: #eef2ff; color: var(--primary); }
.schedule-block-break .schedule-duration { background: #f0fdf4; color: var(--success-dark); }
.schedule-block-done .schedule-duration  { background: var(--soft); color: var(--muted); }
.schedule-note { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
