/* ============================
   Azure Speech Studio — CSS
   ============================ */

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

:root {
  --bg:          #0a0f1e;
  --surface:     #111827;
  --surface2:    #1a2235;
  --border:      rgba(94, 234, 212, 0.12);
  --border-h:    rgba(94, 234, 212, 0.35);
  --accent:      #5eead4;
  --accent2:     #818cf8;
  --accent3:     #38bdf8;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --danger:      #f87171;
  --success:     #34d399;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 24px rgba(94,234,212,0.1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Splash Art ─────────────────── */
.splash-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}
.splash-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wave-group path {
  animation: waveDrift 8s ease-in-out infinite alternate;
}
.wave-group path:nth-child(2) { animation-delay: -2s; }
.wave-group path:nth-child(3) { animation-delay: -4s; }
@keyframes waveDrift {
  from { transform: translateY(0px); }
  to   { transform: translateY(12px); }
}

/* ── Container ──────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header ─────────────────────── */
.header {
  text-align: center;
  padding: 12px 0 4px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.logo-icon {
  font-size: 28px;
  color: var(--accent);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { text-shadow: 0 0 8px var(--accent); }
  50%      { text-shadow: 0 0 22px var(--accent), 0 0 40px var(--accent2); }
}
.logo-text {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, var(--accent), var(--accent3), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Card ───────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: fadeUp 0.55s cubic-bezier(.22,1,.36,1) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 20px;
  letter-spacing: 0.3px;
}

/* ── Config Card ────────────────── */
.config-card { animation-delay: 0.05s; }
.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.config-hint {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
@media (max-width: 580px) { .config-row { grid-template-columns: 1fr; } }

/* ── Input Group ────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.input-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.input-group input,
.input-group select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.input-group input:focus,
.input-group select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(94,234,212,0.12);
}
.input-group input[type="password"] { padding-right: 42px; }
select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background: var(--surface2); }

.toggle-vis {
  position: absolute;
  right: 10px; bottom: 10px;
  background: none; border: none;
  cursor: pointer; font-size: 15px;
  opacity: 0.5; transition: opacity 0.2s;
}
.toggle-vis:hover { opacity: 1; }

textarea {
  resize: vertical;
  min-height: 120px;
  margin-top: 16px;
  line-height: 1.7;
}

/* ── Tabs ───────────────────────── */
.tabs {
  display: flex;
  gap: 10px;
}
.tab {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 11px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}
.tab:hover { border-color: var(--border-h); color: var(--text); }
.tab.active {
  background: rgba(94,234,212,0.08);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(94,234,212,0.08);
}

/* ── Tab Panels ─────────────────── */
.tab-panel { display: none; animation-delay: 0.1s; }
.tab-panel.active { display: block; }

/* ── TTS Controls ───────────────── */
.tts-controls { display: flex; flex-direction: column; gap: 16px; }
.slider-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}
.slider-group label span { color: var(--accent); }
input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  border: 1px solid var(--border);
  outline: none;
  cursor: pointer;
  padding: 0;
  width: 100%;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(94,234,212,0.5);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%; border: none;
  background: var(--accent);
  cursor: pointer;
}
@media (max-width: 480px) { .slider-row { grid-template-columns: 1fr; } }

/* ── Action Row ─────────────────── */
.action-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  align-items: center;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(94,234,212,0.18), rgba(129,140,248,0.18));
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.22s;
  letter-spacing: 0.04em;
}
.btn-primary:hover {
  background: rgba(94,234,212,0.25);
  box-shadow: 0 0 20px rgba(94,234,212,0.2);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-icon { font-size: 12px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}
.btn-ghost:hover {
  border-color: var(--border-h);
  color: var(--text);
  background: var(--surface2);
}

/* ── Audio Player ───────────────── */
#tts-audio-wrap {
  margin-top: 16px;
}
audio {
  width: 100%;
  filter: invert(0.85) hue-rotate(160deg) saturate(0.8);
  border-radius: var(--radius-sm);
}

/* ── STT Mic ────────────────────── */
.stt-controls { margin-bottom: 20px; }
.mic-area {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0 16px;
}
.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.22s;
  letter-spacing: 0.03em;
}
.mic-btn:hover { border-color: var(--border-h); color: var(--text); }
.mic-btn.recording {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(248,113,113,0.08);
  animation: recordPulse 1.5s ease-in-out infinite;
}
@keyframes recordPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.25); }
  50%      { box-shadow: 0 0 0 8px rgba(248,113,113,0); }
}

.mic-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
}
.mic-wave span {
  display: block;
  width: 3px;
  background: var(--danger);
  border-radius: 2px;
  animation: waveBar 0.7s ease-in-out infinite alternate;
}
.mic-wave span:nth-child(1) { height: 10px; animation-delay: 0s; }
.mic-wave span:nth-child(2) { height: 22px; animation-delay: 0.1s; }
.mic-wave span:nth-child(3) { height: 28px; animation-delay: 0.2s; }
.mic-wave span:nth-child(4) { height: 18px; animation-delay: 0.3s; }
.mic-wave span:nth-child(5) { height: 12px; animation-delay: 0.4s; }
@keyframes waveBar {
  from { transform: scaleY(0.4); }
  to   { transform: scaleY(1.2); }
}

/* ── Upload ─────────────────────── */
.upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.upload-label:hover {
  border-color: var(--border-h);
  color: var(--text);
  background: rgba(94,234,212,0.05);
}
input[type="file"] { display: none; }
.file-hint { font-size: 11.5px; color: var(--text-muted); }

/* ── Result Box ─────────────────── */
.result-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 110px;
  padding: 14px 16px;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.result-box:focus-within { border-color: var(--accent); }
.result-placeholder { color: var(--text-muted); font-size: 13px; }

/* ── Status ─────────────────────── */
.status-msg {
  margin-top: 12px;
  font-size: 12.5px;
  min-height: 18px;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.status-msg.ok    { color: var(--success); }
.status-msg.err   { color: var(--danger); }
.status-msg.info  { color: var(--accent3); }

/* ── Scrollbar ──────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-h); }