/* ==============================================
   STUDENT SURVIVAL DASHBOARD — style.css
   Aesthetic: Clean academic-utility with amber accents
   Fonts: Syne (headings) + DM Sans (body)
   ============================================== */

/* ── CSS Variables (Design Tokens) ── */
:root {
  --bg:           #0f0f13;        /* deep dark background */
  --bg-card:      #1a1a24;        /* card background */
  --bg-input:     #12121a;        /* input fields */
  --border:       #2a2a3a;        /* subtle borders */

  --accent:       #f5a623;        /* amber — primary accent */
  --accent-soft:  rgba(245,166,35,0.12);
  --accent-hover: #e69510;

  --green:        #2dd4a0;        /* done/success */
  --red:          #ff5e5e;        /* danger/over-budget */
  --blue:         #5e9fff;        /* info */

  --text-primary:   #f0eff8;
  --text-secondary: #8e8da0;
  --text-muted:     #5a5970;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.5);

  --transition: 0.2s ease;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  /* subtle noise texture overlay */
  background-image: radial-gradient(ellipse at 20% 20%, rgba(245,166,35,0.04) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 80%, rgba(94,159,255,0.04) 0%, transparent 60%);
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #1a1a24 0%, #12121a 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.logo-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(245,166,35,0.6));
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.header-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  padding: 1rem 1rem 0;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tab-btn:hover {
  background: rgba(245,166,35,0.08);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--border);
  border-bottom: 2px solid var(--accent);
  position: relative;
  z-index: 2;
}

.tab-icon { font-size: 1rem; }
.tab-label { white-space: nowrap; }

/* ── Main Content ── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ── Tab Sections ── */
.tab-section {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.tab-section.active {
  display: block;
  padding-top: 2rem;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section Header ── */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* ── Input Row ── */
.input-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.input-row.tight {
  flex-wrap: nowrap;
  margin-top: 0.4rem;
}

/* ── Inputs ── */
.text-input,
.select-input,
.textarea-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Make the main task/expense/habit text input grow */
.text-input {
  flex: 1;
  min-width: 160px;
}

.select-input {
  min-width: 120px;
  cursor: pointer;
}

.amount-input {
  max-width: 140px;
  flex: none;
}

.textarea-input {
  width: 100%;
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #0f0f13;
  box-shadow: 0 2px 12px rgba(245,166,35,0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 18px rgba(245,166,35,0.45);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.14);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

/* ── Stats Row (chips) ── */
.stats-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.stat-chip span {
  font-weight: 700;
  color: var(--text-primary);
}

.stat-chip.done span { color: var(--green); }
.stat-chip.pending span { color: var(--accent); }
.stat-chip.over span { color: var(--red); }

/* ── Item Lists (Tasks & Expenses) ── */
.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.item-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: border-color var(--transition), background var(--transition);
  animation: fadeSlideIn 0.25s ease;
}

.item-list li:hover {
  border-color: var(--text-muted);
}

/* Completed task style */
.item-list li.done .item-text {
  text-decoration: line-through;
  opacity: 0.5;
}

.item-text {
  flex: 1;
  font-size: 0.92rem;
}

/* Priority badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-high   { background: rgba(255,94,94,0.15); color: var(--red); }
.badge-medium { background: rgba(245,166,35,0.15); color: var(--accent); }
.badge-low    { background: rgba(45,212,160,0.15); color: var(--green); }

/* Category badge */
.badge-category {
  background: rgba(94,159,255,0.12);
  color: var(--blue);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-weight: 600;
}

/* Expense amount */
.expense-amount {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  min-width: 72px;
  text-align: right;
}

/* Delete button on items */
.delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  line-height: 1;
}

.delete-btn:hover {
  color: var(--red);
  background: rgba(255,94,94,0.1);
}

/* Checkbox for tasks */
.task-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Timer ── */
.timer-card {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.timer-modes {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

.mode-btn {
  padding: 0.45rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.mode-btn.active,
.mode-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.timer-display {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 0.6rem;
  text-shadow: 0 0 40px rgba(245,166,35,0.25);
}

.timer-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.timer-controls {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.timer-stats {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Budget / Expense Summary ── */
.budget-card {
  margin-bottom: 1rem;
}

.budget-display {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.budget-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.3rem;
}

.budget-amount {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.budget-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.budget-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 100px;
  transition: width 0.4s ease, background 0.4s ease;
}

.budget-bar.over {
  background: var(--red);
}

.budget-status {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ── Habit Tracker ── */
.date-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.date-display span {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.habit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.habit-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: border-color var(--transition), background var(--transition);
  animation: fadeSlideIn 0.25s ease;
}

.habit-item:hover {
  border-color: var(--text-muted);
}

/* Checked habit */
.habit-item.checked {
  border-color: var(--green);
  background: rgba(45,212,160,0.05);
}

.habit-checkbox {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

.habit-name {
  flex: 1;
  font-size: 0.92rem;
  transition: opacity var(--transition);
}

.habit-item.checked .habit-name {
  text-decoration: line-through;
  opacity: 0.55;
}

/* Streak badge */
.streak-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  min-width: 48px;
  justify-content: center;
}

/* ── AI Helper ── */
.api-card {
  background: rgba(94,159,255,0.05);
  border-color: rgba(94,159,255,0.2);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.ai-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.9rem;
}

.ai-output-card {
  border-color: rgba(94,159,255,0.2);
}

.ai-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.ai-output {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Loading spinner */
.ai-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 0.8rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ── Scrollbar (Webkit) ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 479px) {
  .logo-text  { font-size: 1.4rem; }
  .header     { padding: 1rem; }

  .tab-nav    { gap: 0.2rem; padding: 0.8rem 0.5rem 0; }
  .tab-btn    { padding: 0.55rem 0.7rem; font-size: 0.78rem; }
  .tab-label  { display: none; } /* icon-only on very small screens */

  .input-row  { flex-direction: column; }
  .text-input { min-width: 100%; }
  .select-input,
  .amount-input { width: 100%; max-width: 100%; }

  .budget-display { flex-direction: column; }
  .budget-amount  { font-size: 1.6rem; }

  .timer-controls { gap: 0.5rem; }
  .btn            { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
}

/* ── Tablet: 480px–767px ── */
@media (min-width: 480px) and (max-width: 767px) {
  .tab-btn  { padding: 0.6rem 0.9rem; }
  .tab-label { font-size: 0.82rem; }

  .input-row {
    flex-wrap: wrap;
  }

  .text-input { min-width: 200px; }
}

/* ── Tablet landscape / small laptop: 768px–1023px ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .tab-nav { gap: 0.4rem; }
  .tab-btn { font-size: 0.88rem; }

  .main-content { padding: 0 1.5rem 3rem; }

  .section-header h2 { font-size: 1.8rem; }
}

/* ── Laptop: 1024px–1439px ── */
@media (min-width: 1024px) {
  body { font-size: 1rem; }

  .header { padding: 2rem 1rem; }
  .logo-text { font-size: 2rem; }

  .main-content { padding: 0 2rem 3rem; }

  .tab-nav { gap: 0.5rem; }
  .tab-btn { padding: 0.7rem 1.4rem; font-size: 0.92rem; }

  /* Two-column layout for tasks section stats */
  .stats-row { gap: 0.8rem; }

  .section-header h2 { font-size: 2rem; }
}

/* ── Wide Desktop: 1440px+ ── */
@media (min-width: 1440px) {
  .main-content { max-width: 1100px; }
  .header-inner { max-width: 1100px; }
  .tab-nav      { max-width: 1100px; }
}