/* ============================================================
   Cart timer chip — when active, replaces the standalone cart icon
   in the navbar and itself becomes the link to /cart. Single pill
   carries: cart icon + item count + separator + "Complete in MM:SS".

   When inactive (cart empty, no timer): chip is hidden (display:none),
   the standalone .tx-cart-standalone anchor shows as before.

   When active: chip renders as inline-flex AND the standalone cart
   anchor is hidden via .tx-cart-standalone.is-hidden (set by JS).

   Three-state color scheme:
     default  (>60s): amber  — "you have time, but the clock is on"
     warning  (≤60s): coral  — "hurry up"
     critical (≤15s): coral + pulse — "act NOW"
   ============================================================ */
.tx-cart-timer {
  display: none;                 /* JS flips to inline-flex on activate */
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 36px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid #F59E0B;
  color: #F59E0B;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  user-select: none;
  flex-shrink: 0;
  text-decoration: none;          /* it's an <a> now */
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.tx-cart-timer:hover {
  text-decoration: none;
  filter: brightness(1.08);
}
.tx-cart-timer.is-active {
  display: inline-flex;
}

/* Cart icon at the start of the pill */
.tx-cart-timer__icon {
  font-size: 14px;
  line-height: 1;
  color: inherit !important;
}

/* Item count — inline number next to the cart icon. No background pill;
   it would add visual noise (3-color clash with chip border + text).
   Just a bold colored number. */
.tx-cart-timer__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  color: inherit;
  padding: 0 2px;
}

/* Separator dot between count and label */
.tx-cart-timer__sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: currentColor;
  opacity: 0.4;
  margin: 0 2px;
}

.tx-cart-timer__label {
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: inherit !important;
}
.tx-cart-timer .tx-cart-timer__time {
  min-width: 42px;       /* keeps "9:59" → "10:00" from jittering width */
  text-align: right;
  font-weight: 700;
  color: inherit !important;
}

/* When timer is active, hide the standalone cart icon to avoid duplication */
.tx-cart-standalone.is-hidden {
  display: none !important;
}

/* Warning state — last 60 seconds. Coral fill, dark text on the chip
   itself (icon, label, time, separator). Badge stays white with coral
   number. */
.tx-cart-timer.is-warning {
  background: var(--tx-coral) !important;
  color: var(--tx-on-accent, #1a1a1a) !important;
  border-color: var(--tx-coral) !important;
}
.tx-cart-timer.is-warning .tx-cart-timer__icon,
.tx-cart-timer.is-warning .tx-cart-timer__label,
.tx-cart-timer.is-warning .tx-cart-timer__time {
  color: var(--tx-on-accent, #1a1a1a) !important;
}

/* Critical state — last 15 seconds. Coral fill + pulse animation. */
.tx-cart-timer.is-critical {
  background: var(--tx-coral) !important;
  color: var(--tx-on-accent, #1a1a1a) !important;
  border-color: var(--tx-coral) !important;
  animation: tx-cart-timer-pulse 1s ease-in-out infinite;
}
.tx-cart-timer.is-critical .tx-cart-timer__icon,
.tx-cart-timer.is-critical .tx-cart-timer__label,
.tx-cart-timer.is-critical .tx-cart-timer__time {
  color: var(--tx-on-accent, #1a1a1a) !important;
}
@keyframes tx-cart-timer-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(232, 85, 64, 0.5); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(232, 85, 64, 0); }
}

/* Mobile: smaller chip, drop the "Complete in" label and the separator
   so the pill stays compact: [cart] [2] 9:59 */
@media (max-width: 880px) {
  .tx-cart-timer {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    gap: 6px;
  }
  .tx-cart-timer__label,
  .tx-cart-timer__sep { display: none; }
  .tx-cart-timer__icon { font-size: 13px; }
  .tx-cart-timer__count { font-size: 13px; }
}

/* ============================================================
   Expiry-prompt SweetAlert customizations.
   ============================================================ */

/* z-index — online-modal.js uses z-index: 2147483647 (max int) on its
   container. SweetAlert2 v9 defaults to 1060 which renders BEHIND the
   modal. Force SweetAlert to the same max-int level — being painted
   later in the DOM, it'll stack on top. cart-timer.js also closes any
   open online-modal before this fires, but this is the safety net. */
.swal2-container {
  z-index: 2147483647 !important;
}
.swal2-container .swal2-popup {
  z-index: 2147483647 !important;
}

.swal2-popup.tx-swal-popup {
  background-color: var(--tx-card-bg) !important;
  color: var(--tx-text) !important;
  border: 1px solid var(--tx-border) !important;
  border-radius: var(--tx-radius-card, 12px) !important;
  padding: 28px 28px 22px !important;
  font-family: inherit !important;
}

.swal2-popup.tx-swal-popup .swal2-title {
  color: var(--tx-text) !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  margin: 0 0 10px !important;
  padding: 0 !important;
}

.swal2-popup.tx-swal-popup .tx-swal-html,
.swal2-popup.tx-swal-popup .swal2-html-container {
  color: var(--tx-muted) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
}

.swal2-popup.tx-swal-popup .swal2-actions {
  margin-top: 20px !important;
  gap: 10px;
}
.swal2-popup.tx-swal-popup .tx-swal-confirm,
.swal2-popup.tx-swal-popup .tx-swal-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px !important;
  border-radius: 999px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  cursor: pointer;
  border: 1px solid transparent !important;
  line-height: 1 !important;
  margin: 0 !important;
}
.swal2-popup.tx-swal-popup .tx-swal-confirm {
  background: var(--tx-coral) !important;
  color: var(--tx-on-accent, #1a1a1a) !important;
}
.swal2-popup.tx-swal-popup .tx-swal-confirm:hover {
  filter: brightness(0.95);
}
.swal2-popup.tx-swal-popup .tx-swal-cancel {
  background: transparent !important;
  color: var(--tx-text) !important;
  border-color: var(--tx-border-mid, var(--tx-border)) !important;
}
.swal2-popup.tx-swal-popup .tx-swal-cancel:hover {
  background: var(--tx-dropdown-hover) !important;
  border-color: var(--tx-text) !important;
}
body:not(.theme-dark) .swal2-popup.tx-swal-popup .tx-swal-confirm {
  background: var(--tx-coral-deep, #B83A28) !important;
  color: #fff !important;
}

/* Grace bar inside modal */
.tx-cart-grace-bar {
  height: 4px;
  background: var(--tx-search-bg);
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 8px;
}
.tx-cart-grace-bar__fill {
  height: 100%;
  background: var(--tx-coral);
  width: 100%;
  transition: width 0.25s linear;
}
.tx-cart-grace-text {
  font-size: 13px;
  color: var(--tx-muted);
  margin-top: 6px;
  text-align: center;
}

/* Backdrop dim */
.swal2-container.swal2-backdrop-show {
  background-color: rgba(0, 0, 0, 0.55) !important;
}
