/* ─── Variables ───────────────────────────────────────────── */
:root {
  --bg:           #0d0d18;
  --bg-card:      #141426;
  --bg-input:     #1c1c32;
  --bg-hover:     #1e1e38;
  --border:       #2a2a48;
  --border-light: #323258;
  --accent:       #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #a78bfa;
  --accent-glow:  rgba(124, 58, 237, 0.25);
  --groq:         #f97316;
  --gemini:       #3b82f6;
  --openai:       #22c55e;
  --text:         #e2e2f0;
  --text-muted:   #7878a8;
  --text-dim:     #4a4a70;
  --success:      #22c55e;
  --error:        #ef4444;
  --warning:      #f59e0b;
  --radius:       10px;
  --radius-sm:    7px;
}

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

/* ─── Base ────────────────────────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
}

body {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body::-webkit-scrollbar { width: 4px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── App container ───────────────────────────────────────── */
#app-container {
  width: 100%;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 56px;
}

/* ─── Screens ─────────────────────────────────────────────── */
.screen { display: block; }
.screen.hidden { display: none; }

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

.msg-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--error);
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover { background: linear-gradient(135deg, #8b5cf6, #7c3aed); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124, 58, 237, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-full { width: 100%; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-hover); }
.btn-ghost.btn-accent { color: var(--accent-light); border-color: rgba(124,58,237,0.35); }
.btn-ghost.btn-accent:hover { background: rgba(124,58,237,0.1); border-color: var(--accent); }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover { border-color: var(--border-light); color: var(--text); background: var(--bg-hover); }

.btn-link {
  background: none;
  border: none;
  color: var(--accent-light);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover { color: var(--accent); }

.copy-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  border-radius: 5px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover { border-color: var(--border); color: var(--text-muted); background: var(--bg-hover); }
.copy-btn.copied { color: var(--success); border-color: rgba(34,197,94,0.3); }

/* ─── License Screen ──────────────────────────────────────── */
.license-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 40px 32px;
  min-height: 300px;
}

.license-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}

.license-logo svg { display: block; width: 100%; height: 100%; }

.license-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.license-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.license-box {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.license-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.license-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  letter-spacing: 0.5px;
  transition: border-color 0.15s;
  outline: none;
}

.license-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.license-input::placeholder { color: var(--text-dim); font-family: inherit; letter-spacing: 0; }

.license-footer {
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}

.license-footer strong {
  color: var(--accent-light);
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* ─── Header ──────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ─── AI Selector ─────────────────────────────────────────── */
.ai-selector {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
}

.ai-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 0;
  cursor: pointer;
  transition: all 0.15s;
}

.ai-tab:hover { border-color: var(--border-light); color: var(--text); }

.ai-tab.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(124,58,237,0.12);
  box-shadow: 0 0 0 1px rgba(124,58,237,0.25);
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Comment Count Selector ─────────────────────────────── */
.count-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 0;
}

.count-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.count-options {
  display: flex;
  gap: 4px;
  flex: 1;
}

.count-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 0;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.count-btn:hover:not(:disabled) { border-color: var(--border-light); color: var(--text); background: var(--bg-hover); }
.count-btn.active { background: rgba(124,58,237,0.15); border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px rgba(124,58,237,0.2); }
.count-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.count-btn:disabled.active { opacity: 0.5; }

/* ─── Config Warning ──────────────────────────────────────── */
.config-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 16px 0;
  padding: 8px 12px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 12px;
}

/* ─── Input Group ─────────────────────────────────────────── */
.input-group {
  padding: 12px 16px 16px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

#video-url {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 10px 34px 10px 32px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#video-url:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
#video-url::placeholder { color: var(--text-dim); }

.btn-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-clear:hover { color: var(--text-muted); }

/* ─── Loading Screen ──────────────────────────────────────── */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 260px;
  justify-content: center;
}

.loading-icon {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.loading-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
  min-height: 18px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.step-dot.pending { background: var(--border); }
.step-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: pulse 1.2s ease infinite; }
.step-dot.done { background: var(--success); }

.step.active { color: var(--text); }
.step.done { color: var(--success); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ─── Results Header ──────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  gap: 8px;
}

.results-meta {
  font-size: 11px;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
}

/* ─── Sentiment Banner ────────────────────────────────────── */
.sentiment-banner {
  position: relative;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 16px 14px;
}

.sentiment-score {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.sentiment-emoji {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.sentiment-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  text-transform: capitalize;
}

.sentiment-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sentiment-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 54px;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
  width: 0%;
}

.bar-green { background: var(--success); }
.bar-gray  { background: var(--text-dim); }
.bar-red   { background: var(--error); }

.bar-pct {
  font-size: 11px;
  color: var(--text-muted);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.sentiment-banner .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* ─── Result Sections ─────────────────────────────────────── */
.result-section {
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  cursor: pointer;
  user-select: none;
}

.section-icon { font-size: 14px; flex-shrink: 0; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.section-content {
  padding: 0 14px 12px;
}

/* List items */
.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.result-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 6px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.result-list li:hover { border-color: var(--border); }

.list-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: rgba(124,58,237,0.2);
  color: var(--accent-light);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Keywords cloud */
.keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-tag {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.keyword-tag:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(124,58,237,0.1); }

.keyword-tag.size-1 { font-size: 13px; color: var(--text); border-color: var(--border-light); }
.keyword-tag.size-2 { font-size: 12.5px; color: var(--text); }
.keyword-tag.size-3 { font-size: 12px; }

/* ─── Results Footer ──────────────────────────────────────── */
.results-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.ai-badge {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.footer-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── Video Info Card ─────────────────────────────────────── */
.video-info-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(79,70,229,0.05));
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px;
}

.vi-header { margin-bottom: 10px; }

.vi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vi-channel { font-size: 11.5px; color: var(--text-muted); }

.vi-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.vi-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ─── Section Group Labels ────────────────────────────────── */
.section-group-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ─── SEO Score ───────────────────────────────────────────── */
.seo-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.seo-score-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  border: 2.5px solid;
}

.score-high   { color: var(--success); border-color: var(--success); background: rgba(34,197,94,0.1); }
.score-medium { color: var(--warning); border-color: var(--warning); background: rgba(245,158,11,0.1); }
.score-low    { color: var(--error);   border-color: var(--error);   background: rgba(239,68,68,0.1); }

.seo-score-label { font-size: 10px; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.3px; }
.seo-assessment  { font-size: 12.5px; color: var(--text); line-height: 1.45; }

/* ─── Check Lists ─────────────────────────────────────────── */
.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.check-marker { flex-shrink: 0; font-size: 12px; margin-top: 1px; }

/* ─── Engagement Stats ────────────────────────────────────── */
.engagement-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.eng-stat {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.eng-stat-value { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 4px; }
.eng-stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }

.perf-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 10px;
}

.perf-alto  { background: rgba(34,197,94,0.12);  color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.perf-medio { background: rgba(245,158,11,0.1);  color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.perf-bajo  { background: rgba(239,68,68,0.1);   color: var(--error);   border: 1px solid rgba(239,68,68,0.2); }

/* ─── Tags analysis ───────────────────────────────────────── */
.tags-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.relevance-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.rel-alta  { background: rgba(34,197,94,0.12);  color: var(--success); }
.rel-media { background: rgba(245,158,11,0.1);  color: var(--warning); }
.rel-baja  { background: rgba(239,68,68,0.1);   color: var(--error); }

/* ─── Status chips (CTA / links) ─────────────────────────── */
.status-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.status-chip {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
}
.chip-yes { background: rgba(34,197,94,0.12);  color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.chip-no  { background: rgba(239,68,68,0.1);   color: var(--error);   border: 1px solid rgba(239,68,68,0.2); }
