/* ════════════════════════════════════════════════════════════════════
   admin_panel.css — sistema de diseño "PatagoniaWeb Admin"
   Aplicado SOLO a las pantallas /gestion/mi-negocio/* (config del sitio
   web público). NO afecta el resto del sistema de gestión.

   Tokens basados en handoff Claude Design (g707USUkZplhB38BKCTaZA).
   Light + dark via [data-theme="dark"] (ya manejado en layouts/base.html).
   ════════════════════════════════════════════════════════════════════ */

:root {
  --ap-bg: #F4F6FB;
  --ap-card: #ffffff;
  --ap-border: rgba(0, 0, 0, .08);
  --ap-border-2: rgba(0, 0, 0, .05);
  --ap-text: #1A2233;
  --ap-muted: #64748B;
  --ap-muted-2: #94A3B8;
  --ap-input: #ffffff;
  --ap-input-2: #F8F9FC;
  --ap-hover: #F4F6FB;
  --ap-brand: #5B6EF7;
  --ap-brand-d: #4558E8;
  --ap-brand-s: #818CF8;
  --ap-brand-bg: rgba(91, 110, 247, .09);
  --ap-success: #10B981;
  --ap-warn: #F59E0B;
  --ap-danger: #EF4444;
  --ap-accent: #F97316;
  --ap-sh: 0 1px 3px rgba(0, 0, 0, .07), 0 4px 12px rgba(0, 0, 0, .05);
  --ap-sh-lg: 0 8px 32px rgba(0, 0, 0, .1);
  --ap-radius: 16px;
  --ap-radius-sm: 10px;
  --ap-radius-pill: 9999px;
  --ap-font: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --ap-bg: #0C1019;
  --ap-card: #111827;
  --ap-border: rgba(255, 255, 255, .07);
  --ap-border-2: rgba(255, 255, 255, .04);
  --ap-text: #F0F2F8;
  --ap-muted: #8893A8;
  --ap-muted-2: #374151;
  --ap-input: #1A2236;
  --ap-input-2: #111827;
  --ap-hover: rgba(255, 255, 255, .04);
  --ap-brand: #6B7FF8;
  --ap-brand-d: #5B6EF7;
  --ap-brand-s: #A5B4FC;
  --ap-brand-bg: rgba(107, 127, 248, .1);
  --ap-success: #34D399;
  --ap-warn: #FCD34D;
  --ap-danger: #FCA5A5;
  --ap-accent: #FB923C;
  --ap-sh: 0 1px 3px rgba(0, 0, 0, .25), 0 4px 12px rgba(0, 0, 0, .18);
  --ap-sh-lg: 0 8px 32px rgba(0, 0, 0, .4);
}

/* Container raíz cuando se aplica el panel */
.ap-shell {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ap-text);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1200px;
}

.ap-shell *,
.ap-shell *::before,
.ap-shell *::after {
  box-sizing: border-box;
}

/* ── primitives ─────────────────────────────────────────────────────── */

.ap-card {
  background: var(--ap-card);
  border-radius: var(--ap-radius);
  border: 1px solid var(--ap-border);
  padding: 20px;
  box-shadow: var(--ap-sh);
}

.ap-card + .ap-card {
  margin-top: 0;
}

.ap-section-head {
  margin-bottom: 18px;
}

.ap-section-head h2 {
  font-family: var(--ap-font);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ap-text);
  margin: 0;
}

.ap-section-head p {
  font-size: .76rem;
  color: var(--ap-muted);
  margin: 3px 0 0 0;
}

.ap-label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  color: var(--ap-muted);
  margin-bottom: 5px;
}

.ap-hint {
  font-size: .7rem;
  color: var(--ap-muted-2);
  margin-top: 4px;
}

.ap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ap-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.ap-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.ap-span2 {
  grid-column: span 2;
}

.ap-input,
.ap-textarea,
.ap-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--ap-radius-sm);
  border: 1.5px solid var(--ap-border);
  background: var(--ap-input);
  color: var(--ap-text);
  font-size: .84rem;
  font-family: inherit;
  outline: none;
  transition: border-color .18s;
}

.ap-input.ap-mono,
.ap-textarea.ap-mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.ap-input:focus,
.ap-textarea:focus,
.ap-select:focus {
  border-color: var(--ap-brand);
}

.ap-input:disabled,
.ap-textarea:disabled {
  background: var(--ap-input-2);
  cursor: not-allowed;
}

.ap-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── toggle (checkbox styled) ───────────────────────────────────────── */

.ap-toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--ap-border);
}

.ap-toggle-row:last-child,
.ap-toggle-row.ap-last {
  border-bottom: none;
}

.ap-toggle-row > .ap-toggle-text {
  flex: 1;
}

.ap-toggle-row .ap-toggle-text strong {
  font-weight: 600;
  font-size: .88rem;
  color: var(--ap-text);
  display: block;
}

.ap-toggle-row .ap-toggle-text small {
  font-size: .74rem;
  color: var(--ap-muted);
  margin-top: 2px;
  display: block;
}

.ap-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

.ap-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-toggle .ap-track {
  position: absolute;
  inset: 0;
  background: rgba(148, 163, 184, .35);
  border-radius: var(--ap-radius-pill);
  cursor: pointer;
  transition: background .2s;
}

.ap-toggle .ap-track::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.ap-toggle input:checked + .ap-track {
  background: var(--ap-brand);
}

.ap-toggle input:checked + .ap-track::before {
  left: 22px;
}

/* ── buttons ────────────────────────────────────────────────────────── */

.ap-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--ap-radius-sm);
  font-weight: 600;
  font-size: .84rem;
  cursor: pointer;
  font-family: inherit;
  border: 1.5px solid transparent;
  transition: opacity .15s, transform .05s;
  text-decoration: none;
  line-height: 1;
}

.ap-btn:hover {
  opacity: .88;
}

.ap-btn:active {
  transform: translateY(1px);
}

.ap-btn-primary {
  background: var(--ap-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91, 110, 247, .3);
}

.ap-btn-secondary {
  background: var(--ap-hover);
  color: var(--ap-text);
  border-color: var(--ap-border);
}

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

.ap-btn-accent {
  background: var(--ap-accent);
  color: #fff;
}

.ap-btn-lg {
  padding: 11px 22px;
  font-size: .9rem;
}

.ap-btn-sm {
  padding: 5px 11px;
  font-size: .76rem;
}

.ap-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.ap-saved {
  font-size: .8rem;
  color: var(--ap-success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: opacity .25s;
}

.ap-saved.ap-show {
  opacity: 1;
}

/* ── banner / status pill ───────────────────────────────────────────── */

.ap-banner {
  padding: 16px 20px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--ap-border);
}

.ap-banner.ap-banner-success {
  background: rgba(16, 185, 129, .08);
  border-color: rgba(16, 185, 129, .2);
}

.ap-banner.ap-banner-warn {
  background: rgba(245, 158, 11, .08);
  border-color: rgba(245, 158, 11, .2);
}

.ap-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ap-banner-success .ap-banner-icon {
  background: rgba(16, 185, 129, .15);
  color: var(--ap-success);
}

.ap-banner-warn .ap-banner-icon {
  background: rgba(245, 158, 11, .15);
  color: var(--ap-warn);
}

.ap-banner-body {
  flex: 1;
  min-width: 0;
}

.ap-banner-title {
  font-weight: 700;
  font-size: .92rem;
  color: var(--ap-text);
  margin-bottom: 2px;
}

.ap-banner-sub {
  font-size: .8rem;
  color: var(--ap-brand);
  font-weight: 500;
  word-break: break-all;
}

.ap-pill {
  padding: 3px 10px;
  border-radius: var(--ap-radius-pill);
  font-size: .72rem;
  font-weight: 700;
  display: inline-block;
}

.ap-pill-success {
  background: rgba(16, 185, 129, .12);
  color: var(--ap-success);
}

.ap-pill-warn {
  background: rgba(245, 158, 11, .12);
  color: var(--ap-warn);
}

.ap-pill-brand {
  background: var(--ap-brand-bg);
  color: var(--ap-brand);
}

/* ── quick-link button (dashboard cards) ────────────────────────────── */

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

.ap-quick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--ap-border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all .18s;
  text-decoration: none;
  color: inherit;
}

.ap-quick:hover {
  border-color: var(--ap-brand);
  background: var(--ap-brand-bg);
}

.ap-quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--ap-brand-bg);
  display: grid;
  place-items: center;
  color: var(--ap-brand);
  flex-shrink: 0;
  font-size: 1rem;
}

.ap-quick-label {
  font-weight: 600;
  font-size: .86rem;
  color: var(--ap-text);
}

.ap-quick-sub {
  font-size: .73rem;
  color: var(--ap-muted);
  margin-top: 1px;
}

/* ── color picker ───────────────────────────────────────────────────── */

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

.ap-color-row input[type="color"] {
  width: 40px;
  height: 36px;
  border: 1.5px solid var(--ap-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  background: none;
}

.ap-color-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1.5px solid var(--ap-border);
  background: var(--ap-input);
  color: var(--ap-text);
  font-size: .82rem;
  font-family: ui-monospace, monospace;
  outline: none;
}

.ap-color-row input[type="text"]:focus {
  border-color: var(--ap-brand);
}

/* ── preset chips ───────────────────────────────────────────────────── */

.ap-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-preset {
  padding: 7px 12px;
  border-radius: 10px;
  border: 2px solid var(--ap-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  transition: all .18s;
}

.ap-preset.active,
.ap-preset:hover {
  border-color: var(--ap-brand);
  background: var(--ap-brand-bg);
}

.ap-preset-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ap-preset-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--ap-text);
}

/* ── info-box ───────────────────────────────────────────────────────── */

.ap-info-grid {
  display: grid;
  gap: 11px;
}

.ap-info {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--ap-hover);
  border: 1px solid var(--ap-border);
}

.ap-info-label {
  font-size: .7rem;
  color: var(--ap-muted);
  margin-bottom: 3px;
}

.ap-info-value {
  font-weight: 600;
  font-size: .88rem;
  color: var(--ap-text);
  word-break: break-all;
}

.ap-info-value.ap-mono {
  font-size: .76rem;
  font-family: ui-monospace, monospace;
}

.ap-info-value.ap-ok {
  color: var(--ap-success);
}

/* ── live preview (theme page) ──────────────────────────────────────── */

.ap-preview-wrap {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 16px;
  align-items: start;
}

.ap-preview-card {
  position: sticky;
  top: 80px;
}

.ap-preview-frame {
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--ap-border);
  background: #08080f;
  padding: 14px;
}

.ap-preview-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, .07);
  border-radius: 7px;
  margin-bottom: 10px;
}

.ap-preview-hero {
  padding: 14px 12px;
  border-radius: 7px;
  margin-bottom: 9px;
}

.ap-preview-card-mini {
  background: rgba(255, 255, 255, .05);
  padding: 7px;
}

/* ── code block (variables disponibles, schema) ─────────────────────── */

.ap-code {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--ap-hover);
  border: 1px solid var(--ap-border);
  font-family: ui-monospace, monospace;
  font-size: .71rem;
  color: var(--ap-muted);
  line-height: 1.7;
}

.ap-code strong {
  color: var(--ap-text);
  display: block;
  margin-bottom: 4px;
}

.ap-code .ap-var {
  color: var(--ap-brand);
}

.ap-code .ap-var-accent {
  color: var(--ap-accent);
}

/* ── schema table list ──────────────────────────────────────────────── */

.ap-schema-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--ap-border);
}

.ap-schema-row:last-child {
  border-bottom: none;
}

.ap-schema-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

.ap-schema-name {
  font-size: .76rem;
  font-family: ui-monospace, monospace;
  color: var(--ap-brand);
  font-weight: 700;
}

.ap-schema-cols {
  font-size: .72rem;
  color: var(--ap-muted-2);
  font-family: ui-monospace, monospace;
  line-height: 1.8;
}

/* ── header gradient (assistant page) ──────────────────────────────── */

.ap-hero {
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--ap-brand), var(--ap-brand-d));
  color: #fff;
  display: flex;
  gap: 14px;
  align-items: center;
}

.ap-hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ap-hero h3 {
  font-family: var(--ap-font);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 3px;
}

.ap-hero p {
  font-size: .8rem;
  opacity: .88;
  line-height: 1.5;
  margin: 0;
}

/* ── note (callout) ─────────────────────────────────────────────────── */

.ap-note {
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--ap-hover);
  border: 1px solid var(--ap-border);
  font-size: .8rem;
  color: var(--ap-muted);
  line-height: 1.6;
}

.ap-note strong {
  color: var(--ap-text);
}

/* ── responsive ─────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .ap-grid,
  .ap-grid-3,
  .ap-grid-4 {
    grid-template-columns: 1fr;
  }

  .ap-span2 {
    grid-column: auto;
  }

  .ap-preview-wrap {
    grid-template-columns: 1fr;
  }

  .ap-preview-card {
    position: static;
  }

  .ap-info-grid.ap-grid-4,
  .ap-info-grid.ap-grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .ap-info-grid.ap-grid-4,
  .ap-info-grid.ap-grid-3 {
    grid-template-columns: 1fr;
  }

  .ap-card {
    padding: 16px;
  }

  .ap-quick-grid {
    grid-template-columns: 1fr;
  }
}

/* range slider (assistant temperature) */
.ap-range {
  width: 100%;
  accent-color: var(--ap-brand);
  cursor: pointer;
  margin-top: 6px;
}

.ap-range-foot {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--ap-muted-2);
  margin-top: 2px;
}
