/* CloneTheVoice — Deep Teal & Aqua design system
   Palette: #17252A / #2B7A78 / #3AAFA9 / #DEF2F1 / #FEFFFF.
   Flat tactile surfaces, hairline geometry, one disciplined accent. */

/* Fonts vendored locally: zero network after first load, COEP-safe,
   and identical to the Google-hosted faces. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-var.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-var.woff2') format('woff2');
}

:root {
  color-scheme: dark;

  /* Surfaces — light mint (#DEF2F1) with white cards */
  --bg: #DEF2F1;
  --surface: #FEFFFF;
  --surface-2: #F2FAF9;
  --surface-3: #E6F3F1;
  --surface-4: #DAECEA;
  --surface-input: #FFFFFF;
  --surface-olive: #C9E4E1;

  /* Borders — mint-teal hairlines */
  --border: #C4E0DC;
  --border-2: #A9D3CE;
  --border-strong: #7FB8B2;
  --border-focus: #17252A;

  /* Text — deep teal ink (#17252A) on mint */
  --text-1: #17252A;
  --text-2: #33514E;
  --text-3: #5F807C;
  --text-4: #93B0AC;

  /* Accent — black (#17252A): buttons, links, highlights */
  --accent: #17252A;
  --accent-hover: #2E4A50;
  --accent-active: #0D181C;
  --accent-dim: rgba(23, 37, 42, 0.08);
  --accent-subtle: rgba(23, 37, 42, 0.04);
  --on-accent: #FEFFFF;

  /* States — Earthy, warm, harmonious signal accents */
  --danger: #E05A47;
  --danger-hover: #CC4E3C;
  --danger-dim: rgba(224, 90, 71, 0.15);
  --success: #97C95C;
  --success-dim: rgba(151, 201, 92, 0.14);
  --warn: #DE9E36;
  --warn-dim: rgba(222, 158, 54, 0.14);

  /* Geometry & Rhythm */
  --topbar-h: 54px;
  --sidebar-w: 260px;
  --radius-xs: 4px;
  --radius-s: 6px;
  --radius: 8px;
  --radius-l: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(23, 37, 42, 0.18);
  color: #17252A;
}

::placeholder {
  color: var(--text-3);
  opacity: 1;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
}

/* ── Shell layout ───────────────────────────────────────────────────────── */

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-areas:
    'topbar topbar'
    'sidebar stage';
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  background: var(--bg);
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  grid-area: topbar;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 1280px) {
  .topbar-search {
    position: static;
    transform: none;
    width: auto;
    flex: 1;
    max-width: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: default;
}
/* 3D wordmark: extruded text, drifting holes, flip-in entrance */
.brand-name {
  position: relative;
  display: inline-block;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.005em;
  color: var(--text-1);
  text-transform: lowercase;
  white-space: nowrap;
  cursor: default;
  animation: brand-in 0.55s var(--ease) both;
}
@keyframes brand-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
/* drifting holes punched through the letters (page color shows through) */
.brand-name::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  background: radial-gradient(circle 2.6px at center, #DEF2F1 0 2.6px, transparent 3.2px) 0 0 / 15px 15px repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: holes-drift 7s linear infinite;
  pointer-events: none;
}
@keyframes holes-drift {
  from { background-position: 0 0; }
  to { background-position: 30px 30px; }
}

/* lifetime usage counters — plain text, no chrome */
.usage-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-3);
  user-select: none;
  white-space: nowrap;
}
.usage-item b {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
@media (max-width: 1180px) { .usage-stats { display: none; } }

/* donate pill */
.btn-donate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s var(--ease), transform 0.12s var(--ease), box-shadow 0.14s var(--ease);
}
.btn-donate svg { width: 13px; height: 13px; }
.btn-donate:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(43, 122, 120, 0.55);
}
.btn-donate:active { transform: translateY(0); }

/* Search Box with NO nested box styling */
.topbar-search {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, 36vw);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-input);
  color: var(--text-3);
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.topbar-search:hover {
  border-color: var(--border-2);
}
.topbar-search:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--text-1);
}
.topbar-search .icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--text-3);
}
.topbar-search input,
.topbar-search input[type="search"] {
  flex: 1 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: var(--text-1) !important;
  font: inherit !important;
  font-size: 13px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  -webkit-appearance: none !important;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* engine state is tracked on a hidden node (tests + dataset only) */
.engine-status { display: none; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  gap: 16px;
  overflow-y: auto;
}

.sidebar-new {
  width: 100%;
  justify-content: center;
  gap: 8px;
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--accent) !important;
  color: var(--on-accent) !important;
  border-color: var(--accent) !important;
}
.sidebar-new:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}
.sidebar-new:active {
  background: var(--accent-active) !important;
  border-color: var(--accent-active) !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.sidebar-link .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: color 0.12s var(--ease);
}
.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.sidebar-link:hover .icon {
  color: var(--accent);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.sidebar-section h4 {
  margin: 6px 0 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Recent Profiles List — Elegant, sleek list items (no chunky gray blocks!) */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recent-item {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  padding: 6px 10px !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-s) !important;
  background: transparent !important;
  color: var(--text-2) !important;
  font: inherit !important;
  font-size: 12.5px !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: background 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
}
.recent-item:hover {
  background: var(--surface-2) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}
.recent-item-active {
  background: var(--surface-3) !important;
  color: var(--text-1) !important;
  border-color: var(--accent) !important;
}
.recent-avatar {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-olive);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.recent-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}
.recent-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-privacy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.privacy-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.privacy-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.privacy-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
.privacy-sub {
  font-size: 10px;
  color: var(--text-3);
}

/* ── Stage & Tabs ───────────────────────────────────────────────────────── */

.stage {
  grid-area: stage;
  display: flex;
  flex-direction: column;
  padding: 20px 28px;
  overflow-y: auto;
  background: var(--bg);
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  margin-bottom: 20px;
}
.tab {
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.tab:hover {
  color: var(--text-1);
}
.tab-active {
  background: var(--surface-olive);
  color: var(--accent);
  font-weight: 600;
}

.tabpane {
  display: none;
}
.pane-active {
  display: block;
}

/* ── Responsive adjustments ─────────────────────────────────────────────── */

@media (max-width: 860px) {
  .app-shell {
    grid-template-areas:
      'topbar'
      'stage';
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
  .stage { padding: 14px; }
}
