/* ==========================================================================
   Espina Comercial — Global Workspace Gestures & POS-Style Swipe Reveals
   Loaded globally for authenticated workspace views via layout.html
   ========================================================================== */

/* Shared clipping for containers with swipeable rows/cards */
.espina-swipe-clip {
  overflow-x: clip !important;
}

/* Generic swipeable table row (<tr>) */
.espina-swipe-row {
  position: relative;
  touch-action: pan-y;
  transition: background-color 140ms ease, opacity 140ms ease;
}
.espina-swipe-row.is-clickable {
  cursor: pointer;
}
.espina-swipe-row.is-swiping {
  user-select: none;
}
.espina-swipe-row.is-swiping > td {
  transform: translateX(var(--swipe-x, 0px));
  transition: none !important;
}
.espina-swipe-row:not(.is-swiping) > td {
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Generic swipeable block/card/list item (<li>, <article>, <div>, <a>, <details>) */
.espina-swipe-item {
  position: relative;
  touch-action: pan-y;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.espina-swipe-item.is-swiping {
  user-select: none;
  transform: translateX(var(--swipe-x, 0px)) !important;
  transition: none !important;
}

/* POS-style solid colored reveal strip uncovered behind the sliding row/card */
.espina-swipe-reveal {
  position: fixed;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
  color: #ffffff;
  transition: background-color 120ms ease;
}
.espina-swipe-reveal > i {
  font-size: 19px;
  line-height: 1;
  transition: transform 130ms cubic-bezier(0.16, 1, 0.3, 1);
}
.espina-swipe-reveal.is-ready > i {
  transform: scale(1.14);
}
.espina-swipe-reveal-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
}
.espina-swipe-reveal[data-tone="danger"] {
  background: #b42331;
}
.espina-swipe-reveal[data-tone="danger"].is-ready {
  background: #951a27;
}
.espina-swipe-reveal[data-tone="success"] {
  background: #157a57;
}
.espina-swipe-reveal[data-tone="success"].is-ready {
  background: #0f5f43;
}
.espina-swipe-reveal[data-tone="accent"] {
  background: var(--ui-accent, #5b4bb7);
  color: var(--ui-on-accent, #ffffff);
}
.espina-swipe-reveal[data-tone="accent"].is-ready {
  background: color-mix(in srgb, var(--ui-accent, #5b4bb7) 84%, #000000);
}

/* Shared drawer swipe-to-dismiss handle + mobile bottom-sheet */
.product-details-drawer[style*="--drawer-drag"] {
  transition: none !important;
}
.product-details-drawer[open] {
  translate: var(--drawer-drag-x, 0px) var(--drawer-drag-y, 0px);
}
.espina-drawer-handle {
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.espina-drawer-handle:active {
  cursor: grabbing;
}

@media (max-width: 640px) {
  .product-details-drawer.espina-sheet-mobile {
    inset: auto 0 0;
    width: 100% !important;
    height: min(90dvh, 760px);
    border-inline-start: 0;
    border-top: 1px solid var(--ui-line);
    border-radius: 22px 22px 0 0;
    translate: 0 100%;
  }
  .product-details-drawer.espina-sheet-mobile[open] {
    translate: 0 var(--drawer-drag-y, 0px);
  }
  @starting-style {
    .product-details-drawer.espina-sheet-mobile[open] {
      translate: 0 100%;
    }
  }
  .product-details-drawer.espina-sheet-mobile .espina-drawer-handle {
    position: relative;
    padding-top: 24px;
  }
  .product-details-drawer.espina-sheet-mobile .espina-drawer-handle::before {
    content: '';
    position: absolute;
    top: 8px;
    left: calc(50% - 19px);
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--ui-muted);
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .espina-swipe-row:not(.is-swiping) > td,
  .espina-swipe-item,
  .espina-swipe-reveal > i {
    transition: none !important;
  }
}
