/* ==========================================================
   MasteryOS styles
   Sections: 1 Theme colors | 2 Base | 3 Buttons and inputs |
             4 Dashboard | 5 Skill page | 6 Timer bar | 7 Popups
   ========================================================== */


/* ---------- 1. Theme colors (change colors here only) ---------- */

:root {
  --bg: #EEF1F6;
  --card: #FFFFFF;
  --ink: #18212F;
  --muted: #5B6678;
  --line: #D5DBE6;
  --accent: #0F766E;
  --on-accent: #FFFFFF;
  --warn: #B45309;
  --warn-bg: #FEF3E2;
}

[data-theme="dark"] {
  --bg: #121722;
  --card: #1B2230;
  --ink: #E7ECF4;
  --muted: #9AA6BA;
  --line: #2C3648;
  --accent: #3CC4B5;
  --on-accent: #0B1A18;
  --warn: #F2A950;
  --warn-bg: #3A2D17;
}


/* ---------- 2. Base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 80px;   /* space so the timer bar never covers content */
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

main,
.top,
footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  padding-bottom: 8px;
}

.top h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.5rem;
  cursor: pointer;
}

.brand {
  width: 28px;
  height: 28px;
}

footer {
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.8rem;
}

h2 {
  margin: 28px 0 12px;
  font-size: 1.15rem;
}

h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
}


/* ---------- 3. Buttons and inputs ---------- */

button {
  font: inherit;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button.danger {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}

input,
select {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}

/* Visible outline for keyboard users */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}


/* ---------- 4. Dashboard ---------- */

/* Three summary boxes: studied today, streak, due count */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.stats div {
  flex: 1 1 200px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.stats strong {
  display: block;
  font-size: 1.6rem;
  color: var(--ink);
}

/* "Time to revise" panel */
.due {
  margin-top: 20px;
  padding: 4px 16px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: 8px;
}

.due h2 {
  margin-top: 12px;
  color: var(--warn);
}

.due li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.due li span {
  flex: 1 1 220px;
}

/* Skill cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.card {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.card:hover {
  border-color: var(--accent);
}

.card h3 {
  margin: 0 0 8px;
}

/* Progress bar: the inner <i> width is set from JavaScript */
.bar {
  height: 8px;
  margin: 8px 0;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* Skill icon: a letter badge with the logo image laid over it */
.icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  vertical-align: middle;
  overflow: hidden;
}

.icon img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 3px;
  background: #FFFFFF;   /* white tile keeps dark logos (Express, Next.js) visible in dark theme */
}


/* ---------- 5. Skill page ---------- */

/* Add-topic form, filter dropdown, delete button */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.toolbar form {
  display: flex;
  flex: 1 1 280px;
  gap: 8px;
}

.toolbar input[name="title"] {
  flex: 1;
}

/* One topic row: checkbox on the left, details and buttons on the right */
.topic {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin-bottom: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topic.done .name {
  text-decoration: line-through;
  color: var(--muted);
}

.topic .actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.topic .actions button {
  padding: 3px 10px;
  font-size: 0.85rem;
}

.badge {
  padding: 0 8px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 10px;
  font-size: 0.8rem;
}


/* ---------- 6. Timer bar (fixed at the bottom while studying) ---------- */

#timerbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px;
  background: var(--accent);
  color: var(--on-accent);
}

#timerbar[hidden] {
  display: none;
}

#timerbar #clock {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;   /* digits keep equal width, no jitter */
}

#timerbar button {
  background: var(--on-accent);
  color: var(--accent);
  border-color: var(--on-accent);
}


/* ---------- 7. Popups (Add skill, Settings) ---------- */

dialog {
  width: 92%;
  max-width: 480px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog h2 {
  margin-top: 0;
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

dialog label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
