/* training-styles.css — NKBA Training Platform shared styles
   Used by training.html, training-workout.html, training-nutrition.html,
   training-progress.html, trainer-training.html, admin-training.html.
   Mobile-first. Tap targets >= 44px. */

:root {
  --primary:     #1A1A2E;
  --primary-alt: #111111;
  --accent:      #23A8E0;
  --accent-dark: #1a8fc0;
  --core:        #FF6B1A;
  --core-bg:     #fff4ec;
  --bg:          #f4f6f9;
  --card:        #ffffff;
  --text:        #1a1a2e;
  --text-light:  #6b7280;
  --text-muted:  #9ca3af;
  --border:      #e5e7eb;
  --border-dark: #d1d5db;
  --success:     #10b981;
  --success-bg:  #d1fae5;
  --warning:     #f59e0b;
  --warning-bg:  #fef3c7;
  --error:       #ef4444;
  --error-bg:    #fee2e2;
  --info-bg:     #dbeafe;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:   0 4px 16px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body.training {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.t-loading, .t-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
}
.t-error-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 420px;
}
.t-error-card h2 { color: var(--error); margin-bottom: 0.5rem; }
.t-error-card p { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1rem; }
.t-error-card a { color: var(--accent); }

/* ── Header ──────────────────────────────────────────────────────────────── */
.t-header {
  background: var(--primary);
  color: #fff;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.t-header-brand { display: flex; flex-direction: column; min-width: 0; }
.t-header-brand .t-title { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; }
.t-header-brand .t-sub { font-size: 0.72rem; color: rgba(255,255,255,0.65); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.t-header-actions a, .t-header-actions button {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 5px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.t-header-actions a:hover, .t-header-actions button:hover { background: rgba(255,255,255,0.22); }

/* ── Tab bar ──────────────────────────────────────────────────────────────── */
.t-tabs {
  background: #1a1a1a;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.t-tab {
  color: rgba(255,255,255,0.7);
  background: none;
  border: none;
  padding: 0.8rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.t-tab:hover { color: #fff; }
.t-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.t-panel { display: none; }
.t-panel.active { display: block; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.t-content { padding: 1.25rem 1rem 5rem; max-width: 900px; margin: 0 auto; }
.t-content-wide { max-width: 1200px; }
@media (min-width: 600px) { .t-content { padding: 1.5rem; } }

.t-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}
.t-h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }
.t-h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.t-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
  margin-bottom: 0.875rem;
}
.t-card-clickable { cursor: pointer; transition: box-shadow 0.15s, transform 0.08s; }
.t-card-clickable:hover { box-shadow: var(--shadow-lg); }
.t-card-clickable:active { transform: scale(0.995); }

/* Hero "Today's workout" card — bigger, tappable, accented */
.t-hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  margin-bottom: 1rem;
  transition: transform 0.08s;
}
.t-hero:active { transform: scale(0.99); }
.t-hero .t-hero-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.t-hero .t-hero-title { font-size: 1.45rem; font-weight: 800; margin-top: 0.3rem; line-height: 1.2; }
.t-hero .t-hero-meta { font-size: 0.85rem; margin-top: 0.5rem; opacity: 0.9; }
.t-hero .t-hero-cta { margin-top: 0.9rem; font-size: 0.85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.3rem; }

.t-hero-rest {
  background: #1a1a2e;
  color: #fff;
}
.t-hero-rest .t-hero-title { font-size: 1.25rem; }

/* ── Quick actions row ──────────────────────────────────────────────────── */
.t-quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.t-quick-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.t-quick-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.t-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.7rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}
.t-btn:hover { background: var(--accent-dark); }
.t-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.t-btn-block { display: flex; width: 100%; }
.t-btn-lg { padding: 0.9rem 1.25rem; font-size: 1rem; }
.t-btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.t-btn-ghost:hover { background: #f9fafb; border-color: var(--border-dark); }
.t-btn-danger { background: var(--error); }
.t-btn-danger:hover { background: #dc2626; }
.t-btn-success { background: var(--success); }
.t-btn-success:hover { background: #059669; }
.t-btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; min-height: 36px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.t-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.t-badge-active   { background: var(--success-bg); color: #065f46; }
.t-badge-inactive { background: #f3f4f6; color: #6b7280; }
.t-badge-warning  { background: var(--warning-bg); color: #92400e; }
.t-badge-info     { background: var(--info-bg); color: #1e40af; }
.t-badge-core     { background: var(--core-bg); color: var(--core); border: 1px solid #ffd1b3; }
.t-badge-head     { background: #ede9fe; color: #5b21b6; }
.t-badge-trainer-logged {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.t-field { margin-bottom: 0.85rem; }
.t-field label { display: block; font-weight: 600; font-size: 0.82rem; margin-bottom: 0.3rem; color: var(--text); }
.t-field input[type=text],
.t-field input[type=email],
.t-field input[type=number],
.t-field input[type=date],
.t-field input[type=time],
.t-field input[type=tel],
.t-field input[type=url],
.t-field input[type=search],
.t-field select,
.t-field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  min-height: 44px;
}
.t-field textarea { min-height: 80px; resize: vertical; }
.t-field input:focus, .t-field select:focus, .t-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35,168,224,0.12);
}
.t-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 440px) { .t-field-row { grid-template-columns: 1fr; } }

/* RPE slider */
.t-rpe-wrap { display: flex; align-items: center; gap: 0.75rem; }
.t-rpe-wrap input[type=range] { flex: 1; }
.t-rpe-value { font-weight: 700; font-size: 1rem; min-width: 1.8rem; text-align: center; color: var(--accent); }

/* ── Set logging grid ────────────────────────────────────────────────────── */
.t-set-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.t-set-row .t-set-label { font-weight: 700; font-size: 0.82rem; color: var(--text-light); text-align: center; }
.t-set-row input {
  padding: 0.55rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  min-height: 44px;
  font-family: inherit;
  text-align: center;
}
.t-set-row input:focus { outline: none; border-color: var(--accent); }

/* ── Exercise cards ──────────────────────────────────────────────────────── */
.t-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.25rem 0 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
}
.t-section-header .t-section-letter {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 1.25rem;
}
.t-section-header .t-section-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* Core sections — distinct orange highlight */
.core-section,
.t-section-header.core-section {
  border-left-color: var(--core);
  background: var(--core-bg);
}
.t-section-header.core-section .t-section-letter { color: var(--core); }
.t-section-header.core-section .t-section-label { color: #7a2e00; }
.core-section .t-core-category {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--core);
  background: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  border: 1px solid #ffd1b3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.t-exercise {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.t-exercise-head {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
}
.t-exercise-head .t-exercise-name { font-weight: 700; font-size: 0.95rem; }
.t-exercise-head .t-exercise-meta { font-size: 0.78rem; color: var(--text-light); margin-top: 0.15rem; }
.t-exercise-head .t-chevron { color: var(--text-muted); font-size: 1.1rem; transition: transform 0.2s; }
.t-exercise.open .t-chevron { transform: rotate(180deg); }
.t-exercise-body { display: none; padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.t-exercise.open .t-exercise-body { display: block; }
.t-exercise.core-section { border-left: 4px solid var(--core); }

.t-form-cues {
  background: #f9fafb;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text);
  margin: 0.65rem 0;
  line-height: 1.45;
}
.t-form-cues strong { font-weight: 700; }

.t-youtube-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 0.5rem;
}
.t-youtube-link:hover { text-decoration: underline; }

/* ── Compliance strip / dots ─────────────────────────────────────────────── */
.t-compliance-strip {
  display: flex;
  gap: 0.35rem;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 0.875rem;
}
.t-compliance-day {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.t-compliance-day .t-day-letter { font-size: 0.68rem; color: var(--text-light); font-weight: 600; }
.compliance-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e5e7eb;
  display: inline-block;
  transition: background 0.15s;
}
.compliance-dot.logged  { background: var(--success); }
.compliance-dot.missed  { background: #fecaca; }
.compliance-dot.rest    { background: #c7d2fe; }
.compliance-dot.today   { box-shadow: 0 0 0 3px rgba(35,168,224,0.3); }

/* 30-day calendar */
.t-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0.75rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.t-cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.t-cal-cell.logged { background: var(--success); color: #fff; }
.t-cal-cell.rest   { background: #c7d2fe; color: #312e81; }
.t-cal-cell.missed { background: #fecaca; color: #7f1d1d; }
.t-cal-cell.future { background: transparent; }

/* ── Progress bars (nutrition targets) ──────────────────────────────────── */
.t-progress-wrap { margin-bottom: 0.85rem; }
.t-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}
.t-progress-label .t-progress-val { font-weight: 700; color: var(--text); }
.t-progress-track { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.t-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.t-progress-fill.over { background: var(--warning); }
.t-progress-fill.hit  { background: var(--success); }

/* ── Stats / KPIs ────────────────────────────────────────────────────────── */
.t-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.t-kpi {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
}
.t-kpi .t-kpi-num { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.t-kpi .t-kpi-lbl { font-size: 0.72rem; color: var(--text-light); margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.t-kpi.alert .t-kpi-num { color: var(--error); }
.t-kpi.success .t-kpi-num { color: var(--success); }

.t-streak {
  background: linear-gradient(135deg, #FF6B1A 0%, #dc2626 100%);
  color: #fff;
  text-align: center;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 0.875rem;
}
.t-streak-num { font-size: 2.5rem; font-weight: 900; line-height: 1; }
.t-streak-lbl { font-size: 0.85rem; opacity: 0.95; margin-top: 0.25rem; letter-spacing: 0.04em; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.t-table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.t-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.t-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: #f9fafb;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.t-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
.t-table tr:hover td { background: #f9fafb; }
.t-table tr:last-child td { border-bottom: none; }

/* ── Messages / empty states ─────────────────────────────────────────────── */
.t-msg {
  padding: 0.6rem 0.85rem;
  border-radius: 5px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.t-msg-success { background: var(--success-bg); color: #065f46; }
.t-msg-error   { background: var(--error-bg);   color: #991b1b; }
.t-msg-info    { background: var(--info-bg);    color: #1e40af; }
.t-msg-warn    { background: var(--warning-bg); color: #92400e; }

.t-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-light);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.t-empty strong { display: block; color: var(--text); margin-bottom: 0.35rem; }

/* ── Modal / overlay ─────────────────────────────────────────────────────── */
.t-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.t-overlay.open { display: flex; }
.t-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.t-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.t-modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.t-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); line-height: 1; }
.t-modal-body { padding: 1.25rem; }

/* Slide-in panel (session detail in admin) */
.t-panel-slide {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 640px;
  height: 100%;
  background: #fff;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  padding: 1.5rem;
}

/* ── Spinner / loading ───────────────────────────────────────────────────── */
.t-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.1);
  border-left-color: var(--accent);
  border-radius: 50%;
  animation: t-spin 0.6s linear infinite;
}
@keyframes t-spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.nkba-toast-container {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.nkba-toast {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 420px;
  pointer-events: auto;
}
.nkba-toast.visible { opacity: 1; transform: translateY(0); }
.nkba-toast-success { background: var(--success); }
.nkba-toast-error   { background: var(--error); }
.nkba-toast-info    { background: var(--accent); }

/* ── Warm-up checklist ───────────────────────────────────────────────────── */
.t-checklist { margin: 0.25rem 0 0.5rem; }
.t-checklist-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.t-checklist-item:last-child { border-bottom: none; }
.t-checklist-item input[type=checkbox] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.t-checklist-item.done { color: var(--text-muted); text-decoration: line-through; }

/* ── Admin nav parity (matches existing admin-*.html look) ───────────────── */
.t-admin-nav {
  background: #1a1a1a;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.t-admin-nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 0.75rem 1.15rem;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.t-admin-nav a:hover { color: #fff; }
.t-admin-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
