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

:root {
  --bg:      #0a0a0f;
  --bg2:     #111118;
  --bg3:     #1a1a24;
  --border:  #2a2a3a;
  --accent:  #7c5cfc;
  --accent2: #a78bfa;
  --text:    #e8e8f0;
  --muted:   #6060a0;
  --green:   #22c55e;
  --radius:  14px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  padding-bottom: 80px;
}
a { color: inherit; text-decoration: none; }
textarea, input { font-family: inherit; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hdr-inner {
  max-width: 860px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 16px;
}
.logo { font-size: 18px; font-weight: 700; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.plan-badge {
  background: rgba(124,92,252,.2); border: 1px solid rgba(124,92,252,.4);
  color: var(--accent2); padding: 2px 10px; border-radius: 100px; font-size: 11px; font-weight: 700;
}

.btn-auth, .btn-logout {
  background: var(--accent); color: #fff; border: none;
  padding: 7px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .2s;
}
.btn-auth:hover, .btn-logout:hover { opacity: .85; }
.btn-logout { background: transparent; border: 1px solid var(--border); color: var(--muted); }

/* ── Modal ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; width: 100%; max-width: 380px; position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer;
}
.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }

.auth-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg2); border-radius: 10px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 8px; border: none; border-radius: 8px; background: none;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s;
}
.auth-tab.active { background: var(--accent); color: #fff; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  width: 100%; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 15px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }

.auth-err { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #f87171; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.btn-submit {
  padding: 13px; background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity .2s;
}
.btn-submit:hover { opacity: .9; }

/* ── Main ── */
.main { max-width: 860px; margin: 0 auto; padding: 32px 16px; display: flex; flex-direction: column; gap: 32px; }

/* ── Upload section ── */
.upload-section { display: flex; flex-direction: column; gap: 16px; }
.section-head h1 { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.section-head p { color: var(--muted); font-size: 15px; }

.input-tabs { display: flex; gap: 4px; background: var(--bg3); border-radius: 10px; padding: 4px; width: fit-content; }
.itab {
  padding: 7px 18px; border: none; border-radius: 7px; background: none;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s;
}
.itab.active { background: var(--accent); color: #fff; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; background: var(--bg3);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(124,92,252,.06); }
.dz-icon { font-size: 40px; }
.dz-text { font-size: 16px; font-weight: 600; }
.dz-hint { font-size: 13px; color: var(--muted); }
#file-input { display: none; }

/* URL input */
.url-wrap { display: flex; flex-direction: column; gap: 6px; }
.url-field {
  width: 100%; padding: 14px 16px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 15px;
}
.url-field:focus { outline: none; border-color: var(--accent); }
.url-hint { font-size: 12px; color: var(--muted); padding-left: 4px; }

/* Options */
.options-row { display: flex; flex-wrap: wrap; gap: 16px; }
.opt-check {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14px; color: var(--muted);
}
.opt-check input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.opt-check:hover { color: var(--text); }

/* Transcribe button */
.btn-transcribe {
  padding: 15px 32px; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); font-size: 16px; font-weight: 700; cursor: pointer;
  transition: opacity .2s, transform .2s; align-self: flex-start;
}
.btn-transcribe:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-transcribe:disabled { opacity: .4; cursor: default; }

/* ── Progress ── */
.progress-section {}
.progress-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.prog-icon { font-size: 32px; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.prog-text { font-size: 15px; color: var(--muted); }
.prog-bar-wrap {
  width: 100%; max-width: 320px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.prog-bar {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px; transition: width .5s ease; width: 0%;
}

/* ── Result ── */
.result-section { display: flex; flex-direction: column; gap: 0; }
.result-tabs {
  display: flex; gap: 4px; background: var(--bg3); border-radius: 12px 12px 0 0;
  padding: 8px 8px 0; border: 1px solid var(--border); border-bottom: none;
}
.rtab {
  padding: 8px 18px; border: none; background: none;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: 8px 8px 0 0; transition: .2s;
}
.rtab.active { background: var(--bg); color: var(--text); }

.rtab-content {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 0 12px 12px 12px; padding: 20px;
}

/* Toolbar */
.result-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.lang-badge, .dur-badge {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 100px; font-size: 12px; color: var(--muted);
}
.toolbar-btns { margin-left: auto; display: flex; gap: 8px; }
.tbtn {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: .2s;
}
.tbtn:hover { border-color: var(--accent); }

.transcript-box {
  white-space: pre-wrap; line-height: 1.8; font-size: 15px; color: var(--text);
  max-height: 500px; overflow-y: auto; padding-right: 4px;
}
.transcript-box::-webkit-scrollbar { width: 4px; }
.transcript-box::-webkit-scrollbar-track { background: var(--bg2); }
.transcript-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.summary-box {
  line-height: 1.8; font-size: 15px; color: var(--text); white-space: pre-wrap;
}

/* Chat */
.chat-messages {
  min-height: 200px; max-height: 400px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; padding-right: 4px;
}
.chat-hint { color: var(--muted); font-size: 14px; text-align: center; padding: 40px 0; }

.msg-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6;
}
.msg-mine { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-ai { background: var(--bg2); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }

.chat-input-bar {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
#chat-input {
  flex: 1; background: none; border: none; color: var(--text); font-size: 14px;
  resize: none; max-height: 120px; line-height: 1.5;
}
#chat-input:focus { outline: none; }
#chat-send {
  background: var(--accent); border: none; color: #fff; width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer; font-size: 14px; flex-shrink: 0; transition: opacity .2s;
}
#chat-send:hover { opacity: .85; }

/* ── History ── */
.history-section { display: flex; flex-direction: column; gap: 12px; }
.history-section h3 { font-size: 18px; font-weight: 700; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: border-color .2s;
}
.history-item:hover { border-color: var(--accent); }
.hi-icon { font-size: 20px; flex-shrink: 0; }
.hi-info { flex: 1; min-width: 0; }
.hi-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hi-arrow { color: var(--muted); font-size: 18px; }

/* ── Trial bar ── */
.trial-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: linear-gradient(135deg, #1a1228, #1a1a2e);
  border-top: 1px solid rgba(124,92,252,.4);
  padding: 12px 20px; display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap; font-size: 14px;
}
.trial-upgrade {
  background: var(--accent); color: #fff; padding: 6px 16px; border-radius: 8px; font-weight: 700; font-size: 13px;
}

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

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