/* =========================================================================
   WormShop — Premium Neon Layer (black + neon red)
   Capa 100% visual. No cambia HTML, IDs, clases, eventos ni lógica.
   Cargada al final para poder refinar estilos existentes sin borrarlos.
   ========================================================================= */

:root {
  --ws-neon: #a855f7;
  --ws-neon-soft: #c084fc;
  --ws-neon-deep: #b00d22;
  --ws-neon-dim: rgba(168, 85, 247, 0.12);
  --ws-neon-line: rgba(168, 85, 247, 0.28);
  --ws-glow-1: 0 0 0 1px rgba(168, 85, 247, 0.22);
  --ws-glow-2: 0 0 18px rgba(168, 85, 247, 0.28);
  --ws-glow-3: 0 0 42px rgba(168, 85, 247, 0.35);
  --ws-ink-0: #050506;
  --ws-ink-1: #0b0b0e;
  --ws-ink-2: #121216;
  --ws-glass: rgba(255, 255, 255, 0.04);
  --ws-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ws-bg: #050506;
  --ws-brand: #a855f7;
  --ws-brand-strong: #c084fc;
  --ws-brand-dim: rgba(168, 85, 247, 0.12);
  --ws-glow-brand: 0 0 24px rgba(168, 85, 247, 0.3);
}

/* ---------- Base / fondo profundo con halo controlado ---------- */
html { scroll-behavior: smooth; }

body {
  background-color: var(--ws-ink-0);
  background-image:
    radial-gradient(1100px 620px at 12% -12%, rgba(168, 85, 247, 0.13), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(168, 85, 247, 0.08), transparent 60%),
    radial-gradient(1200px 800px at 50% 118%, rgba(168, 85, 247, 0.07), transparent 65%);
  background-attachment: scroll;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(168, 85, 247, 0.35); color: #fff; }

/* ---------- Scrollbar premium ---------- */
* { scrollbar-color: rgba(168, 85, 247, 0.55) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--ws-neon), var(--ws-neon-deep));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ws-neon-soft); background-clip: padding-box; }

/* ---------- Tipografía y jerarquía ---------- */
h1, h2, h3, .dash-title, .blocktitle, .a-title {
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { line-height: 1.08; }
.eyebrow, .dash-sub, .blocksub, .sub, .muted {
  letter-spacing: 0.01em;
}
.eyebrow {
  color: var(--ws-neon-soft);
  text-shadow: 0 0 16px rgba(168, 85, 247, 0.35);
}

/* ---------- Foco accesible y consistente ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ws-neon);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- Botones ---------- */
.btn,
button.btn,
a.btn,
.round-btn {
  position: relative;
  isolation: isolate;
  transition:
    transform 0.18s var(--ws-ease),
    box-shadow 0.25s var(--ws-ease),
    border-color 0.25s var(--ws-ease),
    background-color 0.25s var(--ws-ease);
}
.btn:hover:not(:disabled),
.round-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), var(--ws-glow-2);
}
.btn:active:not(:disabled),
.round-btn:active:not(:disabled) { transform: translateY(0) scale(0.985); }
.btn:disabled,
.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  filter: grayscale(0.35);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary,
.btn-brand {
  background-image: linear-gradient(135deg, var(--ws-neon) 0%, var(--ws-neon-deep) 100%);
  border-color: rgba(168, 85, 247, 0.55);
  color: #fff;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-primary:hover:not(:disabled),
.btn-brand:hover:not(:disabled) {
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.34), var(--ws-glow-3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* brillo que recorre el botón principal al pasar el cursor */
.btn-primary::after,
.btn-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.22) 45%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.btn-primary:hover:not(:disabled)::after,
.btn-brand:hover:not(:disabled)::after {
  opacity: 1;
  transform: translateX(120%);
  transition: transform 0.75s var(--ws-ease), opacity 0.2s linear;
}

/* estado de carga si el markup ya usa aria-busy / .loading / .is-loading */
.btn.loading,
.btn.is-loading,
.btn[aria-busy="true"] { color: transparent; pointer-events: none; position: relative; }
.btn.loading::before,
.btn.is-loading::before,
.btn[aria-busy="true"]::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: ws-spin 0.7s linear infinite;
}
@keyframes ws-spin { to { transform: rotate(360deg); } }

/* ---------- Superficies: tarjetas, paneles, modales ---------- */
.panel-box,
.stat-cards > *,
.a-plain-card,
.admin-profile-card,
.site-announcement-card,
.dash-user,
.dash-section,
.m-card,
.prod-card,
.card {
  background-color: color-mix(in srgb, var(--ws-ink-1) 88%, transparent);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 34px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.25s var(--ws-ease),
    box-shadow 0.3s var(--ws-ease),
    border-color 0.3s var(--ws-ease);
}
.panel-box:hover,
.a-plain-card:hover,
.m-card:hover,
.prod-card:hover,
.card:hover {
  border-color: var(--ws-neon-line);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(168, 85, 247, 0.16), var(--ws-glow-2);
  transform: translateY(-2px);
}

.stat-cards > * { position: relative; overflow: hidden; }
.stat-cards > *::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ws-neon), transparent);
  opacity: 0.55;
}

.overlay,
.modal {
  transition: opacity 0.22s var(--ws-ease), transform 0.22s var(--ws-ease);
}
.modal {
  border-color: rgba(168, 85, 247, 0.18);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(168, 85, 247, 0.14);
  animation: ws-pop 0.24s var(--ws-ease) both;
}
@keyframes ws-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- Grid de productos más uniforme ---------- */
.prod-grid > *,
.m-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.prod-grid img,
.m-card img { transition: transform 0.32s var(--ws-ease); }
.prod-grid > *:hover img,
.m-card:hover img { transform: scale(1.025); }

/* ---------- Sidebars (comprador / seller / admin / afiliados) ---------- */
.admin-sidebar,
.dash-sidebar {
  background:
    linear-gradient(180deg, rgba(168, 85, 247, 0.07), transparent 220px),
    color-mix(in srgb, var(--ws-ink-1) 92%, transparent);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 39;
}
.admin-sidebar-overlay.show { display: block; }

.admin-sidebar a,
.admin-sidebar button,
.dash-nav-item {
  position: relative;
  transition:
    color 0.2s var(--ws-ease),
    background-color 0.2s var(--ws-ease),
    padding-left 0.2s var(--ws-ease),
    box-shadow 0.25s var(--ws-ease);
}
.admin-sidebar a::before,
.admin-sidebar button::before,
.dash-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 2px;
  border-radius: 999px;
  background: var(--ws-neon);
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity 0.2s var(--ws-ease), transform 0.2s var(--ws-ease);
}
.admin-sidebar a:hover,
.admin-sidebar button:hover,
.dash-nav-item:hover {
  background-color: rgba(168, 85, 247, 0.08);
  color: #fff;
}
.admin-sidebar a:hover::before,
.admin-sidebar button:hover::before,
.dash-nav-item:hover::before,
.admin-sidebar a.active::before,
.admin-sidebar button.active::before,
.dash-nav-item.active::before {
  opacity: 1;
  transform: scaleY(1);
}
.admin-sidebar a.active,
.admin-sidebar button.active,
.dash-nav-item.active {
  background-color: rgba(168, 85, 247, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.22);
}
.dash-nav-header,
.admin-sidebar .nav-group-title {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.42);
}

/* ---------- Inputs ---------- */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  transition: border-color 0.2s var(--ws-ease), box-shadow 0.25s var(--ws-ease), background-color 0.2s var(--ws-ease);
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: var(--ws-neon) !important;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.16), 0 0 22px rgba(168, 85, 247, 0.18);
}
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.32); }

/* ---------- Badges / pills / tabs ---------- */
.status-pill,
.badge,
.role-badges > * {
  border-color: rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.25s var(--ws-ease), border-color 0.25s var(--ws-ease);
}
.status-pill:hover, .badge:hover { border-color: var(--ws-neon-line); }

.tab, .activity-tab {
  transition: color 0.2s var(--ws-ease), border-color 0.2s var(--ws-ease), background-color 0.2s var(--ws-ease);
}
.tab.active, .activity-tab.active {
  color: #fff;
  border-color: var(--ws-neon);
  box-shadow: 0 2px 18px -6px var(--ws-neon);
}

/* ---------- Enlaces ---------- */
a { transition: color 0.18s var(--ws-ease), opacity 0.18s var(--ws-ease); }
.switch-link:hover { color: var(--ws-neon-soft); text-shadow: 0 0 14px rgba(168, 85, 247, 0.4); }

/* ---------- Iconos ---------- */
.a-icon, .node-icon, .premium-icon, svg {
  transition: transform 0.22s var(--ws-ease);
}
.btn:hover .a-icon,
.dash-nav-item:hover .a-icon,
.round-btn:hover svg { transform: translateY(-1px) scale(1.06); }
.premium-icon { }

/* ---------- Estados vacíos / skeleton ---------- */
.empty, .empty-state, .ws-empty {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.skeleton, .is-skeleton, [data-skeleton] {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: transparent;
}
.skeleton::after, .is-skeleton::after, [data-skeleton]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.16), transparent);
  animation: ws-shimmer 1.35s infinite;
}
@keyframes ws-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ---------- Toasts / mensajes de éxito y error ---------- */
.toast, .notice, .alert, .ws-toast {
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  animation: ws-slide-in 0.28s var(--ws-ease) both;
}
@keyframes ws-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Entrada suave de secciones ---------- */
.dash-section,
.panel-box,
.stat-cards,
.prod-grid { animation: ws-fade-up 0.42s var(--ws-ease) both; }
@keyframes ws-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Notificaciones / puntos ---------- */
/* .dot es decorativo/poco frecuente (branding, indicador "En línea") —
   se deja con el pulso original de box-shadow, impacto real bajo. */
.dot {
  box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.55);
}

/* .notif-dot SÍ vive en el header, visible en TODAS las páginas —
   se reescribe con un anillo en un ::after animado por transform/opacity
   (compositor-only, sin repaint por frame) en vez de animar box-shadow
   directamente. Mismo efecto visual de "pulso creciente". */
.notif-dot {
  position: relative;
}
.notif-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(168, 85, 247, 0.55);
  pointer-events: none;
}


/* ---------- Tooltips (solo si el elemento ya trae title/data-tip) ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #0d0d10;
  color: #fff;
  border: 1px solid rgba(168, 85, 247, 0.28);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  pointer-events: none;
  animation: ws-slide-in 0.16s var(--ws-ease) both;
}

/* ---------- Tablas ---------- */
table tbody tr { transition: background-color 0.18s var(--ws-ease); }
table tbody tr:hover { background-color: rgba(168, 85, 247, 0.06); }
table thead th {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Responsive: móvil y tablet ---------- */
@media (max-width: 1024px) {
  .stat-cards { gap: 12px; }
  .panel-box { border-radius: 14px; }
}
@media (max-width: 768px) {
  body { background-attachment: scroll; }
  h1 { font-size: clamp(28px, 7.5vw, 42px); }
  h2 { font-size: clamp(21px, 5.4vw, 30px); }
  .btn { min-height: 44px; }
  .round-btn { min-width: 44px; min-height: 44px; }
  .prod-grid { gap: 12px; }
  .panel-box, .a-plain-card, .dash-section { padding: 14px; border-radius: 14px; }
  .admin-sidebar { box-shadow: 24px 0 60px rgba(0, 0, 0, 0.65); }
  table thead th, table td { font-size: 12px; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Accesibilidad de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto;
  }
}
