/* ══════════════════════════════════════════════════════════════════════════════
   admin.css — Panel administrador SuperHogar
   Diseño funcional, mobile-first. Sin dependencias externas.
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
  --adm-primary:   #2563eb;
  --adm-primary-dk:#1d4ed8;
  --adm-danger:    #dc2626;
  --adm-success:   #16a34a;
  --adm-warning:   #d97706;
  --adm-bg:        #f1f5f9;
  --adm-surface:   #ffffff;
  --adm-bar:       #1e293b;
  --adm-text:      #1e293b;
  --adm-muted:     #64748b;
  --adm-border:    #e2e8f0;
  --adm-radius:    8px;
  --adm-shadow:    0 1px 4px rgba(0,0,0,.10);
  --adm-font:      'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--adm-font);
  background: var(--adm-bg);
  color: var(--adm-text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--adm-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: var(--adm-font); }

/* ── Barra superior ──────────────────────────────────────────────────────────── */
.adm-topbar {
  background: var(--adm-bar);
  color: #fff;
  padding: 0 16px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.adm-topbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-topbar-brand span {
  font-size: .75rem;
  font-weight: 400;
  color: #94a3b8;
  background: rgba(255,255,255,.08);
  padding: 2px 8px;
  border-radius: 4px;
}
.adm-topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.adm-topbar-nav a {
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .83rem;
  font-weight: 500;
}
.adm-topbar-nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.adm-topbar-nav a.active { color: #fff; }
.adm-topbar-nav .btn-logout {
  color: #fca5a5;
  border: 1px solid rgba(220,38,38,.3);
  margin-left: 8px;
}
.adm-topbar-nav .btn-logout:hover { background: rgba(220,38,38,.15); color: #fca5a5; }

/* ── Contenido principal ─────────────────────────────────────────────────────── */
.adm-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ── Tarjeta/panel ───────────────────────────────────────────────────────────── */
.adm-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  border: 1px solid var(--adm-border);
  box-shadow: var(--adm-shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.adm-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--adm-border);
  color: var(--adm-text);
}

/* ── Formulario login ────────────────────────────────────────────────────────── */
.adm-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--adm-bg);
}
.adm-login-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  border: 1px solid var(--adm-border);
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}
.adm-login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.adm-login-logo strong {
  display: block;
  font-size: 1.4rem;
  color: var(--adm-primary);
  letter-spacing: -.5px;
}
.adm-login-logo span {
  font-size: .78rem;
  color: var(--adm-muted);
}

/* ── Campos de formulario ────────────────────────────────────────────────────── */
.adm-field {
  margin-bottom: 16px;
}
.adm-label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--adm-text);
  margin-bottom: 5px;
}
.adm-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--adm-border);
  border-radius: var(--adm-radius);
  font-size: .9rem;
  background: var(--adm-bg);
  color: var(--adm-text);
  outline: none;
}
.adm-input:focus { border-color: var(--adm-primary); background: #fff; }
.adm-input.error { border-color: var(--adm-danger); }

/* ── Botones ─────────────────────────────────────────────────────────────────── */
.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--adm-radius);
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.adm-btn-primary {
  background: var(--adm-primary);
  color: #fff;
  width: 100%;
  padding: 12px;
}
.adm-btn-primary:hover { background: var(--adm-primary-dk); }
.adm-btn-danger  { background: var(--adm-danger);  color: #fff; }
.adm-btn-outline {
  background: transparent;
  border: 1.5px solid var(--adm-border);
  color: var(--adm-text);
}
.adm-btn-outline:hover { border-color: var(--adm-primary); color: var(--adm-primary); }
.adm-btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ── Mensajes ────────────────────────────────────────────────────────────────── */
.adm-alert {
  padding: 11px 14px;
  border-radius: var(--adm-radius);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.adm-alert-error   { background: #fef2f2; color: var(--adm-danger);  border-color: var(--adm-danger); }
.adm-alert-success { background: #f0fdf4; color: var(--adm-success); border-color: var(--adm-success); }
.adm-alert-info    { background: #eff6ff; color: var(--adm-primary); border-color: var(--adm-primary); }
.adm-alert-warning { background: #fffbeb; color: var(--adm-warning); border-color: var(--adm-warning); }

/* ── Buscador de productos ───────────────────────────────────────────────────── */
.adm-search-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.adm-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--adm-muted);
  pointer-events: none;
}
.adm-search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1.5px solid var(--adm-border);
  border-radius: var(--adm-radius);
  font-size: .9rem;
  background: var(--adm-bg);
  outline: none;
}
.adm-search-input:focus { border-color: var(--adm-primary); background: #fff; }

/* ── Tabla de productos ──────────────────────────────────────────────────────── */
.adm-table-wrap { overflow-x: auto; }
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.adm-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--adm-muted);
  border-bottom: 2px solid var(--adm-border);
  white-space: nowrap;
}
.adm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--adm-border);
  vertical-align: middle;
}
.adm-table tr:hover td { background: #f8fafc; }
.adm-table .col-img { width: 52px; }
.adm-table .col-acciones { width: 100px; text-align: right; }

/* ── Placeholder/vacío ───────────────────────────────────────────────────────── */
.adm-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--adm-muted);
  font-size: .9rem;
}
.adm-empty p { margin-bottom: 8px; }

/* ── Stats resumen (dashboard) ───────────────────────────────────────────────── */
.adm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.adm-stat {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 16px;
  text-align: center;
}
.adm-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--adm-primary);
  line-height: 1;
}
.adm-stat-label {
  font-size: .75rem;
  color: var(--adm-muted);
  margin-top: 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .adm-topbar-nav a:not(.btn-logout):not(.active) { display: none; }
  .adm-login-card { padding: 28px 20px; }
  .adm-main { padding: 16px 12px 40px; }
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Sesión 6: filas de tabla con estados visuales ────────────────────────── */
.fila-vendido td { background: #f5f5f5; color: #999; }
.fila-vendido code { color: #bbb; }
.fila-oculto td  { background: #fffbeb; }

/* ── Badges admin ────────────────────────────────────────────────────────────── */
.adm-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  margin-right: 2px;
}
.badge-dest   { background: #ede9fe; color: #6d28d9; }
.badge-ofer   { background: #fee2e2; color: #b91c1c; }
.badge-nuevo  { background: #dbeafe; color: #1d4ed8; }
.badge-vend   { background: #e5e7eb; color: #6b7280; }
.badge-ocul   { background: #fef9c3; color: #a16207; }
.badge-estado { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* ── Sesión 7: gestión de fotos ──────────────────────────────────────────── */
.adm-fotos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
@media (min-width: 600px) {
  .adm-fotos-grid { grid-template-columns: repeat(4, 1fr); }
}
.adm-foto-slot {
  background: var(--adm-surface);
  border: 1.5px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.slot-ocupado { border-color: var(--adm-primary); }
.slot-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--adm-muted);
  width: 100%;
}
.slot-ocupado .slot-label { color: var(--adm-primary); }
.slot-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  background: var(--adm-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.slot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slot-kb {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: .62rem;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}
.slot-empty-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--adm-muted);
  opacity: .5;
}
.slot-empty-icon span { font-size: .7rem; }
.slot-nombre {
  font-size: .68rem;
  color: var(--adm-muted);
  word-break: break-all;
}
.slot-form { width: 100%; }
.slot-btn-subir {
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-btn-del { width: 100%; }
.slot-remota {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: .6rem;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}
