/* Crear con IA — Page Styles */

/* ─── Variables ─── */
:root {
  --black:      #080808;
  --surface:    #111111;
  --surface2:   #161616;
  --surface3:   #1c1c1c;
  --border:     #1f1f1f;
  --border2:    #2a2a2a;
  --orange:     #FF6500;
  --orange-dim: #cc5000;
  --orange-glow:rgba(255,101,0,0.08);
  --amber:      #FFB800;
  --green:      #22c55e;
  --white:      #F5F5F0;
  --muted:      #555550;
  --muted2:     #888880;
  --mono:       'JetBrains Mono', monospace;
  --display:    'Bebas Neue', sans-serif;
  --body:       'DM Sans', sans-serif;
  --panel-left: 360px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Grain ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
  z-index: 9999;
}

/* ─── Nav ─── */
nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,8,0.98);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.nav-logo {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.04em;
  color: var(--white);
  text-decoration: none;
}
.nav-logo span { color: var(--orange); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  font-size: 12px;
  color: var(--muted2);
  padding: 6px 12px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.nav-links a:hover { background: var(--surface2); color: var(--white); }
.nav-links a.active { background: var(--orange-glow); color: var(--orange); }
.nav-apikey {
  display: flex;
  align-items: center;
  gap: 8px;
}
.apikey-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted2);
  cursor: pointer;
  padding: 5px 10px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  transition: border-color 0.2s;
}
.apikey-status:hover { border-color: var(--muted); }
.apikey-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.apikey-dot.connected { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }

/* ─── Main layout ─── */
.app {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Left panel ─── */
.panel-left {
  width: var(--panel-left);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-left-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.panel-left-scroll::-webkit-scrollbar { width: 4px; }
.panel-left-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-left-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Mode selector */
.panel-section-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.mode-btn:hover { border-color: var(--border2); background: var(--surface2); }
.mode-btn.active {
  border-color: var(--orange);
  background: var(--orange-glow);
}
.mode-icon { font-size: 18px; line-height: 1; }
.mode-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--white);
  line-height: 1.2;
}
.mode-desc { font-size: 10px; color: var(--muted2); line-height: 1.3; }
.mode-btn.active .mode-name { color: var(--orange); }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted2);
  text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--body);
  font-size: 13px;
  padding: 10px 12px;
  transition: border-color 0.2s;
  outline: none;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--orange);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select { cursor: pointer; }
.form-select option { background: var(--surface2); }

/* Platform chips */
.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.chip:hover { border-color: var(--muted); }
.chip.active {
  background: var(--orange-glow);
  border-color: var(--orange);
  color: var(--orange);
}

/* Generate button */
.generate-wrap {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--black);
}
.btn-generate {
  width: 100%;
  padding: 14px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}
.btn-generate:hover { background: var(--orange-dim); }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-generate .spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-generate.loading .spinner { display: block; }
.btn-generate.loading .btn-text::before { content: 'Generando'; }
.btn-generate:not(.loading) .btn-text::before { content: 'Generar contenido'; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Right panel ─── */
.panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Panel header */
.panel-right-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mode-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mode-title-icon { font-size: 20px; }
.mode-title h2 {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
}
.mode-title p { font-size: 12px; color: var(--muted2); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted2);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: var(--body);
}
.btn-icon:hover { border-color: var(--muted); color: var(--white); }

/* Results area */
.results-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.results-area::-webkit-scrollbar { width: 4px; }
.results-area::-webkit-scrollbar-track { background: transparent; }
.results-area::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Empty state */
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  opacity: 0.6;
}
.empty-icon {
  font-size: 48px;
  opacity: 0.4;
}
.empty-title {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.04em;
  color: var(--muted2);
}
.empty-sub { font-size: 13px; color: var(--muted); max-width: 320px; line-height: 1.6; }

/* Recording indicator */
.recording-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255,101,0,0.05);
  border: 1px solid rgba(255,101,0,0.15);
  border-radius: 8px;
  margin-bottom: 20px;
}
.recording-bar.active { display: flex; }
.rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse-rec 1s ease infinite;
  flex-shrink: 0;
}
@keyframes pulse-rec {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.rec-text { font-size: 12px; color: var(--orange); letter-spacing: 0.06em; font-family: var(--mono); }

/* Stream output */
.stream-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

.stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.stream-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stream-badge {
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 3px;
  font-family: var(--mono);
}
.stream-badge.ideas    { background: rgba(255,101,0,0.12); color: var(--orange); border: 1px solid rgba(255,101,0,0.2); }
.stream-badge.guion    { background: rgba(255,184,0,0.12); color: var(--amber); border: 1px solid rgba(255,184,0,0.2); }
.stream-badge.plantill { background: rgba(34,197,94,0.1);  color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.stream-badge.prompts  { background: rgba(139,92,246,0.12); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }
.stream-timestamp { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.stream-actions { display: flex; gap: 6px; }
.btn-copy, .btn-save {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted2);
  font-family: var(--body);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-copy:hover { border-color: var(--muted); color: var(--white); }
.btn-copy.copied { border-color: var(--green); color: var(--green); }
.btn-save:hover { border-color: var(--orange); color: var(--orange); }
.btn-save.saved { border-color: var(--orange); color: var(--orange); background: var(--orange-glow); }

.stream-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--white);
  white-space: pre-wrap;
  font-family: var(--body);
  min-height: 60px;
}
.stream-body.mono { font-family: var(--mono); font-size: 13px; }

/* Cursor blink */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--orange);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* History sidebar */
.history-section {
  margin-top: 8px;
}
.history-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.history-item {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.history-item:hover { border-color: var(--border2); }
.history-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.history-item-mode { font-size: 10px; letter-spacing: 0.08em; color: var(--orange); }
.history-item-time { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.history-item-preview { font-size: 12px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── API KEY MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  transform: translateY(16px);
  transition: transform 0.3s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-logo {
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}
.modal-logo span { color: var(--orange); }
.modal h2 { font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--muted2); line-height: 1.6; margin-bottom: 24px; }
.modal-input-wrap { position: relative; margin-bottom: 12px; }
.modal-input {
  width: 100%;
  background: var(--black);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--white);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 44px 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--orange); }
.modal-input::placeholder { color: var(--muted); }
.modal-input-toggle {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}
.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
}
.modal-hint a { color: var(--orange); text-decoration: none; }
.modal-hint a:hover { text-decoration: underline; }
.modal-actions { display: flex; gap: 10px; }
.btn-modal-primary {
  flex: 1;
  padding: 12px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-modal-primary:hover { background: var(--orange-dim); }
.btn-modal-secondary {
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted2);
  border-radius: 8px;
  font-family: var(--body);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-modal-secondary:hover { border-color: var(--muted); color: var(--white); }

/* ─── Divider ─── */
hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--white);
  z-index: 9500;
  transform: translateY(8px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.3); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.3); color: #f87171; }
