/* ═══════════════════════════════════════════════════
   GuíaDesk · guia-style.css
   Standalone page — reutiliza variables de style.css
═══════════════════════════════════════════════════ */

html.guia-body, body.guia-body { height: 100%; overflow: hidden; }

/* ──────────────────────────────────────────────────
   TOP BAR
────────────────────────────────────────────────── */
.gd-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 100;
}

.gd-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gd-topbar-brand {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text);
  letter-spacing: .01em;
}

.gd-topbar-sep  { color: var(--text-muted); font-size: 12px; }
.gd-topbar-sub  { font-size: 11px; color: var(--text-muted); }

.gd-topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.gd-topbar-link {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: background .14s, color .14s;
}
.gd-topbar-link:hover { background: var(--surface2); color: var(--text); }
.gd-topbar-active {
  background: var(--muz-dim);
  color: var(--muz) !important;
  border: 1px solid var(--muz-border);
}

.gd-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.gd-svc-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.gd-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.gd-dot-off  { background: var(--border2); }
.gd-dot-on   { background: var(--green); box-shadow: 0 0 4px var(--green); }
.gd-dot-warn { background: var(--amber); }

.gd-topbar-logout {
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .14s, color .14s;
}
.gd-topbar-logout:hover { border-color: var(--red); color: var(--red); }

/* ──────────────────────────────────────────────────
   MAIN LAYOUT
────────────────────────────────────────────────── */
.gd-layout {
  display: grid;
  grid-template-columns: 40% 60%;
  height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
  overflow: hidden;
}

/* ──────────────────────────────────────────────────
   FORM COLUMN — izquierda (dark, consistente con panel)
────────────────────────────────────────────────── */
.gd-form-col {
  overflow-y: auto;
  padding: 16px 14px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg2);
}

/* ── Card ── */
.gd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* No overflow:hidden — usamos border-radius en head/foot para clips */
}

.gd-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.gd-step-badge {
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--muz);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gd-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .02em;
  flex: 1;
}

.gd-card-head-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: .05em;
}

/* ── Card body — separación correcta, sin overflow hidden ── */
.gd-card-body {
  padding: 13px 13px 16px; /* bottom generoso para que el último campo respire */
}

/* El último .field dentro del card body no necesita margin-bottom extra */
.gd-card-body .field:last-child { margin-bottom: 0; }
.gd-card-body .field-row:last-child { margin-bottom: 0; }
.gd-card-body .field-row:last-child .field { margin-bottom: 0; }

/* ── Sections (section 2) ── */
.gd-sections-body {
  padding: 0 0 4px; /* 4px bottom padding para que el borde del card respire */
}

.gd-sec-row {
  border-bottom: 1px solid var(--border);
}
.gd-sec-row:last-child { border-bottom: none; }

/* Filas colapsadas (sin checkbox activo) — fondo más opaco para diferenciar */
.gd-sec-row:has(.gd-chk:not(:checked)) { background: var(--bg2); }

.gd-sec-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.gd-sec-toggle:hover { background: rgba(255,255,255,.03); }

.gd-sec-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gd-chk {
  width: 14px; height: 14px;
  accent-color: var(--muz);
  cursor: pointer;
  flex-shrink: 0;
}

/* Nombre de sección desactivada */
.gd-sec-row:has(.gd-chk:not(:checked)) .gd-sec-name {
  color: var(--text-muted);
}

.gd-sec-name {
  font-size: 12px;
  color: var(--text);
}

.gd-chevron { font-size: 10px; color: var(--text-muted); }
.gd-chevron-closed { opacity: .5; }

.gd-sec-content  { padding: 0 13px 12px; }
.gd-sec-hidden   { display: none; }

/* ── Textarea ── */
.gd-ta {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  padding: 8px 10px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .14s;
}
.gd-ta:focus { border-color: var(--muz); }
.gd-ta::placeholder { color: var(--text-muted); }
.gd-ta-lg { min-height: 110px; }

.gd-ta-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.gd-ta-hint code {
  background: var(--surface2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  color: var(--nad);
}

/* ── Template ── */
.gd-template-area { display: flex; flex-direction: column; gap: 10px; }

.gd-template-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.gd-template-icon { font-size: 16px; flex-shrink: 0; }
.gd-template-msg  { font-size: 11px; color: var(--text-muted); }
.gd-template-ok   { color: var(--green) !important; }

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

.gd-file-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color .14s;
  font-size: 12px;
  color: var(--text);
}
.gd-file-label:hover { border-color: var(--muz); }
.gd-file-types { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

input[type="file"]#gd-template-file { display: none; }

.gd-btn-secondary {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .14s, color .14s;
  font-family: var(--font-sans);
}
.gd-btn-secondary:hover:not(:disabled) { border-color: var(--muz); color: var(--muz); }
.gd-btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Generate card ── */
.gd-card-generate { background: transparent; border: none; }
.gd-card-generate .btn-main { font-size: 14px; min-height: 44px; border-radius: var(--radius); }

/* ═══════════════════════════════════════════════════
   PREVIEW COLUMN — derecha (tema CLARO para revisión)
═══════════════════════════════════════════════════ */

/* Variables locales del tema claro */
.gd-preview-col {
  --pr-bg:         #eef0f6;
  --pr-surface:    #ffffff;
  --pr-border:     #d4d8e8;
  --pr-text:       #1a1d2e;
  --pr-text-dim:   #4a5070;
  --pr-text-muted: #8890a8;
  --pr-navy:       #1B3068;
  --pr-gold:       #9a6e20;
  --pr-gold-bg:    #fdf6ea;
  --pr-gold-border:#d4a96a;
  --pr-blue:       #2a5fa0;
  --pr-blue-bg:    #edf3fb;
  --pr-blue-border:#9ab8de;

  overflow-y: auto;
  background: var(--pr-bg);
  display: flex;
  flex-direction: column;
}

/* ── Empty state ── */
.gd-preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}
.gd-empty-icon  { font-size: 44px; opacity: .3; }
.gd-empty-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--pr-text-dim, var(--text-dim));
}
.gd-empty-sub   { font-size: 12px; color: var(--pr-text-muted, var(--text-muted)); line-height: 1.8; }

/* ── Preview wrapper ── */
.gd-preview-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Preview header — documento ── */
.gd-preview-header {
  background: var(--pr-navy);
  padding: 22px 26px 18px;
  border-bottom: 3px solid var(--pr-gold-border);
}

.gd-ph-title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: #ffffff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.gd-ph-sub {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin-bottom: 10px;
  font-style: italic;
}

.gd-ph-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.gd-ph-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.6);
  letter-spacing: .04em;
  background: rgba(255,255,255,.08);
}
.gd-ph-tag-code {
  background: rgba(212,169,106,.18);
  border-color: rgba(212,169,106,.45);
  color: #d4a96a;
}
.gd-ph-tag-cat {
  background: rgba(91,156,246,.15);
  border-color: rgba(91,156,246,.35);
  color: #90b8f8;
}

/* ── Preview sections ── */
.gd-preview-sections {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--pr-bg);
}

.gd-ps-block {
  background: var(--pr-surface);
  border: 1px solid var(--pr-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(26,29,46,.06);
}

.gd-ps-head {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #ffffff;
  padding: 7px 13px;
  background: var(--pr-navy);
  border-bottom: 2px solid var(--pr-gold-border);
}

/* ── Textarea editable en preview ── */
.gd-ps-ta {
  width: 100%;
  min-height: 80px;
  background: var(--pr-surface);
  border: none;
  border-radius: 0;
  color: var(--pr-text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  padding: 14px 16px;
  box-sizing: border-box;
  outline: none;
  resize: vertical;
}
.gd-ps-ta:focus {
  background: #f7f8fc;
  box-shadow: inset 0 0 0 2px rgba(27,48,104,.12);
}

/* ── Preview actions ── */
.gd-preview-actions {
  padding: 14px 24px;
  border-top: 1px solid var(--pr-border);
  display: flex;
  gap: 10px;
  background: var(--pr-surface);
  box-shadow: 0 -2px 8px rgba(26,29,46,.06);
  position: sticky;
  bottom: 0;
}

.gd-preview-actions .btn-main {
  flex: 1;
  background: var(--pr-navy);
  color: #ffffff;
}
.gd-preview-actions .btn-main:hover { filter: brightness(1.15); }

.gd-btn-download {
  background: #1a8a4a !important;
  color: #ffffff !important;
}

/* ──────────────────────────────────────────────────
   TOAST
────────────────────────────────────────────────── */
.gd-toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.gd-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border2);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: gdToastIn .2s ease;
  max-width: 320px;
  pointer-events: none;
}
.gd-toast-success { border-color: var(--green); color: var(--green); }
.gd-toast-error   { border-color: var(--red);   color: var(--red);   }
.gd-toast-warn    { border-color: var(--amber);  color: var(--amber); }

@keyframes gdToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .gd-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  html.guia-body, body.guia-body { overflow-y: auto !important; height: auto !important; }
  .gd-form-col     { border-right: none; border-bottom: 1px solid var(--border); max-height: none; overflow: visible; }
  .gd-preview-col  { min-height: 60vh; }
  .gd-preview-actions { position: static; }
}

@media (max-width: 600px) {
  .gd-topbar-sub, .gd-topbar-sep { display: none; }
  .gd-template-row { flex-direction: column; }
  .gd-preview-actions { flex-direction: column; }
  .gd-preview-header { padding: 16px; }
  .gd-preview-sections { padding: 14px 16px; }
}
