/* ============================================================
   ClearVoice — Styles
   Dark audio-tool aesthetic: near-black bg, teal accents
   Optimised for mobile portrait (360–430px wide)
   ============================================================ */

:root {
  --bg:         #070d0d;
  --bg-panel:   #0d1a1a;
  --bg-card:    #0f2020;
  --border:     #1a3232;
  --accent:     #00d4aa;
  --accent-dim: #008f73;
  --green:      #00e676;
  --red:        #ff4444;
  --yellow:     #ffcc00;
  --text:       #ddeedd;
  --text-muted: #7aaa97;
  --text-dim:   #3a6060;
  --font:       'Space Grotesk', system-ui, sans-serif;
  --mono:       'IBM Plex Mono', monospace;
  --radius:     12px;
  --radius-sm:  8px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
}

/* ── Layout ──────────────────────────────────────────────── */

#cv-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */

.cv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cv-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cv-logo {
  font-size: 20px;
  line-height: 1;
}

.cv-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.cv-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 1px;
}

.cv-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}
.cv-status-dot.active  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.cv-status-dot.calling { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse-dot 1s infinite; }
.cv-status-dot.error   { background: var(--red); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.cv-status-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ── Tabs ────────────────────────────────────────────────── */

.cv-tabs {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cv-tab {
  flex: 1;
  padding: 11px 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.cv-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cv-tab:active { opacity: 0.7; }

/* ── Tab content ─────────────────────────────────────────── */

.cv-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cv-tab-content.hidden { display: none !important; }

/* ── Cards ───────────────────────────────────────────────── */

.cv-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.cv-card-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Level meters ────────────────────────────────────────── */

.cv-meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cv-meter-row:last-child { margin-bottom: 0; }

.cv-meter-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 52px;
  flex-shrink: 0;
}

.cv-meter-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.cv-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.08s linear;
  background: linear-gradient(to right, var(--accent), var(--green));
}
.cv-meter-fill.hot {
  background: linear-gradient(to right, var(--yellow), var(--red));
}

.cv-meter-db {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  width: 48px;
  text-align: right;
  flex-shrink: 0;
}

.cv-noise-removed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cv-noise-removed-label { font-size: 11px; color: var(--text-muted); }
.cv-noise-removed-value {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--green);
}

/* ── Voice profile card ──────────────────────────────────── */

.cv-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cv-profile-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.cv-profile-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}
.cv-profile-badge.enrolled .dot { background: var(--green); }
.cv-profile-badge.enrolled { color: var(--text); }

.cv-profile-pitch {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

.cv-confidence-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cv-confidence-label { font-size: 11px; color: var(--text-muted); width: 70px; }
.cv-confidence-bar {
  flex: 1; height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.cv-confidence-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s;
}
.cv-confidence-pct {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  width: 34px;
  text-align: right;
}

/* ── Power / toggle button ───────────────────────────────── */

.cv-start-btn {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--accent-dim);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cv-start-btn:active { opacity: 0.75; }
.cv-start-btn.running {
  background: rgba(0, 230, 118, 0.08);
  border-color: var(--green);
  color: var(--green);
}
.cv-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Slider ──────────────────────────────────────────────── */

.cv-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cv-slider-label { font-size: 11px; color: var(--text-muted); width: 60px; }
.cv-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}
.cv-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 212, 170, 0.5);
}
.cv-slider-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  width: 36px;
  text-align: right;
}

/* ── Buttons ─────────────────────────────────────────────── */

.cv-btn {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-align: center;
  display: block;
  width: 100%;
}
.cv-btn:active { opacity: 0.7; }
.cv-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cv-btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.cv-btn-red {
  background: rgba(255, 68, 68, 0.12);
  border-color: var(--red);
  color: var(--red);
}
.cv-btn-green {
  background: rgba(0, 230, 118, 0.1);
  border-color: var(--green);
  color: var(--green);
}

/* ── Enroll tab ──────────────────────────────────────────── */

.cv-enroll-prompt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 4px 14px;
}

.cv-enroll-prompt em {
  color: var(--text);
  font-style: normal;
  font-weight: 600;
}

.cv-progress-wrap {
  position: relative;
  margin-bottom: 8px;
}
.cv-progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.cv-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--accent), var(--green));
  border-radius: 5px;
  transition: width 0.3s;
}
.cv-progress-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.cv-pitch-display {
  text-align: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin: 10px 0 4px;
}
.cv-pitch-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ── Dialer tab ──────────────────────────────────────────── */

.cv-input-group { margin-bottom: 10px; }
.cv-input-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 5px;
  display: block;
}
.cv-input {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  -webkit-appearance: none;
}
.cv-input:focus { border-color: var(--accent-dim); }
.cv-input::placeholder { color: var(--text-dim); }

.cv-dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.cv-dial-key {
  padding: 16px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.cv-dial-key:active { background: var(--border); }
.cv-dial-key sub {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 1px;
}

.cv-dial-display {
  width: 100%;
  padding: 14px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 52px;
}

.cv-call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── In-call overlay ─────────────────────────────────────── */

#cv-call-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 24px;
}
#cv-call-overlay.hidden { display: none; }

.cv-call-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.cv-call-number {
  font-size: 24px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
}

.cv-call-status {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cv-call-timer {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
}

.cv-call-noise-badge {
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid var(--accent-dim);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cv-call-noise-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.2s infinite;
}

.cv-call-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.cv-call-btn {
  padding: 18px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  width: 60px; height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: opacity 0.2s;
}
.cv-call-btn:active { opacity: 0.7; }

.cv-hangup-btn {
  background: var(--red);
  width: 64px; height: 64px;
  font-size: 24px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
  transition: opacity 0.2s;
}
.cv-hangup-btn:active { opacity: 0.7; }

/* ── Misc ────────────────────────────────────────────────── */

.cv-info-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.cv-info-text a { color: var(--accent); text-decoration: none; }

.cv-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.cv-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.cv-tag-green { background: rgba(0, 230, 118, 0.1); color: var(--green); }
.cv-tag-yellow { background: rgba(255, 204, 0, 0.1); color: var(--yellow); }
.cv-tag-dim { background: var(--border); color: var(--text-muted); }

/* ── Animations ──────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}
.cv-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.cv-recording-pulse {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse-dot 0.8s infinite;
}

/* PWA install banner */
.cv-install-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 16px 12px;
  font-size: 13px;
  color: var(--text);
  gap: 10px;
}
