/* ============================================================
   Voice Studio — one screen, one job.
   Aesthetic: studio console. Neutral dark chassis, a single
   amber signal colour reserved for "live" and the primary act.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Chassis — neutral, not blue. Lets the signal colour carry meaning. */
  --bg:          #0a0b0f;
  --bg-grain:    #0c0d12;
  --panel:       #12141a;
  --panel-hi:    #191c24;
  --panel-in:    #0e0f14;

  --line:        rgba(255, 255, 255, 0.07);
  --line-hi:     rgba(255, 255, 255, 0.14);

  --text:        #e8e9ed;
  --text-soft:   #b9bdc8;
  --muted:       #8b909d;
  --dim:         #5f6472;

  /* THE accent. Used only for: live state, primary action, active selection. */
  --signal:      #ff9e2c;
  --signal-lo:   rgba(255, 158, 44, 0.14);
  --signal-mid:  rgba(255, 158, 44, 0.34);

  --ok:          #4ade80;
  --err:         #ff6b6b;

  --font:        'IBM Plex Sans Thai', system-ui, sans-serif;
  --mono:        'IBM Plex Mono', ui-monospace, monospace;

  --r-sm:        6px;
  --r:           10px;
  --r-lg:        14px;

  --rail-w:      292px;
  --result-w:    336px;
  --bar-h:       56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Grain + a single soft light source from the top-left, like a desk lamp
   over a console. Cheap, static, gives the flat dark surface some depth. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(255, 158, 44, 0.055), transparent 60%),
    radial-gradient(900px 700px at 100% 100%, rgba(90, 120, 255, 0.045), transparent 62%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.032'/%3E%3C/svg%3E");
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }

/* ------------------------------------------------------------
   Shell
   ------------------------------------------------------------ */

.app {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  height: var(--bar-h);
  flex: 0 0 var(--bar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 11, 15, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

/* Small animated level meter as the logo — the product is audio, so the
   mark should behave like audio. */
.brand-meter {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  width: 22px;
}
.brand-meter i {
  flex: 1;
  background: var(--signal);
  border-radius: 1px;
  height: 30%;
  animation: meter 1.5s ease-in-out infinite;
}
.brand-meter i:nth-child(2) { animation-delay: 0.18s; }
.brand-meter i:nth-child(3) { animation-delay: 0.36s; }
.brand-meter i:nth-child(4) { animation-delay: 0.09s; }
@keyframes meter {
  0%, 100% { height: 22%; opacity: 0.5; }
  50%      { height: 100%; opacity: 1; }
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 15px;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-top: -3px;
}

.topbar-spacer { flex: 1; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--dim);
  flex: 0 0 auto;
}
.status.is-live   { color: var(--text-soft); border-color: var(--signal-mid); }
.status.is-live .status-dot {
  background: var(--signal);
  box-shadow: 0 0 0 0 var(--signal-mid);
  animation: pulse 2.4s ease-out infinite;
}
.status.is-down { color: var(--err); border-color: rgba(255, 107, 107, 0.35); }
.status.is-down .status-dot { background: var(--err); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--signal-mid); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 158, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 158, 44, 0); }
}

.ghost-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color 0.16s, background 0.16s;
}
.ghost-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* ------------------------------------------------------------
   Three-pane body
   ------------------------------------------------------------ */

.panes {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--result-w);
  min-height: 0;
}

.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.pane-rail   { border-right: 1px solid var(--line); animation-delay: 0.04s; }
.pane-main   { animation-delay: 0.1s; }
.pane-result { border-left: 1px solid var(--line); animation-delay: 0.16s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pane, .brand-meter i, .status-dot { animation: none !important; }
}

.pane-head {
  flex: 0 0 auto;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.pane-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}
.pane-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ------------------------------------------------------------
   Left rail — voice browser
   ------------------------------------------------------------ */

.search {
  position: relative;
  margin-top: 11px;
}
.search input {
  width: 100%;
  padding: 9px 11px 9px 32px;
  background: var(--panel-in);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, background 0.16s;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--signal-mid); background: var(--panel); }
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--dim);
  pointer-events: none;
}

.tabs {
  display: flex;
  gap: 3px;
  margin-top: 11px;
  padding: 3px;
  background: var(--panel-in);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.tab {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.16s, color 0.16s;
  white-space: nowrap;
}
.tab:hover { color: var(--text-soft); }
.tab.is-on {
  background: var(--panel-hi);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.tab-n {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  margin-left: 3px;
}

.voice-list { padding: 8px; }

.voice {
  width: 100%;
  text-align: left;
  display: block;
  padding: 10px 11px;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}
.voice:hover { background: var(--panel); border-color: var(--line); }
.voice.is-on {
  background: var(--signal-lo);
  border-color: var(--signal-mid);
}
.voice-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice.is-on .voice-name { color: var(--signal); }
.voice-sum {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--dim);
  flex: 0 0 auto;
  text-transform: uppercase;
}
.chip-f { color: #f0a3c8; border-color: rgba(240, 163, 200, 0.28); }
.chip-m { color: #8fb6f5; border-color: rgba(143, 182, 245, 0.28); }

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
