/* VibeEcho Web POC — dark, card-style, brand #F5C16C */
:root {
  --bg: #0f0f12;
  --bg-elev: #16161b;
  --card: #1a1a1f;
  --card-hi: #20202a;
  --border: #2a2a35;
  --text: #ececf0;
  --text-mute: #9a9aa6;
  --text-dim: #6c6c7a;
  --brand: #f5c16c;
  --brand-soft: rgba(245, 193, 108, 0.16);
  --brand-edge: rgba(245, 193, 108, 0.45);
  --danger: #ef5b5b;
  --warn: #f5b067;
  --ok: #6bd49b;
  --info: #6cb3f5;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(15, 15, 18, 0.86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--brand) 60%, #b57b1f);
  box-shadow: 0 0 12px var(--brand-soft);
}
.brand-name { font-weight: 600; letter-spacing: 0.2px; }
.brand-name em { font-style: normal; font-size: 11px; color: var(--text-dim); margin-left: 4px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--bg-elev);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.pill-mute::before { background: var(--text-dim); }
.pill-ok { color: var(--ok); border-color: rgba(107, 212, 155, 0.35); }
.pill-ok::before { background: var(--ok); box-shadow: 0 0 8px rgba(107, 212, 155, 0.55); }
.pill-warn { color: var(--warn); border-color: rgba(245, 176, 103, 0.35); }
.pill-warn::before { background: var(--warn); }
.pill-err { color: var(--danger); border-color: rgba(239, 91, 91, 0.4); }
.pill-err::before { background: var(--danger); box-shadow: 0 0 8px rgba(239, 91, 91, 0.55); }

.ghost-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-mute);
  padding: 5px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--brand-edge); }

.hidden { display: none !important; }

/* ===== Layout ===== */
.app {
  max-width: 760px; margin: 0 auto; padding: 20px 16px 80px;
}
.page-title { font-size: 22px; font-weight: 600; margin: 0 0 16px; }
.page-sub { color: var(--text-mute); font-size: 13px; margin-top: -8px; margin-bottom: 16px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 12px; }
.card.compact { padding: 12px 14px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-mute); }
.input, .textarea, .select {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-edge); background: #1c1c23;
}
.textarea { resize: vertical; min-height: 80px; }
.field-error { color: var(--danger); font-size: 12px; min-height: 14px; }

.btn {
  appearance: none; border: 1px solid var(--brand);
  background: var(--brand); color: #1a1408;
  padding: 10px 16px; font-weight: 600; font-size: 14px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: transform 0.05s, filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--card-hi); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: border-color 0.15s, transform 0.05s;
}
.list-item:hover { border-color: var(--brand-edge); }
.list-item:active { transform: translateY(1px); }
.list-item .meta { color: var(--text-mute); font-size: 12px; }
.list-item h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }

.empty {
  text-align: center; color: var(--text-dim);
  padding: 40px 20px; border: 1px dashed var(--border); border-radius: var(--r);
}

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-elev); color: var(--text-mute); border: 1px solid var(--border); }
.tag-recording { color: var(--brand); border-color: var(--brand-edge); background: var(--brand-soft); }
.tag-completed { color: var(--ok); border-color: rgba(107, 212, 155, 0.3); }
.tag-processing { color: var(--info); border-color: rgba(108, 179, 245, 0.3); }
.tag-failed { color: var(--danger); border-color: rgba(239, 91, 91, 0.35); }

/* ===== Modal ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 16px;
}
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: calc(100vh - 50px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-hero { text-align: center; margin-bottom: 18px; }
.auth-hero .logo { width: 56px; height: 56px; margin: 0 auto 10px; display: block; }
.auth-hero h1 { margin: 0 0 4px; font-size: 22px; }
.auth-hero p { margin: 0; color: var(--text-mute); font-size: 13px; }
.auth-foot { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-mute); }

/* ===== Session Live ===== */
.live-wrap { display: flex; flex-direction: column; gap: 12px; }

.live-status { display: flex; align-items: center; gap: 10px; }
.breath {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-dim); transition: background 0.2s;
}
.breath.on {
  background: var(--brand);
  animation: breathing 1.4s ease-in-out infinite;
}
@keyframes breathing {
  0%,100% { box-shadow: 0 0 0 0 rgba(245, 193, 108, 0.55); transform: scale(0.92); }
  50%     { box-shadow: 0 0 0 10px rgba(245, 193, 108, 0); transform: scale(1.05); }
}

.transcript {
  min-height: 200px; max-height: 50vh; overflow-y: auto;
  padding: 14px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 15px; line-height: 1.65;
  display: flex; flex-direction: column; gap: 10px;
}
.tx-final { color: var(--text); }
.tx-partial { color: var(--text-dim); font-style: italic; }
.tx-time { color: var(--text-dim); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }

.ai-bubble {
  padding: 12px 14px; border-radius: var(--r);
  background: var(--brand-soft); border: 1px solid var(--brand-edge);
  color: var(--text); font-size: 14px; line-height: 1.6;
}
.ai-bubble .ai-label { color: var(--brand); font-size: 11px; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 4px; }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mic-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 4px 14px rgba(239, 91, 91, 0.35);
  transition: transform 0.1s;
}
.mic-btn:active { transform: scale(0.95); }
.mic-btn.paused { background: var(--card-hi); color: var(--text); box-shadow: none; }
.mic-btn.recording { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239, 91, 91, 0.45); }
  50%     { box-shadow: 0 0 0 12px rgba(239, 91, 91, 0); }
}

/* Level meter */
.meter { display: flex; align-items: end; gap: 3px; height: 28px; }
.meter span { display: block; width: 4px; background: var(--border); border-radius: 2px; transition: height 0.08s linear, background 0.1s; }
.meter span.live { background: var(--brand); }

.banner {
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-mute);
}
.banner-warn { color: var(--warn); border-color: rgba(245, 176, 103, 0.35); background: rgba(245, 176, 103, 0.08); }
.banner-err { color: var(--danger); border-color: rgba(239, 91, 91, 0.4); background: rgba(239, 91, 91, 0.06); }

/* ===== Summary ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 8px 14px; cursor: pointer; color: var(--text-mute); font-size: 14px;
  border: none; background: transparent; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

pre.code {
  background: #0a0a0e; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 12px; overflow: auto; font-size: 12px; color: #d6d6e0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.markdown p { margin: 0 0 10px; line-height: 1.7; }
.markdown h1, .markdown h2, .markdown h3 { margin: 16px 0 8px; }
.markdown ul { padding-left: 20px; margin: 8px 0; }

/* ===== Toast ===== */
.toast-root {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px; max-width: 90vw;
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); animation: toastin 0.18s ease-out;
}
.toast-info    { border-color: rgba(108, 179, 245, 0.4); color: var(--info); }
.toast-success { border-color: rgba(107, 212, 155, 0.4); color: var(--ok); }
.toast-warn    { border-color: rgba(245, 176, 103, 0.4); color: var(--warn); }
.toast-error   { border-color: rgba(239, 91, 91, 0.4);  color: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .app { padding: 14px 12px 90px; }
  .page-title { font-size: 20px; }
  .card { padding: 14px; border-radius: var(--r); }
  .modal { border-radius: var(--r); }
}
