@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #07070f;
  --bg2:       #0e0e1a;
  --surface:   rgba(255,255,255,0.04);
  --surface2:  rgba(255,255,255,0.08);
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.15);
  --p1:        #7c3aed;
  --p2:        #06b6d4;
  --grad:      linear-gradient(135deg, var(--p1), var(--p2));
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --success:   #10b981;
  --error:     #ef4444;
  --warning:   #f59e0b;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
  --trans:     all 0.25s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* RTL support */
body[dir="rtl"] { direction: rtl; }
body[dir="rtl"] .nav-actions { flex-direction: row-reverse; }
body[dir="rtl"] .export-actions { flex-direction: row-reverse; }

/* Animated background blobs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: blob1 12s ease-in-out infinite alternate;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,0.12) 0%, transparent 70%);
  bottom: -150px; right: -150px;
  animation: blob2 10s ease-in-out infinite alternate;
}
@keyframes blob1 { to { transform: translate(100px, 80px) scale(1.1); } }
@keyframes blob2 { to { transform: translate(-80px, -60px) scale(1.15); } }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hidden { display: none !important; }

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

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px,4vw,48px);
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex; align-items: center; gap: 10px;
}
.nav-brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Language selector */
.lang-select {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px; padding: 6px 10px;
  font-size: 0.85rem; cursor: pointer; outline: none;
  transition: var(--trans);
}
.lang-select:hover { border-color: var(--p1); }
.lang-select option { background: #1a1a2e; }

/* Nav buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 500; transition: var(--trans); outline: none; }
.btn-ghost { background: var(--surface); color: var(--text2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px; font-size: 0.85rem; }
.btn-ghost:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.btn-primary { background: var(--grad); color: #fff; border-radius: 10px;
  padding: 10px 22px; font-size: 0.9rem; font-weight: 600; box-shadow: 0 4px 20px rgba(124,58,237,0.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(124,58,237,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--error);
  border: 1px solid rgba(239,68,68,0.25); border-radius: 8px; padding: 6px 12px; font-size: 0.8rem; }
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-success { background: rgba(16,185,129,0.12); color: var(--success);
  border: 1px solid rgba(16,185,129,0.25); border-radius: 8px; padding: 6px 12px; font-size: 0.8rem; }
.btn-success:hover { background: rgba(16,185,129,0.22); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 clamp(16px,4vw,32px); position: relative; z-index: 1; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 60px 0 40px; }
.hero h1 { font-size: clamp(2rem,5vw,3.2rem); font-weight: 800; letter-spacing: -1.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; line-height: 1.1; margin-bottom: 12px; }
.hero p { color: var(--text2); font-size: 1.05rem; margin-bottom: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 100px; padding: 6px 16px; font-size: 0.82rem;
  color: var(--text2); font-weight: 500;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Upload Card ──────────────────────────────────────────────────────────── */
.upload-card { padding: 10px 0 32px; }

.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--trans);
  position: relative;
  overflow: hidden;
}
.drop-zone::before {
  content: ''; position: absolute; inset: 0;
  background: var(--grad); opacity: 0; transition: var(--trans);
}
.drop-zone.dragover { border-color: var(--p1); box-shadow: 0 0 0 4px rgba(124,58,237,0.15); }
.drop-zone.dragover::before { opacity: 0.05; }
.drop-zone:hover { border-color: var(--border2); }

.drop-icon { font-size: 3rem; margin-bottom: 16px; display: block; filter: drop-shadow(0 0 20px rgba(124,58,237,0.4)); }
.drop-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.drop-sub { color: var(--text2); font-size: 0.88rem; margin-bottom: 10px; }
.drop-formats { color: var(--text3); font-size: 0.78rem; }

.file-info {
  display: none; align-items: center; justify-content: center; gap: 12px;
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 12px 18px; margin-top: 16px; font-size: 0.88rem;
}
.file-info.show { display: flex; }
.file-info .file-name { color: var(--text); font-weight: 500; word-break: break-all; }
.file-info .file-size { color: var(--text3); white-space: nowrap; }
.file-clear { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 1.1rem;
  transition: var(--trans); padding: 2px 6px; border-radius: 4px; }
.file-clear:hover { color: var(--error); background: rgba(239,68,68,0.1); }

/* ── Options ──────────────────────────────────────────────────────────────── */
.options-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0;
}
@media (max-width: 560px) { .options-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; color: var(--text2); font-weight: 500; letter-spacing: 0.3px; }
.field select, .field input[type="text"], .field input[type="password"], .field input[type="email"] {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.9rem; font-family: inherit; outline: none; transition: var(--trans);
}
.field select:focus, .field input:focus { border-color: var(--p1); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.field select option { background: #1a1a2e; }

/* Large file warning */
.large-file-tip {
  display: none; align-items: center; gap: 8px;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--warning); font-size: 0.85rem; margin-top: 4px;
}
.large-file-tip.show { display: flex; }

/* Action row */
.action-row { display: flex; gap: 12px; margin-top: 20px; }
.action-row .btn-primary { flex: 1; justify-content: center; height: 48px; font-size: 1rem; }
.action-row .btn-ghost { height: 48px; padding: 0 20px; }

/* ── Progress ─────────────────────────────────────────────────────────────── */
.progress-wrap {
  display: none; flex-direction: column; gap: 10px; padding: 24px;
}
.progress-wrap.show { display: flex; }
.progress-label { font-size: 0.9rem; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.progress-label .spinner {
  width: 16px; height: 16px; border: 2px solid var(--border2);
  border-top-color: var(--p1); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar-track { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.progress-bar-fill {
  height: 100%; background: var(--grad); border-radius: 2px;
  width: 0%; transition: width 0.4s ease;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%,100% { filter: brightness(1); }
  50%       { filter: brightness(1.3); }
}

/* ── Result ───────────────────────────────────────────────────────────────── */
.result-card { display: none; padding: 28px; margin-top: 24px; }
.result-card.show { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.result-title { font-size: 1rem; font-weight: 600; }

.transcript-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px;
  min-height: 140px; max-height: 360px; overflow-y: auto;
  font-size: 0.92rem; line-height: 1.8; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

/* ── Export ───────────────────────────────────────────────────────────────── */
.export-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.export-label { font-size: 0.82rem; color: var(--text3); font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 12px; }
.export-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-export {
  flex: 1; min-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 14px 16px;
  cursor: pointer; font-family: inherit; transition: var(--trans); font-size: 0.82rem;
}
.btn-export .export-icon { font-size: 1.4rem; }
.btn-export .export-ext { font-weight: 600; font-size: 0.78rem; color: var(--text3); }
.btn-export:hover { background: rgba(124,58,237,0.12); border-color: var(--p1); transform: translateY(-2px); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 260px; max-width: 360px;
  background: var(--surface2); backdrop-filter: blur(20px);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 0.88rem;
  display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn 0.3s ease; box-shadow: var(--shadow);
}
.toast.exit { animation: toastOut 0.3s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast.success { border-color: rgba(16,185,129,0.35); }
.toast.error   { border-color: rgba(239,68,68,0.35); }
.toast.warning { border-color: rgba(245,158,11,0.35); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 32px; width: 100%; max-width: 420px;
  position: relative; animation: scaleIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text2); border-radius: 8px;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; transition: var(--trans); }
.modal-close:hover { color: var(--text); border-color: var(--border2); }
.modal-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.modal-sub { color: var(--text2); font-size: 0.88rem; margin-bottom: 24px; }
.modal-tabs { display: flex; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 24px;
  background: var(--surface); border: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 9px; border: none; background: none; color: var(--text2);
  cursor: pointer; font-family: inherit; font-size: 0.88rem; font-weight: 500; transition: var(--trans); }
.tab-btn.active { background: var(--grad); color: #fff; }
.modal form { display: flex; flex-direction: column; gap: 16px; }
.modal .btn-primary { width: 100%; justify-content: center; height: 46px; font-size: 0.95rem; }
.modal-switch { text-align: center; margin-top: 12px; }
.modal-switch button { background: none; border: none; color: var(--p2); cursor: pointer;
  font-family: inherit; font-size: 0.85rem; text-decoration: underline; }
.modal-switch button:hover { color: var(--p1); }
.form-error { color: var(--error); font-size: 0.82rem; margin-top: -8px; }

/* ── History ──────────────────────────────────────────────────────────────── */
.history-section { margin-top: 40px; padding-bottom: 60px; }
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.history-header h2 { font-size: 1.2rem; font-weight: 700; }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: var(--trans); cursor: default;
}
.history-item:hover { border-color: var(--border2); background: var(--surface2); }
.history-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-file { font-weight: 600; font-size: 0.92rem; word-break: break-all; }
.history-date { color: var(--text3); font-size: 0.78rem; white-space: nowrap; margin-top: 2px; }
.history-preview { color: var(--text2); font-size: 0.85rem; margin-top: 8px; overflow: hidden;
  text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.history-dl-group { display: flex; gap: 4px; }
.history-empty-msg { text-align: center; color: var(--text3); padding: 48px 0; font-size: 0.95rem; }

/* ── User chip ────────────────────────────────────────────────────────────── */
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 100px; padding: 5px 14px 5px 6px; font-size: 0.83rem;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff; text-transform: uppercase; flex-shrink: 0;
}

/* ── Pricing Section ──────────────────────────────────────────────────────── */
.pricing-section { margin: 60px 0; padding: 40px 0; }
.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px; width: 100%;
}
.pricing-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 24px; transition: var(--trans);
  background: var(--surface); position: relative;
}
.pricing-card:hover { border-color: var(--border2); transform: translateY(-4px); }
.pricing-card.featured {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.1));
  border: 2px solid var(--p1); transform: scale(1.05);
}
.pricing-header { margin-bottom: 24px; }
.pricing-header h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; }
.pricing-price {
  display: flex; align-items: baseline; gap: 4px;
}
.pricing-price .price { font-size: 2.5rem; font-weight: 800; background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.pricing-price .period { color: var(--text2); font-size: 0.9rem; }
.pricing-features { list-style: none; margin-bottom: 24px; }
.pricing-features li {
  padding: 10px 0; color: var(--text2); font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.pricing-features li:last-child { border-bottom: none; }
.plan-button { width: 100%; }

/* ── Payment Section ──────────────────────────────────────────────────────── */
.payment-section {
  margin: 60px 0; padding: 40px 0;
}
.payment-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px; max-width: 600px; margin: 0 auto;
  background: var(--surface);
}
.payment-card h2 {
  font-size: 1.3rem; font-weight: 700; margin-bottom: 28px;
}
.payment-tabs {
  display: flex; gap: 12px; margin-bottom: 32px;
  border-bottom: 1px solid var(--border); padding-bottom: 16px;
}
.payment-tab {
  background: none; border: none; color: var(--text2); cursor: pointer;
  padding: 8px 12px; border-radius: 8px; transition: var(--trans);
  font-weight: 500; font-size: 0.9rem; display: flex; align-items: center; gap: 6px;
}
.payment-tab:hover { color: var(--text); background: var(--surface2); }
.payment-tab.active {
  color: var(--p1); border-bottom: 2px solid var(--p1); padding-bottom: 6px;
}
.payment-tab .payment-icon { font-size: 1.1rem; }
.payment-form { animation: fadeIn 0.3s ease-in-out; }
.payment-form.hidden { display: none; }
.payment-details {
  border-left: 3px solid var(--p1) !important;
}
#card-element {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif;
}
#card-errors { margin-top: 10px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .modal { padding: 24px 20px; }
  .hero h1 { font-size: 1.8rem; }
  .action-row { flex-direction: column; }
}
