/* ============================================================
   css/admin.css — Aspecto del panel de administración
   Solo cambia cómo se ve: todo va dentro de #dash-admin
   (y las ventanas emergentes del administrador).
   ============================================================ */

#dash-admin {
  --adm-card-bd: #e2ecf2;
  --adm-soft:    #f6fafc;
  --adm-shadow:  0 1px 2px rgba(20,32,74,.04), 0 6px 20px rgba(20,32,74,.06);
  --adm-radius:  16px;
}

/* ── Cabecera ───────────────────────────────────────────────── */
#dash-admin .adm-head { margin-bottom: 18px; }
#dash-admin .adm-head .dash-title { font-size: 26px; letter-spacing: -.01em; }

/* ── Menú agrupado ──────────────────────────────────────────── */
#dash-admin .adm-nav {
  display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: stretch;
  background: #fff; border: 1px solid var(--adm-card-bd); border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow); padding: 12px 14px; margin-bottom: 22px;
}
#dash-admin .adm-group { display: flex; flex-direction: column; gap: 6px; }
#dash-admin .adm-group-lbl {
  font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #8a9bb0; padding-left: 4px;
}
#dash-admin .adm-group-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
#dash-admin .adm-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px;
  border: 1px solid transparent; border-radius: 10px; background: var(--adm-soft);
  color: #33415c; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
#dash-admin .adm-tab:hover { background: #e9f5f7; color: var(--accent); border-color: #c9e7ec; }
#dash-admin .adm-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#dash-admin .adm-tab.on {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(14,135,148,.28);
}
#dash-admin .adm-tab-ico { font-size: 15px; line-height: 1; }
#dash-admin .adm-badge,
#dash-admin .adm-tab .msg-badge {
  display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: #dc2626 !important; color: #fff; font-size: 11px; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
#dash-admin .adm-tab.on .adm-badge,
#dash-admin .adm-tab.on .msg-badge { box-shadow: 0 0 0 2px var(--accent); }

/* Escritorio: cada sección como un mosaico (icono arriba y nombre debajo) para que quepan todas en una fila */
@media (min-width: 901px) {
  #dash-admin .adm-tab { flex-direction: column; justify-content: center; gap: 4px; min-width: 96px; padding: 9px 10px 8px; position: relative; font-size: 12.5px; }
  #dash-admin .adm-tab-ico { font-size: 20px; }
  #dash-admin .adm-tab .adm-badge,
  #dash-admin .adm-tab .msg-badge { position: absolute; top: 4px; right: 6px; }
}

/* ── Tarjetas de cada pestaña ───────────────────────────────── */
#dash-admin div[style*="box-shadow:var(--shadow)"],
#dash-admin .admin-card {
  border: 1px solid var(--adm-card-bd) !important;
  border-radius: var(--adm-radius) !important;
  box-shadow: var(--adm-shadow) !important;
}

/* Títulos dentro de las pestañas */
#dash-admin h4 { font-size: 15px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 6px; }

/* Desplegables (details) como bloques */
#dash-admin #ap-pubs-body > details > summary,
#dash-admin #ap-summary > details > summary { list-style: none; cursor: pointer; }
#dash-admin #ap-pubs-body > details,
#dash-admin #ap-summary > details {
  border: 1px solid var(--adm-card-bd); border-radius: 12px; padding: 12px 14px; background: #fff;
}
#dash-admin #ap-pubs-body > details > summary,
#dash-admin #ap-summary > details > summary { font-size: 15px; }
#dash-admin #ap-pubs-body > details > summary::before,
#dash-admin #ap-summary > details > summary::before {
  content: '▸'; display: inline-block; width: 16px; color: var(--accent); transition: transform .15s;
}
#dash-admin #ap-pubs-body > details[open] > summary::before,
#dash-admin #ap-summary > details[open] > summary::before { transform: rotate(90deg); }
#dash-admin #ap-pubs-body > details > summary::-webkit-details-marker,
#dash-admin #ap-summary > details > summary::-webkit-details-marker { display: none; }

/* ── Campos y botones ───────────────────────────────────────── */
#dash-admin .input { border-radius: 10px; }
#dash-admin .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,135,148,.14); outline: none; }
#dash-admin .btn { border-radius: 10px; }
#dash-admin .btn-sm { padding: 7px 12px; font-size: 13px; gap: 6px; }

/* ── Listas de categorías y comercios ───────────────────────── */
#dash-admin .admin-item-card {
  border: 1px solid var(--adm-card-bd); border-radius: 14px; padding: 14px 16px; background: #fff;
  margin-bottom: 10px; transition: box-shadow .15s, border-color .15s;
}
#dash-admin .admin-item-card:last-child { border-bottom: 1px solid var(--adm-card-bd); margin-bottom: 0; }
#dash-admin .admin-item-card:hover { border-color: #c6dfe8; box-shadow: 0 4px 16px rgba(20,32,74,.07); }
#dash-admin .admin-item-main > span:first-child {
  width: 46px; height: 46px; border-radius: 12px; background: var(--light);
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px !important;
}
#dash-admin .admin-item-actions { gap: 6px; }
#dash-admin .admin-item-actions .btn-secondary { background: var(--adm-soft); border-color: #e3ecf1; }
#dash-admin .admin-item-actions .btn-secondary:hover { background: #fff; border-color: var(--accent); }
#dash-admin .admin-item-actions .btn-danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
#dash-admin .admin-item-actions .btn-danger:hover { background: #dc3545; color: #fff; border-color: #dc3545; }

/* Categorías: en cuadrícula, con los botones en la misma línea */
#dash-admin #admin-cats-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
#dash-admin #admin-cats-list > p { grid-column: 1 / -1; }
#dash-admin #admin-cats-list .admin-item-card { margin: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
#dash-admin #admin-cats-list .admin-item-main { min-width: 0; flex: 1; }
#dash-admin #admin-cats-list .admin-item-actions { flex-wrap: nowrap; flex-shrink: 0; }

/* Interruptor «Visible» de cada comercio */
#dash-admin #admin-companies-list label > input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; width: 36px !important; height: 20px !important; margin: 0;
  border-radius: 999px; background: #cbd5e1; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0;
}
#dash-admin #admin-companies-list label > input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
#dash-admin #admin-companies-list label > input[type="checkbox"]:checked { background: var(--accent); }
#dash-admin #admin-companies-list label > input[type="checkbox"]:checked::after { transform: translateX(16px); }
#dash-admin #admin-companies-list label > input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Tablas (estadísticas, resúmenes…) ──────────────────────── */
#dash-admin table { border-collapse: collapse; }
#dash-admin table thead th { background: #f4f8fb; color: #33415c; font-size: 12.5px; }
#dash-admin table tbody tr:nth-child(even) { background: #fbfdfe; }
#dash-admin table tbody tr:hover { background: #f0fafb; }

/* ── Registro de actividad ──────────────────────────────────── */
#dash-admin .al-row { border-radius: 12px !important; border-left: 4px solid #a5d8de !important; padding: 12px 14px !important; transition: box-shadow .15s; }
#dash-admin .al-row:hover { box-shadow: 0 4px 14px rgba(20,32,74,.06); }
#dash-admin .al-row.fail { border-left-color: #ef4444 !important; }

/* ── Móvil ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #dash-admin .adm-nav { padding: 10px; gap: 10px; }
  #dash-admin .adm-group { width: 100%; }
  #dash-admin .adm-group + .adm-group { border-top: 1px solid var(--adm-card-bd); padding-top: 8px; }
  #dash-admin .adm-group-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  #dash-admin .adm-tab { justify-content: center; padding: 9px 10px; }
  #dash-admin #admin-cats-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #dash-admin div[style*="box-shadow:var(--shadow)"],
  #dash-admin .admin-card { padding: 16px !important; }
  #dash-admin .admin-item-card { padding: 12px; }
}
@media (max-width: 480px) {
  #dash-admin .adm-group-tabs { grid-template-columns: 1fr 1fr; }
  #dash-admin .adm-head .dash-title { font-size: 21px; }
}

/* ── Vistas rápidas de Comercios ────────────────────────────── */
#dash-admin .adm-views { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
#dash-admin .adm-view {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid #dbe7ee; background: #fff; color: #33415c; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
#dash-admin .adm-view:hover { border-color: var(--accent); color: var(--accent); }
#dash-admin .adm-view.on { background: var(--primary); border-color: var(--primary); color: #fff; }
#dash-admin .adm-view-n { background: #eef4f8; color: #33415c; border-radius: 999px; padding: 0 7px; font-size: 11.5px; line-height: 18px; }
#dash-admin .adm-view.on .adm-view-n { background: rgba(255,255,255,.2); color: #fff; }

/* ── Menú «⋯ Más» (se abre sobre la página) ─────────────────── */
.adm-menu {
  position: fixed; z-index: 2500; min-width: 220px; padding: 6px; background: #fff;
  border: 1px solid #e2ecf2; border-radius: 12px; box-shadow: 0 12px 32px rgba(20,32,74,.18);
}
.adm-menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; font: inherit; font-size: 14px; font-weight: 600; color: #1a2540; cursor: pointer;
}
.adm-menu-item:hover { background: #f0fafb; color: var(--accent); }
.adm-menu-item.danger { color: #be123c; border-top: 1px solid #f1f5f9; border-radius: 0 0 8px 8px; margin-top: 4px; }
.adm-menu-item.danger:hover { background: #fff1f2; color: #be123c; }
