/* Workout Tracker - dark theme, iPhone 16 sized shell.
   The iPhone 16 logical viewport is 393 x 852 CSS px. We center a device-
   sized frame on larger screens and go full-bleed on actual phones. */

:root {
  --bg: #0b0d12;
  --surface: #151922;
  --surface-2: #1d2230;
  --border: #2a3140;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #4f8cff;
  --accent-2: #28406e;
  --danger: #ff5c5c;
  --ok: #38d39f;
  --radius: 14px;
  --device-w: 393px;
  --device-h: 852px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Device frame */
.device {
  width: var(--device-w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 420px) {
  body { padding: 24px 0; background: #05060a; }
  .device {
    min-height: var(--device-h);
    height: var(--device-h);
    border-radius: 42px;
    border: 10px solid #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
  }
}

.app-header {
  padding: 18px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.app-header h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.3px;
}

.app-header .back {
  color: var(--accent);
  text-decoration: none;
  font-size: 15px;
}

/* Link-styled button (e.g. Sign out in the header) */
.header-form { margin: 0; }
.linkbtn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
.linkbtn:active { opacity: 0.7; }

.content {
  flex: 1;
  padding: 18px 20px 32px;
  overflow-y: auto;
}

h2 { font-size: 17px; margin: 20px 0 10px; }
p.muted, .muted { color: var(--muted); font-size: 14px; }

/* Buttons - plain, flat */
.btn {
  display: block;
  width: 100%;
  padding: 15px 16px;
  margin: 10px 0;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:active { background: #262c3b; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { background: #3d78e8; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin: 10px 0; }

/* Checkbox selection list */
.check-list .check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  cursor: pointer;
}
.check-list li { padding: 0; }
.check-list .check-row { padding: 15px 16px; }

/* Search box */
.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px;
}
.search-form input[type="search"] { margin: 0; }
.search-clear { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }

/* List rows */
.list { list-style: none; margin: 0; padding: 0; }
.list a, .list .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  margin: 8px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.list .chevron { color: var(--muted); }
.list .tick { color: var(--ok); font-weight: 700; }
.badge {
  background: var(--accent-2);
  color: #cfe0ff;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
}

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%;
  padding: 13px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
}
input[type="checkbox"] { width: auto; transform: scale(1.3); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
.readonly-note {
  background: var(--accent-2);
  color: #cfe0ff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}
.errorlist { color: var(--danger); font-size: 13px; list-style: none; padding: 0; margin: 6px 0; }
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.messages li.success { border-left: 3px solid var(--ok); }

/* Repeat grid buttons */
.series-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.series-grid .rep {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.series-grid .rep.done { border-color: var(--ok); }
.series-grid .rep .n { font-size: 22px; font-weight: 600; }
.series-grid .rep .sub { font-size: 11px; color: var(--muted); }

/* Exercise image */
.exercise-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.image-placeholder {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Auth */
.auth-card { margin-top: 40px; }
.auth-card h1 { font-size: 26px; margin-bottom: 4px; }
.qr { display: block; margin: 16px auto; width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 8px; }
code.secret { display: block; word-break: break-all; background: var(--surface); padding: 10px; border-radius: 10px; font-size: 13px; margin-top: 8px; }

/* Image carousel */
.carousel { position: relative; }
.carousel-img.hidden { display: none; }
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.7);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-btn:active { background: rgba(30, 36, 48, 0.9); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-count {
  position: absolute;
  bottom: 10px;
  right: 12px;
  background: rgba(11, 13, 18, 0.7);
  color: var(--text);
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Instructions */
ol.instructions { margin: 8px 0 16px; padding-left: 20px; color: var(--text); }
ol.instructions li { margin: 0 0 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* Chart */
.chart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
canvas { max-width: 100%; }
