/* ── Study Planner Tool for Students ─────────────────────────────────────── */

.sp-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 880px;
  margin: 2rem auto;
  background: #f3f4ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(79,70,229,0.12);
  color: #1e1b4b;
  box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.sp__header {
  background: linear-gradient(135deg, #3730a3 0%, #1d4ed8 60%, #0369a1 100%);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  position: relative;
  overflow: hidden;
}

.sp__header::before {
  content: '📚  📐  🎓  ✏️  📚';
  position: absolute;
  top: 0.6rem; right: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.5em;
  opacity: 0.2;
}

.sp__logo { font-size: 2.8rem; line-height: 1; margin-bottom: 0.4rem; }

.sp__header h2 {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 900;
  color: #fff;
  margin: 0 0 0.2rem;
  letter-spacing: -0.01em;
}

.sp__header p { font-size: 0.9rem; color: #bfdbfe; margin: 0 0 1.25rem; }

/* Stats row */
.sp__stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 600px) { .sp__stats-row { grid-template-columns: 1fr 1fr; } }

.sp__stat-pill {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  text-align: center;
}

.sp__stat-pill .val {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  display: block;
}

.sp__stat-pill .lbl {
  font-size: 0.7rem;
  color: #bfdbfe;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
  display: block;
}

/* ── Tab Nav ─────────────────────────────────────────────────────────────── */

.sp__tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #e0e7ff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sp__tab {
  flex: 1;
  min-width: 100px;
  padding: 0.85rem 0.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.85rem;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.sp__tab:hover  { color: #4f46e5; }
.sp__tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }

/* ── Panel body ──────────────────────────────────────────────────────────── */

.sp__panel { padding: clamp(1rem, 3vw, 1.75rem); }
.sp__panel-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: #1e1b4b;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Subjects bar ────────────────────────────────────────────────────────── */

.sp__subjects-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.sp__subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  cursor: default;
  position: relative;
}

.sp__subject-del {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.sp__btn-add-subject {
  padding: 0.3rem 0.75rem;
  border: 1.5px dashed #a5b4fc;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #6366f1;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.sp__btn-add-subject:hover { background: #eef2ff; }

/* ── Inline add forms ────────────────────────────────────────────────────── */

.sp__form-box {
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.sp__form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 560px) { .sp__form-grid { grid-template-columns: 1fr; } }

.sp__form-full { grid-column: 1 / -1; }

.sp__label {
  display: block;
  font-size: 0.79rem;
  font-weight: 700;
  color: #3730a3;
  margin-bottom: 0.3rem;
}

.sp__input, .sp__select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid #c7d2fe;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1e1b4b;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sp__input:focus, .sp__select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.sp__form-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.85rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.sp__btn {
  padding: 0.58rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.sp__btn:hover  { filter: brightness(1.08); }
.sp__btn:active { transform: scale(0.98); }

.sp__btn--primary   { background: #4f46e5; color: #fff; }
.sp__btn--teal      { background: #0d9488; color: #fff; }
.sp__btn--amber     { background: #f59e0b; color: #fff; }
.sp__btn--red       { background: #ef4444; color: #fff; }
.sp__btn--ghost     { background: transparent; color: #6366f1; border: 1.5px solid #c7d2fe; }
.sp__btn--sm        { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.sp__btn--full      { width: 100%; text-align: center; }

.sp__btn-toggle {
  padding: 0.4rem 1rem;
  border: 2px solid #c7d2fe;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: #6b7280;
  transition: all 0.2s;
}

.sp__btn-toggle.active {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #4f46e5;
}

/* ── Filters ─────────────────────────────────────────────────────────────── */

.sp__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.sp__filter-chip {
  padding: 0.32rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background: #e0e7ff;
  color: #4338ca;
  border: 1.5px solid transparent;
  transition: background 0.15s;
}

.sp__filter-chip.active { background: #4f46e5; color: #fff; }
.sp__filter-chip:hover:not(.active) { background: #c7d2fe; }

/* ── Task list ───────────────────────────────────────────────────────────── */

.sp__tasks-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #9ca3af;
  font-size: 0.93rem;
}

.sp__task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1.5px solid #e0e7ff;
  border-radius: 10px;
  margin-bottom: 0.55rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sp__task-item:hover { border-color: #a5b4fc; box-shadow: 0 2px 8px rgba(99,102,241,0.08); }
.sp__task-item.done { opacity: 0.5; }

.sp__task-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid #a5b4fc;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
  font-size: 0.75rem;
  background: #fff;
  transition: background 0.2s, border-color 0.2s;
}

.sp__task-item.done .sp__task-check { background: #10b981; border-color: #10b981; color: #fff; }

.sp__task-body { flex: 1; min-width: 0; }

.sp__task-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e1b4b;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.sp__task-item.done .sp__task-title { text-decoration: line-through; }

.sp__task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.sp__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
}

.sp__badge--subject { color: #fff; }
.sp__badge--low      { background: #d1fae5; color: #065f46; }
.sp__badge--medium   { background: #fef9c3; color: #854d0e; }
.sp__badge--high     { background: #fee2e2; color: #991b1b; }
.sp__badge--critical { background: #ede9fe; color: #5b21b6; }
.sp__badge--due      { background: #f3f4f6; color: #374151; }
.sp__badge--overdue  { background: #fef2f2; color: #dc2626; }

.sp__task-del { background: none; border: none; color: #e5e7eb; cursor: pointer; font-size: 1rem; padding: 0; flex-shrink: 0; transition: color 0.15s; }
.sp__task-del:hover { color: #ef4444; }

/* ── Progress bar ────────────────────────────────────────────────────────── */

.sp__progress { background: #e0e7ff; border-radius: 999px; height: 6px; margin: 0.4rem 0; overflow: hidden; }
.sp__progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f46e5, #7c3aed); transition: width 0.4s; }

/* ── Schedule grid ───────────────────────────────────────────────────────── */

.sp__week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sp__week-label { font-size: 0.95rem; font-weight: 800; color: #1e1b4b; }

.sp__sched-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.55rem;
  overflow-x: auto;
}

@media (max-width: 640px) {
  .sp__sched-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 400px) {
  .sp__sched-grid { grid-template-columns: repeat(2, 1fr); }
}

.sp__day-card {
  background: #fff;
  border: 1.5px solid #e0e7ff;
  border-radius: 10px;
  padding: 0.7rem 0.6rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.sp__day-card.today { border-color: #6366f1; box-shadow: 0 0 0 2px #c7d2fe; }

.sp__day-header {
  font-size: 0.72rem;
  font-weight: 800;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sp__day-date {
  font-size: 1.05rem;
  font-weight: 900;
  color: #1e1b4b;
  line-height: 1;
}

.sp__day-card.today .sp__day-date {
  background: #4f46e5;
  color: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.sp__block-list { flex: 1; margin-bottom: 0.4rem; }

.sp__block {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.4rem;
  border-radius: 5px;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  cursor: default;
}

.sp__block-del {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  margin-left: auto;
  line-height: 1;
}

.sp__block-time { opacity: 0.85; font-weight: 600; font-size: 0.65rem; }

.sp__btn-add-block {
  width: 100%;
  padding: 0.28rem;
  border: 1px dashed #c7d2fe;
  border-radius: 6px;
  background: transparent;
  color: #818cf8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}

.sp__btn-add-block:hover { background: #eef2ff; }

/* ── Pomodoro Timer ───────────────────────────────────────────────────────── */

.sp__timer-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 580px) { .sp__timer-layout { grid-template-columns: 1fr; } }

.sp__timer-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sp__ring-svg { width: 220px; height: 220px; transform: rotate(-90deg); }

.sp__ring-bg  { fill: none; stroke: #e0e7ff; stroke-width: 12; }
.sp__ring-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.5s; }

.sp__ring-label {
  position: relative;
  margin-top: -166px;
  margin-bottom: 16px;
  text-align: center;
  pointer-events: none;
}

.sp__ring-time {
  font-size: 2.6rem;
  font-weight: 900;
  color: #1e1b4b;
  line-height: 1;
  letter-spacing: -0.02em;
}

.sp__ring-mode {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6366f1;
  margin-top: 0.3rem;
}

.sp__timer-controls { display: flex; gap: 0.6rem; justify-content: center; }

.sp__timer-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.15s, transform 0.1s;
}

.sp__timer-btn:hover  { filter: brightness(1.1); }
.sp__timer-btn:active { transform: scale(0.95); }

.sp__timer-btn--play  { background: #4f46e5; color: #fff; width: 60px; height: 60px; font-size: 1.3rem; }
.sp__timer-btn--reset { background: #e0e7ff; color: #6366f1; }
.sp__timer-btn--skip  { background: #fde68a; color: #92400e; }

/* Mode tabs */
.sp__mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

/* Timer sidebar */
.sp__timer-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.sp__timer-settings {
  background: #fff;
  border: 1.5px solid #e0e7ff;
  border-radius: 12px;
  padding: 1rem;
}

.sp__session-log {
  background: #fff;
  border: 1.5px solid #e0e7ff;
  border-radius: 12px;
  padding: 1rem;
  max-height: 220px;
  overflow-y: auto;
}

.sp__session-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.82rem;
  color: #374151;
}

.sp__session-item:last-child { border-bottom: none; }

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

/* ── Exam cards ──────────────────────────────────────────────────────────── */

.sp__exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.sp__exam-card {
  border-radius: 12px;
  padding: 1.2rem;
  border: 1.5px solid;
  position: relative;
  overflow: hidden;
}

.sp__exam-card::before {
  content: '🎓';
  position: absolute;
  font-size: 4rem;
  opacity: 0.07;
  bottom: -0.5rem;
  right: -0.5rem;
}

.sp__exam-card--urgent { background: #fff5f5; border-color: #fca5a5; }
.sp__exam-card--soon   { background: #fffbeb; border-color: #fcd34d; }
.sp__exam-card--ok     { background: #f0fff4; border-color: #6ee7b7; }
.sp__exam-card--done   { background: #f9fafb; border-color: #e5e7eb; opacity: 0.6; }

.sp__exam-subject { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; }
.sp__exam-title   { font-size: 1rem; font-weight: 900; color: #1e1b4b; margin-bottom: 0.5rem; line-height: 1.3; }

.sp__exam-countdown {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.sp__exam-card--urgent .sp__exam-countdown { color: #dc2626; }
.sp__exam-card--soon   .sp__exam-countdown { color: #d97706; }
.sp__exam-card--ok     .sp__exam-countdown { color: #059669; }

.sp__exam-date  { font-size: 0.78rem; color: #6b7280; margin-bottom: 0.75rem; }
.sp__exam-actions { display: flex; gap: 0.4rem; }

.sp__exams-empty { text-align: center; padding: 2.5rem 1rem; color: #9ca3af; font-size: 0.93rem; }

/* ── Mini modal overlay for add block ────────────────────────────────────── */

.sp__mini-form {
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  padding: 0.75rem;
  margin-top: 0.4rem;
  display: none;
}

.sp__mini-form.open { display: block; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.sp__divider {
  border: none;
  border-top: 1.5px solid #e0e7ff;
  margin: 1.25rem 0;
}

.sp__section-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.sp__info-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  background: #eef2ff;
  border-radius: 8px;
  font-size: 0.83rem;
  color: #4338ca;
  font-weight: 600;
}

.sp__color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.sp__color-swatch:hover   { transform: scale(1.2); }
.sp__color-swatch.chosen  { border-color: #1e1b4b; }

.sp__colors-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }

.sp__pomodoro-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.sp__pom-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #e0e7ff;
}

.sp__pom-dot.done { background: #f87171; }
.sp__pom-dot.done:nth-child(4) { background: #fbbf24; }
