/* Klariti v8 - Style C: Warm Wellness (Klariti palette) */

:root {
  --bg: #f0f5f7;
  --surface: #ffffff;
  --surface-warm: #f6fafb;
  --border: #dce8ec;
  --border-soft: #e8f0f3;
  --text: #1a2a30;
  --text-2: #4b6068;
  --text-3: #8ba4ad;
  --accent: #5a9ab5;
  --accent-soft: rgba(90,154,181,0.08);
  --accent-mid: rgba(90,154,181,0.15);
  --accent-deep: #4a859e;
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.08);
  --r: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --bar-h: 88px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: var(--font); }

/* ═══ AUTH ═══ */
.auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border-radius: var(--r-xl); padding: 36px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo { width: 72px; height: 72px; object-fit: contain; }
.auth-tagline { font-size: 0.85rem; color: var(--text-3); margin-top: 4px; }
.field { margin-bottom: 10px; }
.field input {
  width: 100%; padding: 10px 14px;
  background: var(--surface-warm); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text); font-size: 0.9rem; outline: none;
}
.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-3); }
.btn-primary {
  width: 100%; padding: 10px; margin-top: 4px;
  background: var(--accent); color: white;
  font-weight: 600; font-size: 0.9rem; border-radius: var(--r-md);
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-deep); }
.auth-switch { text-align: center; font-size: 0.8rem; color: var(--text-3); margin-top: 12px; }
.auth-error { background: #fef2f2; color: #dc2626; font-size: 0.8rem; padding: 8px 12px; border-radius: var(--r); margin-top: 12px; display: none; }
.auth-error.visible { display: block; }

/* ═══ DASHBOARD (Bento Grid) ═══ */
.dash-screen { position: fixed; inset: 0; background: var(--bg); overflow-y: auto; }
.dash-screen.has-player { bottom: var(--bar-h); }

.dash-container { max-width: 1000px; margin: 0 auto; padding: 0 28px; }

.dash-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0;
}
.dash-logo { height: 42px; }
.dash-spacer { flex: 1; }
.dash-user-name { font-size: 0.85rem; color: var(--text-2); }
.dash-logout { font-size: 0.8rem; color: var(--text-3); margin-left: 12px; }

/* Bento Grid */
.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-bottom: 32px;
}

.bento-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

/* Welcome */
.bento-welcome { grid-column: span 2; display: flex; flex-direction: column; justify-content: center; }
.bento-welcome h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.bento-welcome p { font-size: 0.85rem; color: var(--text-2); line-height: 1.6; }
.bento-date { font-size: 0.72rem; color: var(--text-3); margin-top: 8px; }

/* Stats ring */
.bento-stats-ring { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.dash-ring { width: 80px; height: 80px; margin-bottom: 10px; }
.dash-ring circle { fill: none; stroke-width: 5; }
.dash-ring-track { stroke: var(--border-soft); }
.dash-ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.dash-ring-pct { font-size: 1.2rem; font-weight: 700; color: var(--accent-deep); }
.dash-ring-label { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }

/* Active program */
.bento-program {
  grid-column: span 3;
  display: flex; gap: 24px; align-items: center;
  cursor: pointer; transition: box-shadow 0.2s;
}
.bento-program:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

.bento-program-art { width: 120px; height: 120px; border-radius: var(--r-lg); flex-shrink: 0; overflow: hidden; }
.bento-program-art-bg { width: 100%; height: 100%; }
.bento-program-info { flex: 1; }
.bento-program-tag { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.bento-program-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.bento-program-meta { font-size: 0.78rem; color: var(--text-3); margin-bottom: 12px; }
.bento-program-bar { height: 5px; background: var(--border-soft); border-radius: 4px; overflow: hidden; max-width: 280px; }
.bento-program-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.bento-program-btn {
  padding: 10px 22px; background: var(--accent); color: white;
  border-radius: var(--r-md); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.bento-program-btn:hover { background: var(--accent-deep); }

/* Quick actions */
.bento-action {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; cursor: pointer;
  transition: background 0.15s; min-height: 120px;
}
.bento-action:hover { background: var(--surface-warm); }

.bento-action-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.bento-action-icon i { width: 20px; height: 20px; }
.bento-action-icon.blue { background: var(--accent-soft); color: var(--accent); }
.bento-action-icon.green { background: rgba(34,197,94,0.08); color: var(--success); }
.bento-action-icon.amber { background: rgba(249,216,156,0.3); color: #c49a4a; }

.bento-action-title { font-size: 0.82rem; font-weight: 600; }
.bento-action-desc { font-size: 0.68rem; color: var(--text-3); margin-top: 2px; }

/* Programs list */
.bento-programs-list { grid-column: span 3; }
.bento-programs-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 600; margin-bottom: 14px;
}
.bento-programs-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.bento-programs-grid::-webkit-scrollbar { height: 4px; }
.bento-programs-grid::-webkit-scrollbar-track { background: transparent; }
.bento-programs-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.dash-prog-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px;
  background: var(--surface-warm); cursor: pointer; transition: background 0.15s;
  min-width: 220px; flex-shrink: 0;
}
.dash-prog-mini:hover { background: var(--accent-soft); }
.dash-prog-mini-art { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.dash-prog-mini-name { font-size: 0.78rem; font-weight: 600; }
.dash-prog-mini-meta { font-size: 0.66rem; color: var(--text-3); }
.dash-prog-mini-tag { font-size: 0.62rem; color: var(--text-3); margin-left: auto; white-space: nowrap; }

/* Checkin done state */
.bento-action.checked-in { opacity: 0.7; }
.bento-action.checked-in .bento-action-icon.green { background: rgba(34,197,94,0.15); }

/* ═══ PROGRAM SCREEN ═══ */
.prog-screen {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--bar-h) + 16px);
  display: flex;
  padding: 16px;
  gap: 16px;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 280px;
  background: var(--surface);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.sidebar-head {
  padding: 20px 18px 14px;
}

.sidebar-back {
  font-size: 0.72rem;
  color: var(--text-3);
  cursor: pointer;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.sidebar-back:hover { color: var(--text); }

.sidebar-program { font-size: 0.88rem; font-weight: 700; }
.sidebar-meta { font-size: 0.68rem; color: var(--text-3); margin-top: 2px; }

.sidebar-progress {
  margin: 12px 18px 0;
  padding: 12px 14px;
  background: var(--accent-soft);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-ring { width: 36px; height: 36px; flex-shrink: 0; }
.progress-ring circle { fill: none; stroke-width: 3; }
.progress-ring .track { stroke: var(--border); }
.progress-ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.progress-label { font-size: 0.72rem; color: var(--text-2); }
.progress-pct { font-weight: 700; color: var(--accent-deep); }

.sidebar-divider { height: 1px; background: var(--border-soft); margin: 12px 18px; }

.sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.s-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.s-item:hover { background: var(--surface-warm); }
.s-item.active { background: var(--accent-mid); }
.s-art { width: 36px; height: 36px; border-radius: var(--r-md); flex-shrink: 0; }
.s-info { flex: 1; min-width: 0; }
.s-title { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-meta { font-size: 0.66rem; color: var(--text-3); margin-top: 1px; }
.s-status { flex-shrink: 0; color: var(--text-3); }
.s-item:hover .s-status { color: var(--accent); }
.s-item .s-status .done { color: var(--success); }

/* ── MAIN AREA ── */
.main-area {
  flex: 1;
  display: flex;
  gap: 16px;
  overflow: hidden;
}

/* Info Card */
.info-card {
  flex: 0.8;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  overflow-y: auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
}

.info-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; color: var(--text-3);
}
.info-empty-icon { width: 40px; height: 40px; stroke-width: 1; margin-bottom: 10px; }
.info-empty h3 { font-size: 1rem; color: var(--text-2); }
.info-empty p { font-size: 0.8rem; margin-top: 2px; }

.info-content { display: flex; flex-direction: column; }
.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 6px 14px;
  border-radius: var(--r-full);
  width: fit-content;
  margin-bottom: 16px;
}
.info-title { font-size: 1.8rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 4px; }
.info-days {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 20px;
}
.info-desc {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 24px;
}

.info-help {
  background: var(--surface-warm);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-top: auto;
}

.info-help-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  color: var(--accent);
}
.info-help-icon i { width: 16px; height: 16px; }
.info-help-label { font-size: 0.72rem; font-weight: 600; color: var(--accent-deep); margin-bottom: 6px; }
.info-help-text { font-size: 0.82rem; color: var(--text-2); line-height: 1.65; }

/* Artwork Card */
.artwork-card {
  flex: 1.4;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  overflow: hidden;
}

.artwork-frame {
  flex: 1;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artwork-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  color: white;
}
.artwork-num { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.7; }
.artwork-name { font-size: 0.88rem; font-weight: 600; margin-top: 2px; }

/* Voice/Language Selector */
.artwork-voice {
  padding: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

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

.voice-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 64px;
}

.voice-select {
  padding: 6px 12px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-warm);
  color: var(--text-2);
  outline: none;
  cursor: pointer;
}
.voice-select:focus { border-color: var(--accent); }

/* narrator pills removed - using select dropdown */

/* ═══ BOTTOM BAR ═══ */
.bottom-bar {
  min-height: var(--bar-h);
  background: var(--surface);
  margin: 0 16px 16px;
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  z-index: 120;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

.bar-progress { padding: 0 20px; }
.bar-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: var(--border-soft); border-radius: 2px; outline: none;
  margin-top: 10px;
}
.bar-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}

.bar-controls {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
}

.bar-left { width: 200px; min-width: 0; flex-shrink: 0; }
.bar-now-playing { min-width: 0; overflow: hidden; }
.bar-now-title { font-size: 0.78rem; font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-now-meta { font-size: 0.66rem; color: var(--text-3); }

.bar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
}

.bar-transport { display: flex; align-items: center; gap: 10px; }
.bar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 50%;
  background: var(--surface-warm);
  transition: all 0.15s;
}
.bar-btn:hover { background: var(--border-soft); color: var(--text-2); }
.bar-btn i { width: 16px; height: 16px; }

.bar-play-btn {
  width: 48px; height: 48px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
  box-shadow: 0 4px 16px rgba(90,154,181,0.3);
}
.bar-play-btn:hover { transform: scale(1.04); }
.bar-play-btn svg { width: 20px; height: 20px; }

.bar-progress-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 120px;
  max-width: 300px;
}
.bar-track { flex: 1; height: 4px; background: var(--border-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { width: 0%; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.1s linear; }
.bar-time { font-size: 0.68rem; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.bar-ambient { display: flex; align-items: center; gap: 8px; }
.bar-icon { width: 16px; height: 16px; color: var(--text-3); }
.bar-ambient-select {
  padding: 5px 10px; font-size: 0.72rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-warm); color: var(--text-2);
}
.bar-vol {
  -webkit-appearance: none; appearance: none;
  width: 50px; height: 3px; background: var(--border); border-radius: 2px;
}
.bar-vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}
.bar-vol-label { font-size: 0.66rem; color: var(--text-3); min-width: 24px; }

.bar-complete {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
  background: var(--success); color: white; border-radius: var(--r);
}
.bar-complete:hover { opacity: 0.9; }
.bar-complete i { width: 14px; height: 14px; }

/* ═══ ARTWORK GRADIENTS ═══ */
.art-1  { background: linear-gradient(135deg, #a8d8ea, #5a9ab5); }
.art-2  { background: linear-gradient(135deg, #c3b1e1, #7a6ba7); }
.art-3  { background: linear-gradient(135deg, #a8e6cf, #5aab83); }
.art-4  { background: linear-gradient(135deg, #f9d89c, #c49a4a); }
.art-5  { background: linear-gradient(135deg, #f2a6b0, #ba5f6a); }
.art-6  { background: linear-gradient(135deg, #a0c4e8, #5a82b0); }
.art-7  { background: linear-gradient(135deg, #c8e6a0, #84ab5a); }
.art-8  { background: linear-gradient(135deg, #e6b0c8, #b06480); }
.art-9  { background: linear-gradient(135deg, #b0e6e6, #64b0b0); }
.art-10 { background: linear-gradient(135deg, #c8b0e6, #8064b0); }

/* ═══ MOBILE ═══ */
@media (max-width: 900px) {
  /* Program screen: single scrollable column */
  .prog-screen {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    overflow-y: auto;
    bottom: calc(var(--bar-h) + 8px);
  }

  /* Reorder: artwork (1) → info/description (2) → sidebar/sessions (3) */
  .main-area {
    flex-direction: column;
    order: 2;
    overflow: visible;
  }
  .artwork-card { order: -1; border-radius: var(--r-lg); }
  .artwork-card .artwork-frame { aspect-ratio: 1 / 1; min-height: 0; }
  .info-card { order: 1; border-radius: var(--r-lg); padding: 20px 16px; flex: none; }

  .sidebar {
    order: 3;
    width: 100%;
    max-height: none;
    border-radius: var(--r-lg);
    flex-shrink: 0;
  }
  .sidebar-sessions { overflow-y: visible; }
  /* Keep sidebar header but make it compact */
  .sidebar-head { padding: 14px 16px 10px; }
  .sidebar-progress { margin-top: 8px; }

  /* Player bar: sticky bottom, compact */
  .bottom-bar {
    margin: 0 8px 8px;
    border-radius: var(--r-lg);
    min-height: auto;
  }
  .bar-ambient { display: none; }
  .bar-progress-inline { min-width: 80px; max-width: 160px; }
  .bar-left { width: auto; max-width: 120px; }
  .bar-controls { padding: 0 12px; gap: 8px; }
  .bar-transport { gap: 6px; }
  .bar-btn { width: 32px; height: 32px; }
  .bar-play-btn { width: 42px; height: 42px; }

  /* Dashboard tweaks */
  .dash-header { padding: 12px 16px; }
  .bento { grid-template-columns: 1fr; gap: 12px; }
  .bento-welcome { grid-column: span 1; }
  .bento-program { grid-column: span 1; flex-direction: column; align-items: flex-start; }
  .bento-programs-list { grid-column: span 1; }
  .bento-program-art { width: 80px; height: 80px; }
}
