/* ============================================================
   styles.css — LAYOUT & COMPONENTS
   These are the rules for how things are placed and sized.
   It's OK to look around, but if you only want to change
   COLORS or FONTS, edit theme.css instead. It's much friendlier.
   ============================================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ---- Welcome overlay --------------------------------------- */
#welcome-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; padding: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
#welcome-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#welcome-screen h1     { font-size: 3rem; font-weight: 800; margin-bottom: 15px; }
.welcome-emoji         { font-size: 5.5rem; margin-bottom: 20px; animation: bounce 2s infinite; }
.subtitle              { color: var(--muted); font-size: 1.2rem; margin-bottom: 45px; max-width: 550px; line-height: 1.6; }
.launch-btn            { font-size: 1.25rem; padding: 18px 45px; border-radius: 50px; box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35); }

/* ---- Sidebar ----------------------------------------------- */
nav {
  width: var(--sidebar-width);
  background: var(--nav-bg);
  color: white;
  display: flex; flex-direction: column;
  padding: 25px;
  box-shadow: 5px 0 15px rgba(0,0,0,0.1);
  z-index: 10;
  overflow-y: auto;
  transition: background 0.3s;
}
nav h1 {
  font-size: 1.3rem; color: #1fdbf0;
  margin: 0 0 30px; text-align: center; font-weight: 800;
}
nav button {
  background: none; border: none; color: #2b5da2;
  text-align: left; padding: 14px; cursor: pointer;
  border-radius: 12px; margin-bottom: 8px;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  font-size: 1rem; font-family: inherit;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
}
nav button:hover         { background: rgba(255,255,255,0.05); color: white; transform: translateX(5px); }
nav button:focus-visible { outline: 2px solid #18732f; outline-offset: 2px; }
nav button.active        { background: var(--primary); color: white; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }

/* ---- Main area & pages ------------------------------------- */
main { flex: 1; padding: 40px; overflow-y: auto; scroll-behavior: smooth; }

.page { display: none; max-width: 900px; margin: auto; animation: slideUp 0.4s ease; }
.page.active { display: block; }

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

/* ---- Cards & inputs ---------------------------------------- */
.card {
  background: var(--card-bg);
  padding: 25px;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
  margin-bottom: 25px;
  border: 1px solid var(--border);
  transition: background 0.3s, border 0.3s;
}
.center { text-align: center; }

input, select, textarea {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 100%;
  margin-bottom: 12px;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary);
}

.btn-main {
  background: var(--primary); color: white; border: none;
  padding: 12px 20px; border-radius: 12px;
  cursor: pointer; font-weight: 700;
  transition: filter 0.2s, transform 0.2s;
  font-family: inherit; font-size: 1rem;
}
.btn-main:hover         { filter: brightness(1.1); transform: translateY(-2px); }
.btn-main:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn-main.full          { width: 100%; }
.btn-danger             { background: var(--accent); }
.settings-dark          { background: #334155; }
.settings-label         { display: block; margin-bottom: 8px; font-weight: bold; }

/* ---- Dashboard --------------------------------------------- */
.quote        { font-style: italic; color: var(--muted); }
.hr-faint     { opacity: 0.1; margin: 20px 0; }
.stats-grid   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; text-align: center; }
.stats-grid h4{ margin: 0; color: var(--muted); }
.stat-num     { font-size: 2.5rem; font-weight: 800; }
.stat-primary { color: var(--primary); }
.stat-warning { color: var(--warning); }
.stat-success { color: var(--success); }

/* ---- Tasks ------------------------------------------------- */
.task-form-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr auto; gap: 10px; }
.plain-list     { list-style: none; padding: 0; }

.priority-high { border-left: 6px solid var(--accent)  !important; }
.priority-med  { border-left: 6px solid var(--warning) !important; }
.priority-low  { border-left: 6px solid var(--success) !important; }

.category-badge {
  font-size: 0.7rem; background: var(--border);
  padding: 2px 8px; border-radius: 10px;
  color: var(--muted); font-weight: bold;
  margin-right: 5px; text-transform: uppercase;
}

.overdue-alert {
  background: var(--overdue-bg);
  border: 2px solid var(--accent);
  color: var(--overdue-text);
  padding: 15px; border-radius: 12px;
  margin-bottom: 20px; font-weight: bold;
}

.task-row {
  background: var(--card-bg); padding: 12px;
  border-radius: 12px; margin-bottom: 8px;
  display: flex; align-items: center;
  border: 1px solid var(--border);
}
.task-row .body              { flex: 1; }
.task-row .body.completed    { text-decoration: line-through; opacity: 0.5; }
.task-row .delete-btn,
.grade-row .delete-btn       { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 1rem; }
.history                     { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 10px; }
.history summary             { cursor: pointer; }

/* ---- Tools ------------------------------------------------- */
.grid-2          { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#pomodoro-display{ font-size: 3.5rem; font-weight: 800; color: var(--text); margin: 15px 0; }
.timer-controls  { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.muted           { color: var(--muted); }
.small           { font-size: 0.85rem; }
.result          { margin-top: 10px; font-weight: bold; color: var(--primary); }

/* ---- Grades ------------------------------------------------ */
.grade-form-grid { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; }
.grade-row       { padding: 8px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.grade-row .subject { flex: 1; }

/* ---- Notes ------------------------------------------------- */
#noteContent { min-height: 240px; }

/* ---- Sketchpad --------------------------------------------- */
.brush-row {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 10px; flex-wrap: wrap;
}
.brush-btn {
  padding: 8px 12px; border-radius: 10px;
  border: 2px solid transparent;
  background: var(--border); cursor: pointer; font-size: 1.2rem;
  font-family: inherit;
}
.brush-btn.active { border-color: var(--primary); }

canvas {
  border: 3px solid var(--border);
  background: white;
  cursor: crosshair;
  border-radius: var(--radius);
  display: block; margin: 0 auto;
  touch-action: none;
  max-width: 100%;
}

/* ---- Math Blitz -------------------------------------------- */
.math-display       { font-size: 4rem; font-weight: 900; color: var(--primary); text-align: center; min-height: 5rem; }
#timer-bar-container{ width: 100%; height: 10px; background: var(--border); border-radius: 5px; margin-bottom: 20px; overflow: hidden; }
#timer-bar          { width: 100%; height: 100%; background: var(--accent); transition: width 0.1s linear; }
#math-feedback      { margin-top: 10px; font-weight: bold; min-height: 1.2em; }
.blitz-controls     { display: flex; gap: 8px; justify-content: center; }

/* ---- Mobile ------------------------------------------------ */
@media (max-width: 700px) {
  body { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; }
  nav  { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  nav h1 { width: 100%; margin-bottom: 10px; }
  nav button { width: auto; margin: 4px; padding: 8px 12px; font-size: 0.9rem; }
  main { padding: 20px; }
  .grid-2, .stats-grid, .task-form-grid, .grade-form-grid {
    grid-template-columns: 1fr !important;
  }
}
