/* ═══════════════════════════════════════════════════════════
   TECHSHOP PERÚ - Panel Admin UI/UX
   Coherente con la tienda: Outfit/Inter, azul #2563eb,
   gradientes, micro-interacciones y dark mode.
   ═══════════════════════════════════════════════════════════ */

:root {
  --admin-sidebar-bg: #0f172a;
  --admin-sidebar-hover: #1e293b;
  --admin-primary: #2563eb;
  --admin-primary-light: #60a5fa;
  --admin-gradient: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
  --admin-gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --admin-surface: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-text-muted: #64748b;
  --admin-radius: 0.85rem;
  --admin-shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
  --admin-shadow: 0 4px 14px -2px rgba(15,23,42,0.08);
  --admin-shadow-lg: 0 16px 32px -4px rgba(37,99,235,0.16);
  --admin-transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #f1f5f9;
  color: var(--admin-text);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* Accesibilidad: foco visible consistente en todo el panel (teclado).
   Alpha >= 0.85 para cumplir WCAG 2.4.11 (>= 3:1 del indicador). */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.9);
  outline-offset: 2px;
  border-radius: 4px;
}
body.admin-dark :focus-visible { outline-color: rgba(96, 165, 250, 0.9); }

/* Skip link: visible solo al recibir foco por teclado */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  background: var(--admin-primary); color: #fff;
  padding: 0.6rem 1.2rem; border-radius: 0 0 0.6rem 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus-visible { left: 0; }

/* ── Sidebar ───────────────────────────────────────────── */
.admin-sidebar {
  min-height: 100vh;
  background: var(--admin-gradient-hero);
  color: #94a3b8;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .sidebar-brand {
  background: linear-gradient(135deg, rgba(37,99,235,0.22), rgba(2,132,199,0.10));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar .sidebar-brand h5 { color: #fff; }
.admin-sidebar .nav-link {
  color: #cbd5e1;
  padding: 0.72rem 1.1rem;
  font-weight: 500;
  font-size: 0.92rem;
  border-radius: 0.65rem;
  margin: 0.15rem 0.6rem;
  position: relative;
  transition: var(--admin-transition);
}
.admin-sidebar .nav-link i { color: #64748b; transition: var(--admin-transition); }
.admin-sidebar .nav-link:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.07);
  transform: translateX(3px);
}
.admin-sidebar .nav-link:hover i { color: var(--admin-primary-light); }
.admin-sidebar .nav-link.active {
  color: #ffffff;
  background: var(--admin-gradient);
  box-shadow: 0 6px 16px -4px rgba(37,99,235,0.5);
}
.admin-sidebar .nav-link.active i { color: #fff; }
/* Contraste AA del enlace Cerrar Sesión sobre el sidebar oscuro:
   rojo claro #f87171 (3.23 -> 5.9:1). El texto danger por defecto es muy oscuro. */
.admin-sidebar .nav-link.text-danger { color: #f87171 !important; }
.admin-sidebar .nav-link.text-danger i { color: #f87171 !important; }
.admin-sidebar .nav-link.text-danger:hover { color: #fca5a5 !important; background: rgba(248,113,113,0.12); }
.admin-sidebar .nav-link.active::before {
  content: ''; position: absolute; left: -0.6rem; top: 20%; bottom: 20%;
  width: 4px; border-radius: 4px;
  background: var(--admin-primary-light);
}
.admin-sidebar hr { border-color: rgba(255,255,255,0.1) !important; }

/* ── Header de página ──────────────────────────────────── */
.admin-page-title { font-size: 1.35rem; font-weight: 800; }
.admin-header-sub { color: var(--admin-text-muted); }

/* ── Stat cards KPI ────────────────────────────────────── */
.admin-stat-card {
  background: var(--admin-surface);
  padding: 1.4rem 1.5rem;
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--admin-transition);
}
.admin-stat-card:hover {
  box-shadow: var(--admin-shadow-lg);
  transform: translateY(-3px);
}
.admin-stat-card::after {
  content: ''; position: absolute; top: -45%; right: -20%;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(37,99,235,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.admin-stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  border: 1px solid transparent;
}
.admin-stat-card .stat-value { font-size: 1.7rem; font-weight: 800; font-family: 'Outfit', sans-serif; }

/* Chips de icono con contraste AA por color (texto/icono >= 3:1 sobre su fondo) */
.stat-icon.stat-success   { color: #166534; background: #dcfce7; border-color: #86efac; }
.stat-icon.stat-primary   { color: #1d4ed8; background: #dbeafe; border-color: #93c5fd; }
.stat-icon.stat-info      { color: #0e7490; background: #cffafe; border-color: #67e8f9; }
.stat-icon.stat-danger    { color: #b91c1c; background: #fee2e2; border-color: #fca5a5; }
.stat-icon.stat-warning   { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.stat-icon.stat-secondary { color: #475569; background: #e2e8f0; border-color: #cbd5e1; }

/* ── Cards generales ───────────────────────────────────── */
/* Sin borde externo: todas las páginas del panel usan `border-0` de
   Bootstrap (que gana con !important). Mantener borde solo en el header
   interno para separar título de contenido. */
.card {
  border: 0;
  border-radius: var(--admin-radius) !important;
  box-shadow: var(--admin-shadow-sm);
  transition: var(--admin-transition);
}
.card:hover { box-shadow: var(--admin-shadow); }
.card .card-header { background: var(--admin-surface); border-bottom: 1px solid var(--admin-border); }
.card .card-title, .card h6 { font-weight: 700; }

/* ── Tablas ────────────────────────────────────────────── */
.table { --bs-table-hover-bg: rgba(37,99,235,0.05); }
.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--admin-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
  font-weight: 700;
}
.table tbody tr { transition: var(--admin-transition); }
.table-hover tbody tr:hover { --bs-table-hover-bg: rgba(37,99,235,0.05); }

/* ── Botones ───────────────────────────────────────────── */
.btn { border-radius: 0.6rem; font-weight: 600; transition: var(--admin-transition); }
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--admin-gradient);
  border: none;
  box-shadow: 0 4px 10px -2px rgba(37,99,235,0.4);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 14px -2px rgba(37,99,235,0.5); }
.btn-outline-primary { border-color: var(--admin-primary); color: var(--admin-primary); }
.btn-outline-primary:hover { background: var(--admin-primary); border-color: var(--admin-primary); }

/* ── Formularios ───────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 0.6rem;
  border-color: var(--admin-border);
  padding: 0.55rem 0.85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-label { font-weight: 600; font-size: 0.88rem; }

/* ── Badges ────────────────────────────────────────────── */
.badge { font-weight: 600; border-radius: 2rem; }

/* ── Flash / alerts ────────────────────────────────────── */
.alert { border-radius: 0.7rem; border: 1px solid transparent; }

/* ── Dark mode (sigue la preferencia del sistema) ──────── */
body.admin-dark,
body.admin-dark .card,
body.admin-dark .card .card-header,
body.admin-dark .admin-stat-card { background: #1e293b; border-color: #334155; }
body.admin-dark { background-color: #0f172a; color: #e2e8f0; }
body.admin-dark .table thead th { background: #0f172a; color: #94a3b8; border-color: #334155; }
body.admin-dark .table { --bs-table-color: #e2e8f0; --bs-table-hover-bg: rgba(37,99,235,0.15); --bs-table-hover-color: #fff; }
body.admin-dark .form-control, body.admin-dark .form-select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.admin-dark .text-muted { color: #94a3b8 !important; }
body.admin-dark .admin-stat-card::after { background: radial-gradient(circle, rgba(96,165,250,0.12) 0%, transparent 70%); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .admin-sidebar { position: static; height: auto; min-height: 0; }
}
