/* ─── 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; }

/* ─── Screens ─────────────────────────────────────────────── */
.screen {
  display: block;
  width: 100%;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 56px;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* ─── Error msg ───────────────────────────────────────────── */
.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 ─────────────────────────────────────────────── */
.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); }


/* ─── 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; }

/* ─── 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: 14px 16px 16px; }
.input-label {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.textarea-wrap { position: relative; }
#problem-input {
  width: 100%; min-height: 96px; max-height: 180px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  padding: 10px 12px; resize: vertical; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit; line-height: 1.5;
}
#problem-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
#problem-input::placeholder { color: var(--text-dim); }

.char-hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; text-align: right; }

/* ─── Examples ────────────────────────────────────────────── */
.examples-row {
  display: flex; gap: 5px; flex-wrap: wrap; margin: 10px 0 12px;
}
.example-chip {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: 11.5px;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(124,58,237,0.08); }

/* ─── Loading Screen ──────────────────────────────────────── */
.loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 44px 20px; text-align: center; min-height: 280px; 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; position: sticky; top: 0; z-index: 10;
}
.results-meta { font-size: 11px; color: var(--text-dim); flex: 1; text-align: center; }

/* ─── Input Summary ───────────────────────────────────────── */
.input-summary {
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(79,70,229,0.04));
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.input-summary-label { font-size: 10px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.input-summary-text  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* ─── Section Groups ──────────────────────────────────────── */
.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);
}

/* ─── Result Sections ─────────────────────────────────────── */
.result-section { border-bottom: 1px solid var(--border); }
.section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px; 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 14px; }

/* ─── Opportunity / Competition Badges ───────────────────── */
.level-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px;
}
.level-alta     { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.level-media    { background: rgba(245,158,11,0.1);  color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.level-baja     { background: rgba(239,68,68,0.1);   color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
.level-poca     { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.level-moderada { background: rgba(245,158,11,0.1);  color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.level-saturado { background: rgba(239,68,68,0.1);   color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }

.justification-text {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
  padding: 10px 12px; background: var(--bg-input); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─── Market Section ──────────────────────────────────────── */
.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.market-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.market-card-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; margin-bottom: 5px; }
.market-card-value { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.market-card-value strong { color: var(--text); font-weight: 600; }

/* ─── Business Model ──────────────────────────────────────── */
.model-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.35);
  border-radius: 20px; padding: 5px 14px; font-size: 13px; font-weight: 700;
  color: var(--accent-light); margin-bottom: 10px;
}
.model-alts {
  display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px;
}
.model-alt-chip {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px; font-size: 11.5px; color: var(--text-muted);
}
.model-reasoning {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
}

/* ─── Product Idea Cards ──────────────────────────────────── */
.idea-cards { display: flex; flex-direction: column; gap: 10px; }
.idea-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; position: relative;
  transition: border-color 0.15s;
}
.idea-card:hover { border-color: var(--border-light); }
.idea-card.idea-simple   { border-left: 3px solid rgba(34,197,94,0.5); }
.idea-card.idea-intermedio { border-left: 3px solid rgba(59,130,246,0.5); }
.idea-card.idea-complejo { border-left: 3px solid rgba(124,58,237,0.5); }

.idea-type-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px;
  border-radius: 4px; margin-bottom: 7px;
}
.type-simple    { background: rgba(34,197,94,0.12);  color: #22c55e; }
.type-intermedio{ background: rgba(59,130,246,0.12); color: #3b82f6; }
.type-complejo  { background: rgba(124,58,237,0.15); color: var(--accent-light); }

.idea-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 5px; letter-spacing: -0.2px; }
.idea-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }
.idea-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.idea-price {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.25);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 600; color: #22c55e;
}
.idea-time {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; color: var(--text-muted);
}

/* ─── Distribution Channels ───────────────────────────────── */
.dist-list { display: flex; flex-direction: column; gap: 7px; }
.dist-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.dist-item:hover { border-color: var(--border-light); }
.dist-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.dist-info {}
.dist-channel { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.dist-desc    { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* ─── Risk List ───────────────────────────────────────────── */
.risk-list { display: flex; flex-direction: column; gap: 8px; }
.risk-item {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.risk-header {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px 8px;
}
.risk-icon  { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.risk-text  { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.4; }
.mitigation {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 12px 10px; border-top: 1px solid var(--border);
  background: rgba(34,197,94,0.04);
}
.mit-icon { font-size: 12px; flex-shrink: 0; margin-top: 1px; color: var(--success); }
.mit-text { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* ─── Next Steps ──────────────────────────────────────────── */
.steps-list { display: flex; flex-direction: column; gap: 6px; }
.next-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.next-step:hover { border-color: var(--border-light); }
.step-num {
  flex-shrink: 0; width: 20px; height: 20px; background: rgba(124,58,237,0.2);
  color: var(--accent-light); border-radius: 5px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.step-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

/* ─── 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); }
