/* Salon Trainer — After Hours editorial design system */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@300;400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Color palette ────────────────────────────── */
  --bg:           #0B0710;
  --accent:       #FF3FAA;
  --glow:         #B07BFF;
  --ink:          #F4E9F1;
  --muted:        rgba(244, 233, 241, 0.55);
  --panel:        rgba(255, 255, 255, 0.04);
  --hairline:     rgba(255, 255, 255, 0.08);

  --surface:      var(--panel);
  --surface-2:    rgba(255, 255, 255, 0.06);
  --surface-ink:  #050308;
  --text:         var(--ink);
  --text-2:       rgba(244, 233, 241, 0.72);
  --text-3:       var(--muted);
  --border:       var(--hairline);
  --border-s:     rgba(255, 255, 255, 0.16);

  --accent-soft:  rgba(255, 63, 170, 0.14);
  --accent-ink:   #FFB7DF;
  --accent-light: rgba(255, 63, 170, 0.55);

  --warn:         #FFB36B;
  --warn-soft:    rgba(255, 179, 107, 0.14);
  --warn-ink:     #FFD2A8;

  --danger:       #FF6B7E;
  --danger-soft:  rgba(255, 107, 126, 0.14);
  --danger-ink:   #FFAEB9;

  --info:         var(--glow);
  --info-soft:    rgba(176, 123, 255, 0.14);
  --info-ink:     #DCC5FF;

  /* ── Legacy color aliases (kept so existing inline-styled views still resolve) ── */
  --green:        var(--accent);
  --orange:       var(--warn);
  --red:          var(--danger);
  --green-bg:     var(--accent-soft);
  --orange-bg:    var(--warn-soft);
  --red-bg:       var(--danger-soft);

  /* ── Layout / shape ───────────────────────────── */
  --tab-h:        60px;
  --max-w:        480px;

  --r:            12px;
  --r-xs:         4px;
  --r-sm:         8px;
  --r-md:         12px;
  --r-lg:         18px;
  --r-full:       999px;

  /* ── Shadows ──────────────────────────────────── */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--hairline);
  --shadow-md:    0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--hairline);
  --shadow-focus: 0 0 0 3px rgba(255, 63, 170, 0.35);
  --glow-accent:  0 0 24px rgba(255, 63, 170, 0.45);
  --glow-strong:  0 0 36px rgba(255, 63, 170, 0.65);
  --glow-purple:  0 0 24px rgba(176, 123, 255, 0.35);

  /* ── Type ─────────────────────────────────────── */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:    'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Legacy type aliases used throughout the views */
  --mono:    var(--font-mono);
  --serif:   var(--font-display);
  --sans:    var(--font-sans);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  max-width: var(--max-w);
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(40% 30% at 80% 20%, rgba(255, 63, 170, 0.18), transparent 70%),
    radial-gradient(40% 40% at 15% 85%, rgba(176, 123, 255, 0.14), transparent 70%),
    var(--bg);
  animation: pageEnter 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Page shell ──────────────────────────────── */
.page        { padding: 20px 20px calc(var(--tab-h) + 24px); min-height: 100vh; }
.page-notab  { padding: 20px; min-height: 100vh; }

/* ─── Bottom Tab ──────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: var(--max-w);
  height: var(--tab-h);
  background: rgba(11, 7, 16, 0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--hairline);
  display: flex;
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--muted);
  text-decoration: none;
  border: none; background: none; padding: 0;
  position: relative;
  transition: color 180ms ease;
  font-family: var(--font-mono);
  font-weight: 500;
}
.tab-item.active        { color: var(--ink); }
.tab-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 63, 170, 0.7);
}
.tab-item .tab-icon     { font-size: 20px; line-height: 1; }
@media (max-width: 360px) {
  .tab-item             { font-size: 9px; }
  .tab-item .tab-icon   { font-size: 18px; }
}

/* ─── Cards ───────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}
.card:active {
  transform: scale(0.985);
}
.card-dark,
.hero {
  background:
    radial-gradient(60% 80% at 80% 0%, rgba(255, 63, 170, 0.22), transparent 70%),
    radial-gradient(50% 60% at 0% 100%, rgba(176, 123, 255, 0.18), transparent 70%),
    linear-gradient(180deg, #1A0E1F 0%, #0F0814 100%);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
  transition: transform 140ms ease;
}
.card-dark:active,
.hero:active {
  transform: scale(0.99);
}

/* ─── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer; border: none;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 200ms ease, transform 100ms ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:active          { transform: scale(0.97); }
.btn-primary         {
  background: var(--accent);
  color: #1A0712;
  box-shadow: var(--glow-accent);
  font-weight: 600;
}
.btn-primary:hover   {
  background: #FF5BB8;
  box-shadow: var(--glow-strong);
}
.btn-accent          {
  background: var(--accent);
  color: #1A0712;
  box-shadow: var(--glow-accent);
  font-weight: 600;
}
.btn-accent:hover    {
  background: #FF5BB8;
  box-shadow: var(--glow-strong);
}
.btn-outline         {
  background: transparent;
  border: 1px solid var(--border-s);
  color: var(--ink);
}
.btn-outline:hover   {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  color: var(--ink);
}
.btn-ghost           { background: transparent; color: var(--text-2); }
.btn-ghost:hover     { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.btn-danger          {
  background: transparent;
  border: 1px solid rgba(255, 107, 126, 0.40);
  color: var(--danger);
}
.btn-danger:hover    { background: var(--danger-soft); }
.btn-full            { width: 100%; padding: 14px 18px; }

.btn:disabled        { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Form ────────────────────────────────────── */
.form-group { margin-bottom: 22px; }
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.form-input {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--border-s);
  border-radius: 0;
  font-size: 16px; /* prevents iOS zoom */
  font-weight: 400;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  transition: border-color 180ms ease, border-width 0ms;
}
.form-input:focus       {
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 11.5px;
}
.form-input::placeholder { color: var(--muted); }
textarea.form-input     { padding: 10px 0; resize: vertical; min-height: 80px; font-size: 15px; }
select.form-input       {
  cursor: pointer;
  /* Native select dropdowns inherit the dark page background; keep options legible */
  background-color: var(--bg);
}
select.form-input option { background: #15101A; color: var(--ink); }

/* ─── Progress bar ────────────────────────────── */
.progress-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-full);
  height: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--accent), var(--glow));
  box-shadow: 0 0 12px rgba(255, 63, 170, 0.6);
  transition: width 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Tags / badges ───────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: var(--font-sans);
  line-height: 1.3;
  white-space: nowrap;
}
.tag-outline  {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  border: 1px solid var(--hairline);
}
.tag-green    {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(255, 63, 170, 0.35);
}
.tag-orange   {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid rgba(255, 179, 107, 0.35);
}
.tag-dark     {
  background: var(--ink);
  color: var(--bg);
}

/* ─── Section label ───────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 12px;
  font-family: var(--font-mono);
}

/* ─── Info rows ───────────────────────────────── */
.info-row {
  display: flex; align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px; line-height: 1.65;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-icon  { flex-shrink: 0; font-size: 13px; opacity: 0.6; margin-top: 2px; }
.info-row .info-text  { flex: 1; }
.info-row .info-label {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-family: var(--font-mono); margin-bottom: 3px;
  font-weight: 500;
}

/* ─── Alerts ──────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px; line-height: 1.55;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.alert-warning {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border-color: rgba(255, 179, 107, 0.30);
}
.alert-success {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: rgba(255, 63, 170, 0.30);
}
.alert-error   {
  background: var(--danger-soft);
  color: var(--danger-ink);
  border-color: rgba(255, 107, 126, 0.32);
}

/* ─── Stats grid ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: 14px 14px;
  text-align: left;
  border-radius: var(--r-md);
}
.stat-card.warn {
  background: var(--warn-soft);
  border-color: rgba(255, 179, 107, 0.35);
}
.stat-num {
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  font-family: var(--font-display);
  color: var(--ink);
}
.stat-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
}
.stat-card.warn .stat-num   { color: var(--warn); }
.stat-card.warn .stat-label { color: var(--warn); opacity: 0.85; }

/* ─── Avatar ──────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 63, 170, 0.18);
  color: var(--accent-ink);
  border: 1px solid rgba(255, 63, 170, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── Header bar ──────────────────────────────── */
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 0 0;
  margin-bottom: 22px;
  gap: 12px;
}
.header-title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--ink);
}
.header-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.18em;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* ─── Empty state ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 20px 24px;
}
.empty-state .empty-icon {
  width: 96px; height: 96px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.empty-state .empty-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--ink);
}
.empty-state .empty-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 28em;
  margin: 0 auto 20px;
}

/* ─── Skeleton loading ────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.10) 50%, rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-md);
  min-height: 16px;
}

/* ─── Utility ─────────────────────────────────── */
.flex           { display: flex; }
.flex-between   { display: flex; justify-content: space-between; align-items: center; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.mt-8           { margin-top: 8px; }
.mt-16          { margin-top: 16px; }
.mt-24          { margin-top: 24px; }
.text-secondary { color: var(--text-2); }
.text-sm        { font-size: 13px; }
.text-xs        { font-size: 11px; }
.font-bold      { font-weight: 600; }
.hidden         { display: none !important; }

/* ─── Focus ring (keyboard) ───────────────────── */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-sm);
}

/* ─── Keyframes ───────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pageEnter {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes toastUp {
  0%   { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ─── Print ───────────────────────────────────── */
@media print {
  .tab-bar, #btn-back-report, #btn-print-report, .btn-reset-progress { display: none !important; }
  body { background: #fff; color: #111; }
  #app { max-width: 100%; box-shadow: none; background: #fff; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; background: #fff; color: #111; }
}
