/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f1f5f9; color: #1e293b; font-size: 0.9rem; line-height: 1.5;
}

/* ── Password overlay ─────────────────────────────────────────────────── */
.pw-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 100%);
  display: flex; align-items: center; justify-content: center;
}
.pw-box {
  background: #fff; border-radius: 20px;
  padding: 48px 40px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.pw-logo { font-size: 2.8rem; margin-bottom: 4px; }
.pw-box h1 {
  font-size: 1.5rem; font-weight: 700; color: #0c4a6e;
  font-family: 'Playfair Display', Georgia, serif; margin-bottom: 4px;
}
.pw-box .pw-subtitle { color: #64748b; font-size: 0.82rem; margin-bottom: 8px; }
.pw-client {
  display: inline-block; background: #f0f9ff; border: 1px solid #bae6fd;
  color: #0369a1; padding: 3px 12px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; margin-bottom: 24px;
}
.pw-box input[type="password"] {
  width: 100%; padding: 12px 16px; border: 1.5px solid #e2e8f0;
  border-radius: 10px; font-size: 1rem; font-family: inherit;
  outline: none; transition: border-color .2s; margin-bottom: 12px;
  text-align: center; letter-spacing: .2em;
}
.pw-box input[type="password"]:focus { border-color: #0369a1; }
.pw-error { color: #dc2626; font-size: 0.82rem; margin-bottom: 12px; min-height: 20px; }
.pw-btn {
  width: 100%; padding: 12px; background: #0c4a6e; color: #fff;
  border: none; border-radius: 10px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.pw-btn:hover { background: #0369a1; }

/* ── Admin layout ─────────────────────────────────────────────────────── */
.admin-wrap { display: flex; flex-direction: column; min-height: 100vh; }

.admin-header {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: #0c4a6e;
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.admin-header-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem; color: #fff; font-weight: 700; margin-right: 4px;
}
.admin-header-client {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  color: #bfdbfe; border-radius: 20px; padding: 3px 12px;
  font-size: 0.78rem; font-weight: 600;
}
.admin-header-spacer { flex: 1; }
.btn-preview {
  padding: 8px 16px; background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
  font-size: 0.82rem; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s;
}
.btn-preview:hover { background: rgba(255,255,255,.2); }
.btn-save-top {
  padding: 8px 20px; background: #f97316; color: #fff;
  border: none; border-radius: 8px; font-size: 0.88rem;
  font-weight: 600; cursor: pointer; transition: filter .2s;
}
.btn-save-top:hover { filter: brightness(1.1); }
.btn-save-top:disabled { opacity: .6; cursor: not-allowed; }

.admin-body { display: flex; flex: 1; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.admin-sidebar {
  width: 200px; flex-shrink: 0; background: #fff;
  border-right: 1px solid #e2e8f0; padding: 16px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.admin-tab {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: none; background: none; font-size: 0.85rem;
  font-family: inherit; color: #475569; cursor: pointer;
  text-align: left; transition: background .15s, color .15s;
}
.admin-tab:hover { background: #f1f5f9; color: #0c4a6e; }
.admin-tab.active { background: #eff6ff; color: #0c4a6e; font-weight: 600; }

/* ── Main content ─────────────────────────────────────────────────────── */
.admin-main { flex: 1; padding: 24px; overflow-y: auto; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Section title ───────────────────────────────────────────────────── */
.section-title {
  font-size: 1.1rem; font-weight: 700; color: #0c4a6e;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.admin-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e2e8f0; padding: 20px;
  margin-bottom: 16px;
}
.admin-card-title {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: #64748b; margin-bottom: 16px;
}

/* ── Form elements ────────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group:last-child { margin-bottom: 0; }

label {
  font-size: 0.78rem; font-weight: 600; color: #475569;
  text-transform: uppercase; letter-spacing: .05em;
}
input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="color"],
select,
textarea {
  padding: 9px 12px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 0.88rem; font-family: inherit;
  outline: none; transition: border-color .2s; width: 100%;
  background: #fff; color: #1e293b;
}
input:focus, select:focus, textarea:focus { border-color: #0369a1; }
textarea { resize: vertical; min-height: 72px; }

input[type="color"] {
  padding: 4px 6px; height: 40px; cursor: pointer; border-radius: 8px;
}

/* ── Toggle ──────────────────────────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
}
.toggle-row label { text-transform: none; letter-spacing: 0; font-size: 0.88rem; font-weight: 500; color: #1e293b; }
.toggle {
  width: 44px; height: 24px; background: #cbd5e1;
  border-radius: 12px; position: relative; cursor: pointer;
  transition: background .2s; flex-shrink: 0; border: none; appearance: none;
}
.toggle:checked { background: #0369a1; }
.toggle::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle:checked::after { left: 23px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: none; transition: filter .2s; font-family: inherit; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: #0c4a6e; color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-accent    { background: #f97316; color: #fff; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-danger    { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* ── Hero preview ────────────────────────────────────────────────────── */
.hero-preview-box {
  width: 100%; height: 160px; border-radius: 12px;
  background: #e2e8f0 center/cover no-repeat;
  border: 2px dashed #cbd5e1; display: none;
  align-items: center; justify-content: center;
  color: #94a3b8; font-size: 0.85rem; margin-bottom: 12px;
}
.hero-preview-box.visible { display: flex; }

/* ── Categorías list ─────────────────────────────────────────────────── */
.cat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cat-row {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 8px 10px;
}
.cat-emoji { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.cat-nombre { flex: 2; }
.cat-id { flex: 1.5; font-size: 0.78rem; color: #64748b; }
.cat-emoji-in { width: 52px; text-align: center; font-size: 1rem; }
.cat-row button {
  padding: 4px 8px; border-radius: 6px; border: 1px solid #e2e8f0;
  background: #fff; cursor: pointer; font-size: 0.8rem; color: #475569;
  flex-shrink: 0;
}
.cat-row button:hover { background: #f1f5f9; }
.cat-row button:disabled { opacity: .35; cursor: not-allowed; }
.btn-del-cat { background: #fee2e2 !important; color: #dc2626 !important; border-color: #fecaca !important; }
.btn-del-cat:hover { background: #fecaca !important; }

.add-cat-row { display: flex; gap: 8px; align-items: center; }
.add-cat-row input { flex: 1; }

/* ── Productos list ──────────────────────────────────────────────────── */
.prod-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.prod-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 10px 14px;
}
.prod-emoji { font-size: 1.6rem; flex-shrink: 0; }
.prod-info { flex: 1; min-width: 0; }
.prod-info strong { display: block; font-size: 0.9rem; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-info small { color: #64748b; font-size: 0.78rem; }
.prod-actions { display: flex; gap: 6px; flex-shrink: 0; }
.prod-actions button {
  padding: 5px 10px; border-radius: 6px; border: 1px solid #e2e8f0;
  background: #f8fafc; cursor: pointer; font-size: 0.78rem;
  font-family: inherit; color: #475569; transition: background .15s;
}
.prod-actions button:hover { background: #e2e8f0; }
.prod-actions .btn-del { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.prod-actions .btn-del:hover { background: #fecaca; }
.empty-list { color: #94a3b8; font-size: 0.85rem; text-align: center; padding: 24px 0; }

/* ── About cards list ────────────────────────────────────────────────── */
.about-card-row {
  display: grid; grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto; gap: 8px;
  align-items: start; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
}
.ac-icon { grid-row: 1 / 3; text-align: center; font-size: 1.5rem; padding-top: 4px; }
.ac-titulo { }
.ac-texto { resize: vertical; min-height: 56px; }

/* ── QR / Compartir ──────────────────────────────────────────────────── */
.qr-box {
  text-align: center; padding: 32px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 16px; border: 1px solid #bae6fd; margin-bottom: 20px;
}
#qr-container { display: inline-block; margin: 16px 0; }
#qr-container canvas, #qr-container img { border-radius: 8px; }
.qr-url {
  display: inline-block; background: #fff; border: 1px solid #bae6fd;
  padding: 8px 16px; border-radius: 8px;
  font-size: 0.82rem; color: #0369a1; word-break: break-all;
  margin-bottom: 12px; text-decoration: none;
}
.qr-url:hover { background: #f0f9ff; }
.qr-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.share-instructions {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 20px;
}
.share-instructions h3 { font-size: 0.9rem; margin-bottom: 12px; color: #0c4a6e; }
.share-instructions ol { padding-left: 18px; }
.share-instructions li { margin-bottom: 6px; font-size: 0.85rem; color: #475569; }
.share-instructions strong { color: #1e293b; }

/* ── Gradient picker ──────────────────────────────────────────────────── */
.grad-palette {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.grad-opt {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid transparent;
  cursor: pointer; transition: border-color .15s, transform .1s;
}
.grad-opt:hover { transform: scale(1.1); }
.grad-opt.active { border-color: #0c4a6e; }

/* ── Emoji picker ────────────────────────────────────────────────────── */
.emoji-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.emoji-opt {
  width: 36px; height: 36px; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1.5px solid #e2e8f0;
  background: #fff; cursor: pointer; transition: background .15s;
}
.emoji-opt:hover { background: #f1f5f9; }
.emoji-preview { font-size: 2.5rem; text-align: center; margin-bottom: 8px; }

/* ── Product modal ────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5); align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 16px; width: 100%;
  max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; position: sticky; top: 0; background: #fff;
  z-index: 2; padding-bottom: 16px; border-bottom: 1px solid #e2e8f0;
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; color: #0c4a6e; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: #f1f5f9; color: #475569;
  font-size: 1.2rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background .15s;
}
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end; gap: 8px;
}
.alert-error {
  background: #fee2e2; border: 1px solid #fecaca; color: #dc2626;
  border-radius: 8px; padding: 8px 12px; font-size: 0.82rem;
  margin-bottom: 12px; display: none;
}
.alert-error.show { display: block; }

/* Img preview in modal */
.mp-img-preview { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; margin-top: 8px; display: none; }

/* ── Color accent preview ─────────────────────────────────────────────── */
.color-preview {
  width: 100%; height: 40px; border-radius: 8px;
  margin-top: 8px; transition: background .2s;
}

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #0c4a6e; color: #fff; padding: 12px 24px;
  border-radius: 50px; font-size: 0.88rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 500;
  transition: transform .3s; white-space: nowrap; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #dc2626; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%; flex-direction: row; overflow-x: auto;
    border-right: none; border-bottom: 1px solid #e2e8f0;
    padding: 8px; gap: 4px; flex-shrink: 0;
  }
  .admin-tab { white-space: nowrap; padding: 8px 12px; }
  .admin-body { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.triple { grid-template-columns: 1fr; }
  .admin-header { gap: 8px; }
  .admin-header-logo { display: none; }
}
@media (max-width: 480px) {
  .admin-main { padding: 16px; }
  .modal-box { border-radius: 12px; }
  .cat-id { display: none; }
}
