/* =============================================
   APPS SCRIPT GENERATOR — DESIGN SYSTEM
   Paleta: negro · celeste · rosa pastel · verde pastel
   ============================================= */

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

:root {
  --sky:        #38bdf8;
  --sky-dark:   #0284c7;
  --sky-light:  #e0f2fe;
  --sky-glow:   rgba(56,189,248,0.15);
  --pink:       #fbcfe8;
  --pink-dark:  #ec4899;
  --pink-bg:    #fdf2f8;
  --green:      #86efac;
  --green-dark: #22c55e;
  --green-bg:   #f0fdf4;
  --amber:      #fde68a;
  --dark:       #0f172a;
  --dark-2:     #1e293b;
  --dark-3:     #334155;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius:     14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.12);
}

html, body { height: 100%; font-family: var(--font); }

/* ─────────────────────────────────────────────
   HEADER
───────────────────────────────────────────── */

.header-bar {
  background: var(--dark);
  border-bottom: 1px solid var(--dark-2);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.header-bg-texture {
  position: absolute;
  inset: 0;
  background-image: url('../img/one-fondochicocolor.jpg');
  background-size: cover;
  background-position: center 30%;
  opacity: 0.07;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────── */

.sidebar-panel {
  background: var(--dark);
  border-right-color: var(--dark-2);
}

/* Step items */
.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: default;
  transition: background 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--dark-2);
  color: var(--muted);
  border: 2px solid var(--dark-3);
  transition: all 0.2s;
}

.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.step-item.active {
  background: rgba(56,189,248,0.08);
}

.step-item.active .step-circle {
  background: var(--sky);
  color: var(--dark);
  border-color: var(--sky);
  box-shadow: 0 0 14px rgba(56,189,248,0.45);
}

.step-item.active .step-label {
  color: #e2e8f0;
  font-weight: 600;
}

.step-item.completed .step-circle {
  background: rgba(134,239,172,0.15);
  color: var(--green-dark);
  border-color: rgba(134,239,172,0.4);
}

.step-item.completed .step-label {
  color: #475569;
}

/* ─────────────────────────────────────────────
   PROGRESS BAR
───────────────────────────────────────────── */

.progress-fill {
  background: linear-gradient(to right, var(--sky), #a78bfa);
  height: 100%;
}

/* ─────────────────────────────────────────────
   STEP SECTIONS
───────────────────────────────────────────── */

.step-section { display: none; }
.step-section.active { display: block; }

/* ─────────────────────────────────────────────
   STEP BADGE
───────────────────────────────────────────── */

.step-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(56,189,248,0.1);
  color: var(--sky-dark);
  border: 1px solid rgba(56,189,248,0.25);
  text-transform: uppercase;
}

.step-badge--green {
  background: rgba(134,239,172,0.12);
  color: #16a34a;
  border-color: rgba(134,239,172,0.35);
}

/* ─────────────────────────────────────────────
   FIELD INPUT
───────────────────────────────────────────── */

.field-input {
  padding: 9px 14px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--dark);
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.field-input:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px var(--sky-glow);
}

.field-input::placeholder { color: #94a3b8; }

/* ─────────────────────────────────────────────
   CARDS GRID
───────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* ─────────────────────────────────────────────
   OPTION CARDS
───────────────────────────────────────────── */

.option-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}

.option-card:hover {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px var(--sky-glow), var(--shadow-sm);
  transform: translateY(-1px);
}

.option-card.recommended {
  background: var(--pink-bg);
  border-color: var(--pink);
}

.option-card.recommended:hover {
  border-color: var(--pink-dark);
  box-shadow: 0 0 0 3px rgba(236,72,153,0.1), var(--shadow-sm);
}

.option-card--warning {
  background: #fffbeb;
  border-color: var(--amber);
}

.option-card--warning:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.1), var(--shadow-sm);
}

.option-info { flex: 1; min-width: 0; }

.option-info h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.3;
}

.option-info p {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────
   BADGES
───────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 2px 8px;
  border-radius: 20px;
  color: #be185d;
  background: #fce7f3;
  border: 1px solid var(--pink);
  white-space: nowrap;
}

.badge--amber {
  color: #92400e;
  background: #fef3c7;
  border-color: var(--amber);
}

.badge--green {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}

/* ─────────────────────────────────────────────
   TOGGLE SWITCH
───────────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: background 0.25s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .slider { background: var(--sky); }
.toggle-switch input:checked + .slider::before { transform: translateX(20px); }

/* ─────────────────────────────────────────────
   INFO BOX
───────────────────────────────────────────── */

.info-box {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius);
  padding: 16px 20px;
}

.info-box h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--sky-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   SUBSECTION TITLE
───────────────────────────────────────────── */

.subsection-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94a3b8;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 14px;
}

/* ─────────────────────────────────────────────
   REVIEW SECTION
───────────────────────────────────────────── */

.review-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.review-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.review-card h4 {
  font-size: 10.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #374151;
  padding: 4px 0;
  border-bottom: 1px solid #f8fafc;
}

.review-item:last-child { border-bottom: none; }

.review-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #e2e8f0;
}

.review-dot.on { background: var(--green-dark); }

.review-empty {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  padding: 4px 0;
}

/* ─────────────────────────────────────────────
   CODE OUTPUT AREA (Paso 7)
───────────────────────────────────────────── */

.code-output-area {
  background: #0d0d1a;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Output tabs ── */
.output-tabs {
  display: flex;
  padding: 0 24px;
  background: #0a0a14;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  padding: 12px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font);
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover { color: #9ca3af; }

.tab-btn.active {
  color: var(--sky);
  border-bottom-color: var(--sky);
  font-weight: 600;
}

/* ── Output panels ── */
.output-panel { display: none; flex-direction: column; flex: 1; }
.output-panel.active { display: flex; }
.subpanel { display: none; flex-direction: column; flex: 1; }
.subpanel.active { display: flex; }

/* ── File sub-tabs ── */
.file-subtabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  background: #0a0a14;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.file-subtab {
  padding: 6px 16px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255,255,255,0.04);
  color: #4b5563;
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.file-subtab:hover {
  background: rgba(255,255,255,0.08);
  color: #9ca3af;
}

.file-subtab.active {
  background: var(--sky);
  color: var(--dark);
  border-color: var(--sky);
  font-weight: 700;
}

/* ── Code toolbar ── */
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: #111120;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.code-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #4b5563;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.copy-btn {
  padding: 5px 14px;
  background: rgba(255,255,255,0.05);
  color: #9ca3af;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s, color 0.2s;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
}

.copy-btn.copied {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.3);
  color: #4ade80;
}

/* ── Code wrapper ── */
.code-wrapper {
  flex: 1;
  overflow: auto;
  background: #1e1e1e;
  max-height: 520px;
}

.code-wrapper pre {
  margin: 0 !important;
  border-radius: 0 !important;
  background: #1e1e1e !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
  min-height: 100%;
  padding: 20px !important;
}

.code-wrapper pre code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace !important;
}

/* ─────────────────────────────────────────────
   INSTRUCTIONS BODY
───────────────────────────────────────────── */

.instructions-body {
  padding: 28px 32px;
  background: #0d0d1a;
  flex: 1;
  overflow-y: auto;
}

.instructions-body h3 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sky);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(56,189,248,0.15);
}

.instructions-body h3:first-child { margin-top: 0; }

.instructions-body p {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
  line-height: 1.7;
}

.instructions-body strong { color: #e2e8f0; font-weight: 600; }

.instructions-body a {
  color: var(--sky);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.instructions-body a:hover { color: #7dd3fc; }

.instructions-body code {
  background: rgba(251,207,232,0.12);
  color: var(--pink);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  border: 1px solid rgba(251,207,232,0.15);
}

.instructions-body pre {
  background: #1a1a2e !important;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px !important;
  padding: 14px 16px !important;
  font-size: 12px;
  color: #9ca3af;
  margin: 10px 0;
  overflow-x: auto;
}

.instructions-body ul, .instructions-body ol {
  padding-left: 20px;
  margin: 6px 0 10px;
}

.instructions-body li {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
  line-height: 1.6;
}

/* Instruction steps */
.instr-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.instr-step:last-child { border-bottom: none; }

.instr-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sky);
  color: var(--dark);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.instr-text {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.7;
  flex: 1;
}

.instr-text strong { color: #e2e8f0; }

.instr-text code {
  background: rgba(251,207,232,0.12);
  color: var(--pink);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.warning-box {
  background: rgba(253,230,138,0.08);
  border: 1px solid rgba(253,230,138,0.2);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: #fbbf24;
  line-height: 1.65;
  margin: 10px 0;
}

.warning-box strong { color: #fcd34d; }

/* ─────────────────────────────────────────────
   NAV BAR
───────────────────────────────────────────── */

.nav-bar {
  background: white;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}

.btn {
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.btn-primary {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}

.btn-primary:hover {
  background: var(--dark-2);
  border-color: var(--dark-2);
  box-shadow: 0 4px 14px rgba(15,23,42,0.25);
  transform: translateY(-1px);
}

.btn-generate {
  background: linear-gradient(135deg, var(--sky) 0%, #a78bfa 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(56,189,248,0.35);
}

.btn-generate:hover {
  box-shadow: 0 4px 18px rgba(56,189,248,0.5);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #374151;
}

/* ─────────────────────────────────────────────
   TOOLTIP POPOVER
───────────────────────────────────────────── */

.option-card { position: relative; }

.tooltip-hint {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 15px;
  height: 15px;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  color: var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
}

.option-card:hover .tooltip-hint { opacity: 1; }

.tooltip-popover {
  position: fixed;
  z-index: 9999;
  width: 296px;
  background: var(--dark-2);
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(56,189,248,0.06);
  pointer-events: none;
}

.tt-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sky);
  margin-bottom: 6px;
  line-height: 1.3;
}

.tt-desc {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.55;
  margin-bottom: 10px;
}

.tt-example {
  font-size: 10.5px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: #64748b;
  background: rgba(0,0,0,0.35);
  border-left: 2px solid rgba(56,189,248,0.4);
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
  margin: 0;
  white-space: pre;
  overflow: hidden;
  line-height: 1.5;
  display: block;
  max-height: 160px;
}

/* ─────────────────────────────────────────────
   PROJECT STATE CARDS (Paso 1)
───────────────────────────────────────────── */

.project-state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .project-state-grid { grid-template-columns: 1fr; }
}

.project-state-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.project-state-card:hover {
  border-color: var(--sky);
  background: rgba(56,189,248,0.03);
}

.project-state-card.is-selected {
  border-color: var(--sky);
  background: rgba(56,189,248,0.06);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
}

.project-state-card .state-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.project-state-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 5px;
  line-height: 1.3;
}

.project-state-card.is-selected h3 { color: var(--sky-dark); }

.project-state-card p {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.5;
}

.project-state-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-state-card li {
  font-size: 10.5px;
  color: #94a3b8;
  padding: 1px 0;
  line-height: 1.6;
}

.project-state-card li::before {
  content: "✓ ";
  color: var(--green-dark);
  font-weight: 700;
}
