/* ============================================================
   Treningsweb — sporty mørk stil
   ============================================================ */

:root {
  /* Palette */
  --bg: #0a0f1c;
  --bg-elevated: #131a2e;
  --bg-card: #1a2238;
  --bg-card-hover: #212a44;
  --border: #2a3454;
  --border-strong: #3a466b;

  --text: #f5f7fa;
  --text-muted: #8d97b5;
  --text-dim: #5d6680;

  --accent: #ff6b00;
  --accent-hover: #ff8124;
  --accent-dim: rgba(255, 107, 0, 0.15);

  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.15);
  --danger: #ef4444;
  --warn: #fbbf24;
  --info: #60a5fa;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 8px 24px rgba(0, 0, 0, 0.5);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui,
          'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 88px;
  padding-top: env(safe-area-inset-top);
}

/* ============================================================
   Header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(10, 15, 28, 0.85) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 14px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.app-header__logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header__logo .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}
.app-header__action {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.app-header__action:hover { color: var(--text); background: var(--bg-elevated); }

/* ============================================================
   Week banner
   ============================================================ */
.week-banner {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.week-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, var(--accent-dim), transparent 60%);
  pointer-events: none;
}
.week-banner__row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.week-banner__week {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.week-banner__week .num {
  color: var(--accent);
}
.week-banner__day {
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.week-banner__focus {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.week-banner__tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag.tag--accent { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.tag.tag--success { background: var(--success-dim); color: var(--success); border-color: var(--success); }

/* ============================================================
   Workout card
   ============================================================ */
.okt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.okt-card__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.okt-card__meta {
  display: flex;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.okt-card__meta span::before {
  content: '•';
  margin-right: 6px;
  color: var(--text-dim);
}
.okt-card__meta span:first-child::before { display: none; }
.okt-card__desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}
.okt-card__format {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--text);
  margin-top: 12px;
}

/* ============================================================
   Exercise card
   ============================================================ */
.exercise {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.exercise.is-done {
  border-color: var(--success);
  background: linear-gradient(180deg, var(--success-dim) 0%, var(--bg-card) 60%);
}
.exercise__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.exercise__num {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-weight: 800;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.exercise.is-done .exercise__num {
  background: var(--success);
  color: var(--bg);
  border-color: var(--success);
}
.exercise__name {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  margin: 4px 0 2px;
}
.exercise__sets {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.exercise.is-done .exercise__sets { color: var(--success); }
.exercise__desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.exercise__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.chip {
  font-size: 11px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.exercise__note {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ============================================================
   Feedback buttons
   ============================================================ */
.fb-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 700;
}
.fb-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
@media (min-width: 480px) {
  .fb-group { grid-template-columns: repeat(4, 1fr); }
}
.fb-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: center;
}
.fb-btn:hover:not(.is-selected) {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.fb-btn.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.fb-btn[data-value="For lett"].is-selected,
.fb-btn[data-value="Akkurat passe"].is-selected,
.fb-btn[data-value="Tung men OK"].is-selected,
.fb-btn[data-value="For tung"].is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
textarea.exercise__comment,
textarea.global__notater {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  outline: none;
}
textarea:focus { border-color: var(--accent); }

/* ============================================================
   Complete-section
   ============================================================ */
.complete-section {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-strong);
}
.complete-section h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(255, 107, 0, 0.3);
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* ============================================================
   Login
   ============================================================ */
.login {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.login__logo {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.login__logo .dot {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 24px var(--accent);
}
.login__tagline {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}
.login__form {
  width: 100%;
  max-width: 280px;
}
.login__input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 24px;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius);
  letter-spacing: 0.4em;
  font-family: inherit;
  outline: none;
  margin-bottom: 12px;
}
.login__input:focus { border-color: var(--accent); }
.login__error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

/* ============================================================
   History view
   ============================================================ */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 24px 0 12px;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-item__main {
  flex: 1;
  min-width: 0;
}
.history-item__title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}
.history-item__meta {
  font-size: 12px;
  color: var(--text-muted);
}
.history-item__icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elevated);
}

/* ============================================================
   Bottom nav
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 15, 28, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.bottom-nav__btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.bottom-nav__btn.is-active { color: var(--accent); }
.bottom-nav__btn svg { width: 22px; height: 22px; }

/* ============================================================
   Misc
   ============================================================ */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-strong);
  z-index: 100;
  animation: toast-in 0.3s ease;
}
.toast.toast--error { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Rest-day card */
.rest-day {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.rest-day__emoji { font-size: 48px; margin-bottom: 8px; }
.rest-day__title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.rest-day__desc { color: var(--text-muted); font-size: 14px; }
