/* ============================================================
   Gemini Voice Studio — Refined Studio Dark Theme
   Adapted from gas.twinsdigi.my.id
   ============================================================ */

:root {
  --bg-app: #080a0f;
  --bg-surface: #10131d;
  --bg-raised: #161b29;
  --bg-hover: #1e2436;
  --bg-input: #0b0e16;
  --bg-overlay: rgba(3, 5, 8, 0.85);

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-focus: #6366f1;

  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --text-dim: #8ca0b8;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: rgba(99, 102, 241, 0.14);
  --primary-glow: rgba(99, 102, 241, 0.35);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Container & Header ── */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  color: #fff;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
}

.badge.ready {
  background: var(--success-soft);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.badge.warning {
  background: var(--warning-soft);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Forms & Inputs ── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.textarea-script {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
  min-height: 140px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.textarea-script:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.input-select, .input-text {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
}

.input-select:focus, .input-text:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ── Modulasi Emosi Chips ── */
.tags-cheatsheet {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 10px;
  margin-bottom: 18px;
}

.cheatsheet-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}

.tag-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #c7d2fe;
  cursor: pointer;
  transition: var(--transition);
}

.tag-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 18px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* ── Result Audio Player Card ── */
.result-card {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, var(--bg-surface) 100%);
}

.audio-player-wrapper {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}

audio {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  outline: none;
}

.meta-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── History List ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.history-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  transition: var(--transition);
}

.history-item:hover {
  border-color: var(--border-strong);
}

.history-info {
  flex: 1;
  min-width: 240px;
}

.history-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.history-details {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

/* ── Utilities ── */
.hidden {
  display: none !important;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
