/* =====================================================
   Base reset & layout principles (learned from example)
   ===================================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}


.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
}

.dayControls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}


header {
  margin-bottom: 16px;
}

.headerRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.themeSelect {
  padding: 6px 10px;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  width: auto;
}


.sub {
  margin-top: 4px;
  color: var(--text);
}

/* darkmode */
:root {
  --bg: #f6f7fb;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --text: #111;
  --muted: #4c4a4a;
  --accent: #111;
  --border: #e5e5e5;
  --pill-bg: #f2f3f7;
  --btn-bg: #111;
  --btn-text: #fff;
  --pill-delete-bg: #e0e0e0;
  --pill-delete-text: #444;
}

h1,
h2,
h3 {
  color: var(--accent);
}

/* =====================================================
   Cards & structure
   ===================================================== */

.card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
}


/* =====================================================
   Form layout
   ===================================================== */

.row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0 12px;
}

.grid label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.grid .wide {
  grid-column: 1 / -1;
}

/* =====================================================
   Inputs — let the browser handle height
   ===================================================== */

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  background: var(--input-bg);
  color: var(--text);
}

::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}


/* =====================================================
   Buttons
   ===================================================== */

button {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 14px;
  cursor: pointer;
}


button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}


/* =====================================================
   Pill stack (summary + delete)
   ===================================================== */

.pillStack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Delete pill inherits .pill styles */
.pillDelete {
  background: var(--pill-delete-bg);
  color: var(--pill-delete-text);
  border: none;
  cursor: pointer;
}

.pillDelete:hover {
  background: #de6d93;
}




/* =====================================================
   Misc UI
   ===================================================== */

.msg {
  color: #b00020;
  margin: 10px 0 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 10px 0;
  background: var(--card-bg);
}

.itemTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.item.editing {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


.pill {
  font-size: 12px;
  color: var(--text);
  background: var(--pill-bg);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}


.notes {
  margin-top: 8px;
  color: var(--text);
}

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

/* =====================================================
   RPE (Perceived Effort) component
   ===================================================== */

.rpeRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 8px;
}

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

.rpeBtn {
  min-width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}


.rpeBtn:hover {
  background: #eaeaea;
}

.rpeBtn.active {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: var(--btn-bg);
}

/* =========================================
   Login spacing tweaks
   ========================================= */

#loginCard .row {
  margin-bottom: 18px;
  /* space between password field and login button */
}

/* =====================================================
   Mobile breakpoint — simple & predictable
   ===================================================== */

.btnPrimary {
  width: auto;
  min-width: 160px;
}


@media (max-width: 620px) {
  .wrap {
    padding: 16px;
  }

  .row {
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  #loginCard .row {
    margin-bottom: 22px;
  }

  /* Default: action buttons are full width */
  button {
    width: 100%;
  }

  /* RPE buttons opt out of full-width behavior */
  button.rpeBtn {
    width: auto;
  }

  button.btnPrimary {
    width: auto;
    align-self: flex-start;
  }

  /* Keep RPE scale left-aligned */
  .rpeScale {
    justify-content: flex-start;
  }
}

/* =========================================
   Button interaction feedback (Refresh)
   ========================================= */

button:active {
  transform: scale(0.97);
  opacity: 0.85;
}

button.ghost:active {
  background: #f2f3f7;
}

/* Keyboard + accessibility */
button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --card-bg: #171a21;
  --input-bg: #1f2430;
  --accent: #07c92f;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --border: #2a2f3a;
  --pill-bg: #222633;
  --btn-bg: #e6e6e6;
  --btn-text: #111;
  --pill-delete-bg: #2a2f3a;
  --pill-delete-text: #e6e6e6;
}

[data-theme="dark"] .muted {
  color: #b0b6c0;
}

[data-theme="dark"] button.ghost {
  color: var(--text);
  border-color: var(--border);
}

/* =====================================================
   Warm Dojo — Win95 retro with warm brown/orange
   ===================================================== */

[data-theme="warm-dojo"] {
  --bg: #1a1410;
  --card-bg: #231d17;
  --input-bg: #1a1410;
  --text: #e8ddd0;
  --muted: #a89882;
  --accent: #e8943a;
  --border: #3a3028;
  --pill-bg: #2c261e;
  --btn-bg: #2c241c;
  --btn-text: #e8ddd0;
  --hi: #5a4a38;
  --pill-delete-bg: #3a3028;
  --pill-delete-text: #e8ddd0;
}

/* =====================================================
   Classic 95 — authentic Win95 gray/teal
   ===================================================== */

[data-theme="classic-95"] {
  --bg: #008080;
  --card-bg: #c0c0c0;
  --input-bg: #ffffff;
  --text: #000000;
  --muted: #808080;
  --accent: #000080;
  --border: #808080;
  --pill-bg: #dfdfdf;
  --btn-bg: #c0c0c0;
  --btn-text: #000000;
  --hi: #dfdfdf;
  --pill-delete-bg: #c0c0c0;
  --pill-delete-text: #000000;
}

/* =====================================================
   Shared Win95 structural overrides
   ===================================================== */

[data-theme="warm-dojo"] .card,
[data-theme="classic-95"] .card {
  border-radius: 0;
  box-shadow: none;
  border: 2px outset var(--hi);
}

[data-theme="warm-dojo"] input,
[data-theme="warm-dojo"] select,
[data-theme="warm-dojo"] textarea,
[data-theme="classic-95"] input,
[data-theme="classic-95"] select,
[data-theme="classic-95"] textarea {
  border-radius: 0;
  border: 2px inset var(--hi);
}

[data-theme="warm-dojo"] input:focus,
[data-theme="warm-dojo"] select:focus,
[data-theme="warm-dojo"] textarea:focus,
[data-theme="classic-95"] input:focus,
[data-theme="classic-95"] select:focus,
[data-theme="classic-95"] textarea:focus {
  border-color: var(--accent);
}

[data-theme="warm-dojo"] button,
[data-theme="classic-95"] button {
  border-radius: 0;
  border: 2px outset var(--hi);
}

[data-theme="warm-dojo"] button:active,
[data-theme="classic-95"] button:active {
  border-style: inset;
  transform: none;
}

[data-theme="warm-dojo"] button.ghost,
[data-theme="classic-95"] button.ghost {
  border: 2px outset var(--hi);
  color: var(--text);
}

[data-theme="warm-dojo"] .item,
[data-theme="classic-95"] .item {
  border-radius: 0;
  border: 2px groove var(--hi);
}

[data-theme="warm-dojo"] .pill,
[data-theme="classic-95"] .pill {
  border-radius: 0;
}

[data-theme="warm-dojo"] .rpeBtn,
[data-theme="classic-95"] .rpeBtn {
  border-radius: 0;
  border: 2px outset var(--hi);
}

[data-theme="warm-dojo"] .rpeBtn:hover {
  background: #3a3028;
}

[data-theme="classic-95"] .rpeBtn:hover {
  background: #dfdfdf;
}

[data-theme="warm-dojo"] hr,
[data-theme="classic-95"] hr {
  border-top: 2px groove var(--hi);
}

[data-theme="warm-dojo"] button:focus-visible,
[data-theme="classic-95"] button:focus-visible {
  outline: 2px solid var(--accent);
}

[data-theme="warm-dojo"] button.ghost:active,
[data-theme="classic-95"] button.ghost:active {
  background: var(--pill-bg);
}

[data-theme="warm-dojo"] .btnPrimary,
[data-theme="classic-95"] .btnPrimary {
  background: var(--accent);
  color: #fff;
}