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

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #242838;
  --border: #2e3347;
  --text: #e4e6f0;
  --text2: #8b92ad;
  --accent: #5b6ef5;
  --accent2: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body { background: var(--bg); color: var(--text); font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; font-size: 15px; line-height: 1.6; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7c8ff8; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* ─── Header ────────────────────────────────────────────── */
.header { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 14px 0; position: sticky; top: 0; z-index: 100; }
.header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 20px; }
.nav-links a { color: var(--text2); font-size: 14px; }
.nav-links a:hover { color: var(--text); }

/* ─── Buttons ───────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4a5de0; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #2e3347; }
.btn-accent { background: linear-gradient(135deg, #f97316, #ec4899); color: #fff; }
.btn-accent:hover:not(:disabled) { opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: 13px; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.btn-sm:hover { background: var(--border); }

/* ─── Hero / URL Form ────────────────────────────────────── */
.hero { text-align: center; padding: 56px 0 40px; }
.hero h1 { font-size: clamp(22px, 4vw, 36px); font-weight: 700; margin-bottom: 12px; }
.subtitle { color: var(--text2); margin-bottom: 32px; font-size: 16px; }

.url-form { display: flex; gap: 10px; max-width: 700px; margin: 0 auto 20px; }
.url-input { flex: 1; padding: 12px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 15px; outline: none; }
.url-input:focus { border-color: var(--accent); }

.status-block { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--text2); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-block { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; padding: 12px 20px; border-radius: var(--radius); max-width: 600px; margin: 0 auto; }

/* ─── Videos Grid ───────────────────────────────────────── */
.videos-section { padding: 0 0 60px; }
.videos-section h2 { font-size: 20px; font-weight: 600; margin-bottom: 20px; }

.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.video-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, transform .2s; display: block; }
.video-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.video-thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-ready { background: rgba(34,197,94,.2); color: #4ade80; }
.badge-error { background: rgba(239,68,68,.2); color: #f87171; }
.badge-processing { background: rgba(91,110,245,.2); color: #818cf8; }

.video-info { padding: 12px 14px; }
.video-title { font-weight: 500; font-size: 14px; line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-meta { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.dot { opacity: .4; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }

/* ─── Video Page ─────────────────────────────────────────── */
.video-page { padding-top: 28px; }
.video-title-h1 { font-size: clamp(16px, 2.5vw, 24px); font-weight: 600; margin-bottom: 20px; line-height: 1.3; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.export-group { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.export-label { font-size: 13px; color: var(--text2); }

.search-panel { display: flex; gap: 10px; margin-bottom: 12px; }
.search-input { flex: 1; padding: 10px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none; }
.search-input:focus { border-color: var(--accent); }

.search-results { margin-bottom: 16px; }
.search-title { font-weight: 600; margin-bottom: 10px; color: var(--text2); font-size: 14px; }
.search-result-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.sr-time { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 4px; }
.sr-time:hover { color: #7c8ff8; }
.sr-summary { font-weight: 500; margin-bottom: 4px; font-size: 14px; }
.sr-quote { color: var(--text2); font-style: italic; font-size: 13px; margin-bottom: 10px; }
.no-results { color: var(--text2); padding: 12px; }

/* ─── Content Grid ────────────────────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; } }

/* ─── Player ────────────────────────────────────────────── */
.left-panel { position: sticky; top: 70px; }
.player-wrap { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 20px; }
.player-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ─── Clip Tool ─────────────────────────────────────────── */
.clip-tool { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.clip-tool h3 { font-size: 15px; margin-bottom: 12px; }
.clip-inputs { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.clip-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text2); }
.time-input { width: 80px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; text-align: center; outline: none; }
.time-input:focus { border-color: var(--accent); }
.clip-status { margin-top: 10px; font-size: 13px; color: var(--text2); padding: 8px 12px; background: var(--bg); border-radius: 8px; }

/* ─── Highlights ─────────────────────────────────────────── */
.highlights-block { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.highlights-block h3 { font-size: 15px; margin-bottom: 14px; }
.highlight-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.highlight-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.highlight-num { background: linear-gradient(135deg, #f97316, #ec4899); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.highlight-time { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; flex: 1; }
.highlight-time:hover { color: #7c8ff8; }
.highlight-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.highlight-desc { color: var(--text2); font-size: 13px; line-height: 1.5; }

/* ─── Transcript ─────────────────────────────────────────── */
.right-panel { max-height: calc(100vh - 100px); overflow-y: auto; position: sticky; top: 70px; }
.transcript-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.transcript-header h2 { font-size: 16px; font-weight: 600; }
.word-count { font-size: 12px; color: var(--text2); }

.transcript { line-height: 1.8; font-size: 15px; }
.ts-label { display: inline-block; color: var(--accent); font-size: 12px; font-weight: 700; padding: 2px 8px; background: rgba(91,110,245,.12); border-radius: 5px; margin: 12px 0 4px; cursor: pointer; }
.ts-label:hover { background: rgba(91,110,245,.25); }
.ts-text { cursor: pointer; border-radius: 3px; padding: 1px 2px; transition: background .15s; }
.ts-text:hover { background: rgba(255,255,255,.06); }
.ts-text.ts-active { background: rgba(91,110,245,.2); color: #c7d0ff; }

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

/* ─── Free tier counter ──────────────────────────────────── */
.usage-counter { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 16px 0; }
.usage-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bg3); border: 2px solid var(--border); transition: all .2s; }
.usage-dot.used { background: var(--accent); border-color: var(--accent); }
.usage-text { font-size: 13px; color: var(--text2); }

.limit-banner { background: linear-gradient(135deg, rgba(239,68,68,.15), rgba(249,115,22,.1)); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius); padding: 16px 24px; margin: 16px 0; color: var(--text); line-height: 1.6; }

/* ─── Input Tabs ─────────────────────────────────────────── */
.input-tabs { display: flex; gap: 8px; justify-content: center; margin: 20px 0 14px; }
.tab-btn { padding: 8px 20px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; font-size: 14px; transition: all .15s; }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-btn:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* ─── Drop Zone ──────────────────────────────────────────── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 36px 24px; text-align: center; cursor: pointer; transition: all .2s; background: var(--bg2); margin-bottom: 12px; }
.drop-zone:hover:not(.disabled), .drop-zone.drag-over { border-color: var(--accent); background: rgba(91,110,245,.06); }
.drop-zone.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.drop-icon { font-size: 36px; margin-bottom: 10px; }
.drop-text { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.drop-label { color: var(--accent); cursor: pointer; text-decoration: underline; }
.drop-label:hover { color: #7c8ff8; }
.drop-hint { font-size: 12px; color: var(--text2); }
.file-name { font-size: 13px; color: var(--text2); padding: 8px 12px; background: var(--bg3); border-radius: 8px; margin-bottom: 10px; text-align: left; }

/* ─── Upload Progress ────────────────────────────────────── */
.upload-progress { margin: 16px 0; }
.progress-bar { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 4px; transition: width .3s; }
#progressText { font-size: 13px; color: var(--text2); }

/* ─── Upload thumb ───────────────────────────────────────── */
.upload-thumb { width: 100%; aspect-ratio: 16/9; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 40px; border-radius: 6px 6px 0 0; }

/* ─── Features Grid ──────────────────────────────────────── */
.features-section { padding: 48px 0; }
.features-section h2 { text-align: center; font-size: 24px; margin-bottom: 32px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ─── FAQ ────────────────────────────────────────────────── */
.faq-section { padding: 0 0 56px; }
.faq-section h2 { font-size: 24px; margin-bottom: 24px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.faq-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-item summary { padding: 16px 20px; cursor: pointer; font-size: 15px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: "+"; font-size: 20px; color: var(--text2); transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding: 0 20px 16px; color: var(--text2); font-size: 14px; line-height: 1.6; }

/* ─── Footer ─────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 24px 0; text-align: center; color: var(--text2); font-size: 13px; }

/* ─── How it works ───────────────────────────────────────── */
.how-section { padding: 48px 0 32px; }
.how-section h2 { text-align: center; font-size: 24px; margin-bottom: 32px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; position: relative; }
.step-num { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), #7c3aed); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 14px; }
.step-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.step-card p { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ─── Use cases ──────────────────────────────────────────── */
.usecases-section { padding: 0 0 48px; }
.usecases-section h2 { font-size: 24px; margin-bottom: 28px; }
.usecases-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.usecase-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.uc-icon { font-size: 28px; margin-bottom: 10px; }
.usecase-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.usecase-card p { font-size: 13px; color: var(--text2); line-height: 1.5; }

/* ─── Global stats counter ───────────────────────────────── */
.global-stats { font-size: 13px; color: var(--text2); margin-top: 8px; }
.global-stats strong { color: var(--accent); }

/* ─── Feedback button (header + footer) ─────────────────── */
.btn-feedback { background: none; border: 1px solid var(--border); color: var(--text2); padding: 5px 12px; border-radius: var(--radius); cursor: pointer; font-size: 13px; transition: all .15s; }
.btn-feedback:hover { border-color: var(--accent); color: var(--text); }
.footer-feedback-btn { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 13px; text-decoration: underline; }
.footer-feedback-btn:hover { color: var(--text); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 440px; position: relative; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-box h3 { font-size: 18px; margin-bottom: 6px; }
.modal-subtitle { font-size: 13px; color: var(--text2); margin-bottom: 16px; }
.modal-textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 10px 12px; font-size: 14px; resize: vertical; min-height: 110px; margin-bottom: 10px; font-family: inherit; }
.modal-textarea:focus { outline: none; border-color: var(--accent); }
.modal-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 9px 12px; font-size: 14px; margin-bottom: 14px; font-family: inherit; }
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-error { color: var(--red); font-size: 13px; margin-bottom: 10px; }
.modal-success { color: var(--green); font-size: 14px; margin-bottom: 10px; font-weight: 500; }
