/* ═══════════════════════════════════════════════ */
/* Lumina Design System — Global Stylesheet       */
/* Radar México © 2026                            */
/* ═══════════════════════════════════════════════ */

:root {
  --lumina-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --lumina-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --lumina-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radar-blue: #2563eb;
  --radar-emerald: #10b981;
  --radar-purple: #7c3aed;
  --radar-ink: #0f172a;
  --radar-muted: #64748b;
  --radar-border: rgba(148, 163, 184, 0.18);
  --radar-shadow: 0 22px 55px -36px rgba(15, 23, 42, 0.45);
}

/* Transiciones suaves globales */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.radar-cartera-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, rgba(37, 99, 235, 0.14), transparent 30rem),
    radial-gradient(circle at 92% 6%, rgba(16, 185, 129, 0.12), transparent 26rem),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 46%, #f8fafc 100%);
}

.radar-app-shell {
  min-height: 100vh;
  padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
}

.radar-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.radar-section-header,
.radar-card,
.radar-card-soft,
.radar-glass-card,
.radar-empty-state {
  border: 1px solid var(--radar-border);
  box-shadow: var(--radar-shadow);
}

.radar-section-header {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.radar-card {
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.96);
}

.radar-card-soft {
  border-radius: 1.5rem;
  background: rgba(248, 250, 252, 0.84);
}

.radar-glass-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.75rem;
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 255, 255, 0.22), transparent 9rem),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 52%, #10b981 115%);
  color: white;
}

.radar-glass-card::after {
  content: "";
  position: absolute;
  inset: auto -2rem -4rem auto;
  width: 9rem;
  height: 9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.radar-meta {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #94a3b8;
}

.radar-pill,
.radar-badge,
.radar-progress-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--radar-border);
  font-weight: 800;
  line-height: 1;
}

.radar-pill {
  min-height: 2.5rem;
  padding: 0.72rem 0.9rem;
  background: rgba(255, 255, 255, 0.82);
  color: #475569;
  transition: transform 160ms var(--lumina-ease-out), background-color 160ms var(--lumina-ease-out), color 160ms var(--lumina-ease-out), box-shadow 160ms var(--lumina-ease-out);
}

.radar-pill-active {
  background: #0f172a;
  color: white;
  box-shadow: 0 14px 30px -20px rgba(15, 23, 42, 0.85);
}

.radar-badge {
  padding: 0.42rem 0.62rem;
  font-size: 0.68rem;
}

.radar-badge-success {
  border-color: rgba(16, 185, 129, 0.22);
  background: #ecfdf5;
  color: #047857;
}

.radar-badge-purple {
  border-color: rgba(124, 58, 237, 0.2);
  background: #f5f3ff;
  color: #6d28d9;
}

.radar-badge-blue {
  border-color: rgba(37, 99, 235, 0.18);
  background: #eff6ff;
  color: #1d4ed8;
}

.radar-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.radar-action-chip {
  min-height: 4.4rem;
  border-radius: 1.25rem;
  border: 1px solid var(--radar-border);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.9rem;
  text-align: left;
  box-shadow: 0 16px 42px -34px rgba(15, 23, 42, 0.38);
  transition: transform 160ms var(--lumina-ease-out), box-shadow 160ms var(--lumina-ease-out), border-color 160ms var(--lumina-ease-out);
}

.radar-search {
  min-height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.92);
  transition: background-color 160ms var(--lumina-ease-out), border-color 160ms var(--lumina-ease-out), box-shadow 160ms var(--lumina-ease-out);
}

.radar-search:focus {
  background: white;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

.radar-empty-state {
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem 1.35rem;
  text-align: center;
}

.radar-empty-icon {
  display: inline-flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 1.35rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  color: #2563eb;
}

.radar-progress-pill {
  height: 0.55rem;
  overflow: hidden;
  background: #e2e8f0;
}

.radar-progress-pill > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--radar-blue), var(--radar-emerald));
}

.radar-fade-in {
  animation: radarFadeIn 260ms var(--lumina-ease-out) both;
}

.radar-points-pulse {
  animation: radarPointsPulse 2.8s ease-in-out infinite;
}

@keyframes radarFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes radarPointsPulse {
  0%,
  100% {
    text-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  50% {
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.36);
  }
}

/* Microinteracciones Lumina */
.lumina-pressable,
.lumina-button,
.lumina-card-pressable {
  transition-property: transform, opacity;
  transition-duration: 140ms;
  transition-timing-function: var(--lumina-ease-out);
  will-change: transform;
}

.lumina-button {
  transition-property: transform, background-color, box-shadow, border-color, opacity !important;
  transition-duration: 160ms !important;
  transition-timing-function: var(--lumina-ease-out) !important;
}

.lumina-button:active,
.lumina-pressable:active {
  transform: scale(0.97);
}

.lumina-card-pressable:active {
  transform: scale(0.985);
}

.lumina-button:disabled,
.lumina-button[disabled],
.lumina-pressable:disabled,
.lumina-pressable[disabled],
.lumina-card-pressable[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.lumina-button-primary {
  box-shadow: 0 8px 16px -12px rgba(37, 99, 235, 0.65);
}

.lumina-button-secondary {
  box-shadow: 0 8px 14px -14px rgba(15, 23, 42, 0.35);
}

.lumina-button-danger {
  box-shadow: 0 8px 14px -14px rgba(225, 29, 72, 0.35);
}

@media (hover: hover) and (pointer: fine) {
  .lumina-card-pressable:hover {
    transform: translateY(-1px);
  }

  .lumina-button:hover,
  .lumina-pressable:hover {
    transform: translateY(-1px);
  }
}

.lumina-backdrop {
  opacity: 0;
  pointer-events: none;
  transition-property: opacity;
  transition-duration: 220ms;
  transition-timing-function: var(--lumina-ease-in-out);
}

.lumina-backdrop:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.lumina-bottom-sheet {
  transform: translateY(100%);
  opacity: 0.98;
  transition-property: transform, opacity;
  transition-duration: 250ms;
  transition-timing-function: var(--lumina-ease-drawer);
}

.lumina-backdrop:not(.hidden) .lumina-bottom-sheet {
  transform: translateY(0);
  opacity: 1;
}

.lumina-modal-panel {
  transform: scale(0.97);
  opacity: 0.98;
  transition-property: transform, opacity;
  transition-duration: 220ms;
  transition-timing-function: var(--lumina-ease-out);
}

.lumina-backdrop:not(.hidden) .lumina-modal-panel {
  transform: scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .lumina-pressable,
  .lumina-button,
  .lumina-card-pressable,
  .lumina-backdrop,
  .lumina-bottom-sheet,
  .lumina-modal-panel,
  .radar-toast,
  .radar-button-loading::after,
  .radar-pulse-success,
  .radar-pulse-error,
  .radar-fade-in,
  .radar-points-pulse {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    transform: none !important;
  }
}

/* Barras de scroll Lumina */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f8fafc;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  border: 3px solid #f8fafc;
}

::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}

/* Premium Shadows & Borders (legacy compat) */
.premium-shadow {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.premium-border {
  border-radius: 16px;
}

/* Radar operational feedback */
.radar-toast-container {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: none;
}

.radar-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(22rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: 0 18px 45px -28px rgba(15, 23, 42, 0.8);
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(0.98);
  transition: opacity 220ms var(--lumina-ease-out), transform 220ms var(--lumina-ease-out);
  pointer-events: auto;
}

.radar-toast.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.radar-toast.is-leaving {
  opacity: 0;
  transform: translate3d(0, 6px, 0) scale(0.985);
}

.radar-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
}

.radar-toast-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.25;
}

.radar-toast-copy strong {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.radar-toast-success {
  border-color: rgba(16, 185, 129, 0.32);
}

.radar-toast-success .radar-toast-icon {
  background: #dcfce7;
  color: #047857;
}

.radar-toast-error {
  border-color: rgba(244, 63, 94, 0.32);
}

.radar-toast-error .radar-toast-icon {
  background: #ffe4e6;
  color: #be123c;
}

.radar-toast-warning .radar-toast-icon {
  background: #fef3c7;
  color: #b45309;
}

.radar-toast-info .radar-toast-icon,
.radar-toast-sync .radar-toast-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

.radar-button-loading {
  position: relative;
  cursor: wait !important;
}

.radar-button-loading::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.55em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  vertical-align: -0.12em;
  animation: radar-spin 650ms linear infinite;
}

.radar-pulse-success {
  animation: radar-pulse-success 620ms var(--lumina-ease-out);
}

.radar-pulse-error {
  animation: radar-pulse-error 620ms var(--lumina-ease-out);
}

@keyframes radar-spin {
  to { transform: rotate(360deg); }
}

@keyframes radar-pulse-success {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.42); }
  100% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
}

@keyframes radar-pulse-error {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.34); }
  100% { box-shadow: 0 0 0 14px rgba(244, 63, 94, 0); }
}

@media (max-width: 640px) {
  .radar-toast-container {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.85rem);
    align-items: stretch;
  }

  .radar-toast {
    width: 100%;
  }
}

/* Glass panel (backdrop blur overlay) */
.glass-panel {
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Cartera: evita que el ultimo ticket quede debajo de la navegacion inferior. */
#tabActividad #historialComprasLista {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6.5rem);
}

/* POS físico V1: paneles compactos para computadoras de tienda. */
:root {
  --pos-cart-width: 36%;
  --pos-resizer-width: 10px;
}

.pos-main-header {
  gap: 1rem;
}

.pos-brand-block {
  flex: 0 0 auto;
}

.pos-header-search {
  min-width: 18rem;
  max-width: none;
}

.pos-header-actions {
  flex: 0 0 auto;
}

.pos-operation-card {
  display: flex;
  min-height: 4.6rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.2rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.9rem 1rem;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.pos-operation-card:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  background: #fff;
}

.pos-operation-card span {
  font-size: 0.92rem;
  font-weight: 900;
  color: #0f172a;
}

.pos-operation-card small {
  font-size: 0.73rem;
  line-height: 1.25;
  color: #64748b;
}

.pos-operation-danger {
  background: #fff1f2;
  border-color: #fecdd3;
}

.pos-operation-danger span {
  color: #be123c;
}

@media (min-width: 768px) {
  body.pos-desktop-layout {
    height: 100vh;
    overflow: hidden;
  }

  body.pos-desktop-layout .pos-catalog-pane {
    flex: 1 1 calc(100% - var(--pos-cart-width) - var(--pos-resizer-width));
    min-width: 0;
  }

  body.pos-desktop-layout .pos-cart-pane {
    flex: 0 0 var(--pos-cart-width);
    width: var(--pos-cart-width) !important;
    min-width: 300px;
    max-width: 46vw;
  }

  body.pos-desktop-layout .pos-main-header {
    display: grid;
    grid-template-columns: auto minmax(20rem, 1fr) auto;
  }

  .pos-panel-resizer {
    flex: 0 0 var(--pos-resizer-width);
    width: var(--pos-resizer-width);
    cursor: col-resize;
    background:
      linear-gradient(90deg, transparent 0, transparent 35%, rgba(148, 163, 184, 0.34) 35%, rgba(148, 163, 184, 0.34) 65%, transparent 65%);
    border-left: 1px solid rgba(226, 232, 240, 0.8);
    border-right: 1px solid rgba(226, 232, 240, 0.8);
    transition: background-color 160ms ease, box-shadow 160ms ease;
    z-index: 45;
  }

  .pos-panel-resizer:hover,
  .pos-panel-resizer:focus-visible,
  body.pos-resizing-panels .pos-panel-resizer {
    background-color: rgba(37, 99, 235, 0.08);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
    outline: none;
  }

  body.pos-resizing-panels,
  body.pos-resizing-panels * {
    cursor: col-resize !important;
    user-select: none !important;
  }

  body.pos-modo-mesas .pos-panel-resizer {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1366px), (min-width: 768px) and (max-height: 820px) {
  body.pos-desktop-compact > section:first-of-type > header {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  body.pos-desktop-compact .pos-brand-block > div:last-child {
    display: none;
  }

  body.pos-desktop-compact .pos-header-search {
    min-width: 0;
  }

  body.pos-desktop-compact #btnOperacionPOS {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  body.pos-desktop-compact #btnOperacionPOS span {
    display: none !important;
  }

  body.pos-desktop-compact #productosPane {
    padding: 0 0.75rem 0.75rem;
  }

  body.pos-desktop-compact #inputBusqueda {
    min-height: 2.5rem;
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
  }

  body.pos-desktop-compact #productosGrid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 0.625rem;
  }

  body.pos-desktop-compact #productosGrid > div {
    min-height: 7rem;
    height: auto;
    padding: 0.85rem;
  }

  body.pos-desktop-compact #barraCategorias {
    margin-bottom: 0.75rem;
    padding-top: 0.625rem;
  }

  body.pos-desktop-compact #panelVip {
    margin: 0.75rem;
    padding: 0.75rem;
  }

  body.pos-desktop-compact #inputBusquedaVip {
    padding: 1rem;
    font-size: 1.75rem;
  }

  body.pos-desktop-compact #listaCarrito {
    padding: 0.75rem;
    padding-bottom: 12.5rem;
  }

  body.pos-desktop-compact #panelCarrito > div:last-child {
    padding: 0.85rem;
  }

  body.pos-desktop-compact #totalCarrito {
    font-size: 1.85rem;
  }

  body.pos-desktop-compact #btnCobrarRetail,
  body.pos-desktop-compact #btnPrecuenta {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    font-size: 1.15rem;
  }
}

@media (max-width: 767px) {
  .pos-panel-resizer,
  #btnResetPanelesPOS,
  #printerStatusPOS {
    display: none !important;
  }

  .pos-main-header {
    gap: 0.5rem;
  }

  .pos-brand-block {
    flex: 0 0 auto;
  }

  .pos-header-search {
    min-width: 0;
  }

  .pos-operation-card:hover {
    transform: none;
  }
}

.ticket-preview {
  max-width: 80mm;
  margin: 0 auto 1.25rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  text-align: left;
}

.ticket-receipt {
  width: 100%;
  color: #000;
  background: #fff;
  font: 11px/1.35 "Courier New", Courier, monospace;
  overflow-wrap: anywhere;
}

.ticket-print-temporary {
  position: fixed;
  left: -120vw;
  top: 0;
  width: 80mm;
  background: #fff;
  z-index: -1;
}

.ticket-header,
.ticket-footer,
.ticket-centered {
  text-align: center;
}

.ticket-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.2;
}

.ticket-header p,
.ticket-footer p,
.ticket-points p {
  margin: 2px 0;
}

.ticket-logo {
  display: block;
  width: auto;
  max-width: 32mm;
  max-height: 16mm;
  margin: 0 auto 5px;
  object-fit: contain;
  filter: grayscale(1);
}

.ticket-divider,
.ticket-items,
.ticket-summary,
.ticket-points,
.ticket-footer {
  border-top: 1px dashed #000;
  margin-top: 8px;
  padding-top: 7px;
}

.ticket-item {
  padding: 4px 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.ticket-item + .ticket-item {
  border-top: 1px dotted #999;
}

.ticket-item-title,
.ticket-item-detail,
.ticket-summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ticket-item-title span,
.ticket-item-detail span:last-child,
.ticket-summary-row span:first-child {
  min-width: 0;
}

.ticket-item-title strong,
.ticket-summary-row span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}

.ticket-item-detail {
  margin-top: 2px;
  color: #333;
  font-size: 10px;
}

.ticket-summary-row {
  padding: 2px 0;
  text-transform: capitalize;
}

.ticket-total {
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid #000;
  font-size: 14px;
  font-weight: 700;
}

.ticket-footer small {
  display: block;
  margin-top: 5px;
  letter-spacing: 0.08em;
}

@media print {
  .ticket-print-temporary {
    position: absolute;
    left: 0;
    top: 0;
    z-index: auto;
  }

  .ticket-preview,
  .ticket-receipt {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
}
