/* ==========================================================
   Voice Studio — stylesheet
   Palette: cool slate paper + ink, violet + coral waveform accents
   Type: Fraunces (display) / Inter (UI) / Noto Sans Telugu (Telugu)
   ========================================================== */

:root {
  --paper:      #F2F4F6;
  --paper-dim:  #E7EAEE;
  --ink:        #171B22;
  --ink-soft:   #565E6B;
  --line:       #D7DCE2;
  --violet:     #5B4EE5;
  --violet-ink: #FFFFFF;
  --coral:      #FF6B49;
  --error-bg:   #FDEAE6;
  --error-text: #A32A12;
  --radius-lg:  18px;
  --radius-md:  12px;
  --shadow-card: 0 1px 2px rgba(23,27,34,0.04), 0 8px 24px rgba(23,27,34,0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans Telugu', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  color: var(--violet);
  display: inline-flex;
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.brand-tag {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  padding-left: 36px;
}

/* ---------- Stage / panel ---------- */
.stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-label {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.field-hint {
  margin: -10px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Textarea ---------- */
.textarea-wrap {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-dim);
  transition: border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.textarea-wrap:focus-within {
  border-color: var(--violet);
  background: #FFFFFF;
}

#textInput {
  width: 100%;
  min-height: 160px;
  border: none;
  background: transparent;
  resize: vertical;
  padding: 16px 16px 8px;
  font-family: 'Noto Sans Telugu', 'Inter', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  outline: none;
}

#textInput::placeholder { color: #9AA2AD; }

.textarea-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 10px;
}

.char-count {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.char-count.limit-near { color: var(--coral); font-weight: 600; }

/* ---------- Clone voice row ---------- */
.clone-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.voice-name-input {
  flex: 1 1 200px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-dim);
  padding: 0 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  color: var(--ink);
  outline: none;
  min-height: 44px;
}

.voice-name-input:focus { border-color: var(--violet); background: #FFFFFF; }

.file-input-wrap {
  position: relative;
  flex: 1 1 220px;
  display: flex;
}

.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-dim);
  padding: 0 14px;
  min-height: 44px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.file-input-wrap:focus-within .file-input-label,
.file-input-wrap:hover .file-input-label {
  border-color: var(--violet);
  color: var(--ink);
}

.clone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #FFFFFF;
  padding: 0 22px;
  min-height: 44px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.clone-btn:hover { background: #2B313C; }
.clone-btn:disabled { background: #A9AFB9; cursor: not-allowed; }

.clone-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #EAF6ED;
  color: #1E6B34;
  border: 1px solid #C9E7D0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #F3CBC1;
}

/* ---------- Generate button ---------- */
.generate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: flex-start;
  background: var(--violet);
  color: var(--violet-ink);
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-family: 'Inter', sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 18px rgba(91,78,229,0.30);
}

.generate-btn:hover  { background: #4C40D9; }
.generate-btn:active { transform: translateY(1px); }
.generate-btn:disabled {
  background: #B7B2F0;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon { display: inline-flex; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFFFFF;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Player card ---------- */
.player-card {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 4px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#audioPlayer {
  flex: 1;
  min-width: 220px;
  height: 40px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid var(--line);
  background: var(--paper-dim);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.download-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}

/* ---------- Footer ---------- */
.foot-note {
  text-align: center;
  color: #9AA2AD;
  font-size: 0.8rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .page { padding: 22px 14px 36px; gap: 20px; }
  .panel { padding: 20px; }
  .brand-tag { padding-left: 0; }
  .brand-name { font-size: 1.4rem; }
  .generate-btn { align-self: stretch; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn-spinner { animation: none; }
  .generate-btn { transition: none; }
}

/* ---------- Focus visibility ---------- */
button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 2.5px solid var(--violet);
  outline-offset: 2px;
}
