/* =========================================================
   TREOW VARIANT POPUP – PREMIUM UI (UPDATED FINAL v7.3)
   File: ti-variant-popup-1001.css
========================================================= */

/* ===============================
   ROOT / GLOBAL
=============================== */
:root{
  --ti-bg: #f7f5f2;
  --ti-card: #ffffff;
  --ti-text: #0f172a;
  --ti-muted: rgba(15,23,42,0.65);
  --ti-border: rgba(15,23,42,0.10);

  --ti-brand: #111827;
  --ti-brand-soft: rgba(17,24,39,0.06);

  --ti-danger: #ff3b30;
  --ti-warning: #ff8c00;

  --ti-radius: 16px;
  --ti-radius-lg: 18px;
  --ti-shadow: 0 14px 30px rgba(15,23,42,0.12);
  --ti-shadow-soft: 0 10px 22px rgba(15,23,42,0.08);

  --ti-btn-h: 48px;
}

*{ box-sizing: border-box; }

/* Prevent iOS zoom on inputs */
input, select, textarea{
  font-size: 16px;
}

/* ===============================
   INLINE TRIGGER (Choose Variants)
=============================== */
.ti-variant-inline{
  margin-bottom: 14px;
  transition: opacity .2s ease;
}

.tiVariantTopLabel{
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(15,23,42,0.70);
  letter-spacing: .2px;
}

.tiVariantBox{
  cursor: pointer;
}

.tiVariantBox .variant-btn{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 5px;
  background: #fff;
  transition: all .25s ease;
}

.tiVariantBox:hover .variant-btn{
  border-color: rgba(15,23,42,0.18);
  box-shadow: 0 14px 30px rgba(15,23,42,0.10);
}

.tiVariantBtnText{
  font-size: 14px;
  font-weight: 800;
  color: var(--ti-text);
}

.variant-btn-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(15,23,42,0.04);
}

/* ===============================
   VARIANT BOX COLOR STATE
=============================== */

/* Default card */
.tiVariantBox .variant-btn{
  background: #fafafa;
  color: var(--ti-text);
  border-color: rgba(15,23,42,0.10);
  transition: all .25s ease;
}

/* ✅ All variants selected */
.tiVariantBox.ti-variant-complete .variant-btn{
  background: #E36631;
  color: #ffffff;
  border-color: #ffff;
}

/* Text color */
.tiVariantBox.ti-variant-complete .tiVariantBtnText{
  color: #ffffff;
}

/* Icon background (optional polish) */
.tiVariantBox.ti-variant-complete .variant-btn-icon{
  background: rgba(255,255,255,0.15);
}



/* ===============================
   OVERLAY
=============================== */
.ti-overlay{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.58);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  z-index: 9997;
}

.ti-overlay.active{
  opacity: 1;
  visibility: visible;
}

/* ===============================
   POPUP BASE (Mobile bottom sheet)
=============================== */
/* =========================================================
   RESPONSIVE TREOW POPUP (v2.1)
   Fully sticky bottom, padded inner content, scroll-safe
========================================================= */

.ti-popup {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -110%;
  width: 100%;
  max-height: 86vh; /* keeps it below full height */
  background: var(--ti-bg, #f7f5f2);
  border-radius: 18px 18px 0 0;
  z-index: 9998;
  overflow: hidden;
  box-shadow: 0 -18px 60px rgba(15,23,42,0.25);
  transition: bottom 0.32s ease;
  padding: 10 !important;

  /* Safety for all screens */
  display: flex;
  flex-direction: column;
}

.ti-popup.active {
  bottom: 0;
}

/* Disable background scroll when popup open */
body.ti-popup-open {
  overflow: hidden;
  touch-action: none; /* Prevents mobile scroll bleed */
}

/* Inner scrollable container */
.ti-popup-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 24px; /* top, left/right, bottom */
  background: transparent !important;

  /* Smooth scroll */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Prevent content from touching edges */
.ti-popup-container > * {
  margin-left: auto;
  margin-right: auto;
  max-width: 600px; /* keeps centered layout on large phones */
  width: 100%;
}

/* Sticky bottom footer inside popup */
.ti-premium-foot--sticky {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--ti-bg, #f7f5f2);
  padding: 14px 16px 20px;
  border-top: 1px solid rgba(15,23,42,0.06);
}

/* Scrollbar improvements */
.ti-popup-container::-webkit-scrollbar {
  width: 6px;
}
.ti-popup-container::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.15);
  border-radius: 3px;
}

/* =========================================================
   RESPONSIVE ADJUSTMENTS
========================================================= */

/* Small Phones (<= 375px) */
@media (max-width: 375px) {
  .ti-popup-container {
    padding: 16px 12px 22px;
  }
  .ti-premium-foot--sticky {
    padding: 12px 12px 18px;
  }
}

/* Medium Phones (376px – 480px) */
@media (min-width: 376px) and (max-width: 480px) {
  .ti-popup-container {
    padding: 18px 14px 24px;
  }
}

/* Tablets (481px – 991px) */
@media (min-width: 481px) and (max-width: 991px) {
  .ti-popup-container {
    padding: 20px 18px 26px;
  }
  .ti-premium-foot--sticky {
    padding: 14px 18px 22px;
  }
}

/* Desktop Mode (>= 992px) – convert to side panel if desired */
@media (min-width: 992px) {
  .ti-popup {
    top: 0;
    bottom: auto;
    left: -460px;
    right: auto;
    width: 460px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transition: left 0.32s ease;
    box-shadow: 14px 0 70px rgba(15,23,42,0.22);
  }

  .ti-popup.active {
    left: 0;
  }

  .ti-popup-container {
    padding: 22px 20px 30px;
  }
}


/* ===============================
   PREMIUM LAYOUT WRAPPER
=============================== */
.ti-premium-layout{
  display: flex;
  flex-direction: column;
  height: 85vh;
  max-height: 85vh;

  /* ✅ required for absolute footer */
  position: relative;
}

@media (min-width: 992px){
  .ti-premium-layout{
    height: 100vh;
    max-height: 100vh;
  }
}

/* ===============================
   PREMIUM HEADER (Sticky)
=============================== */
.ti-premium-head--sticky{
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ti-bg);
  padding: 12px 0 12px;
  border-bottom: 1px solid rgba(15,23,42,0.06);
}

.ti-premium-head__top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ti-premium-title{
  font-size: 16px;
  font-weight: 900;
  color: var(--ti-text);
  line-height: 1.25;
  max-width: 82%;
}

/* Header close button */
.ti-premium-close{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.12);
  background: #fff;
  color: var(--ti-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
  margin: 0;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}

.ti-premium-close:hover{
  transform: translateY(-1px);
  border-color: rgba(15,23,42,0.18);
  box-shadow: 0 14px 28px rgba(15,23,42,0.12);
}

/* Selected summary */
.ti-premium-selected{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ti-premium-selected__dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ti-danger);
  flex: 0 0 auto;
}

.ti-premium-selected.is-selected .ti-premium-selected__dot{
  background: #22c55e;
}

.ti-premium-selected__text{
  font-size: 13px;
  font-weight: 800;
  color: rgba(15,23,42,0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.ti-premium-body--scroll{
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 0px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* ✅ reserve space for footer + injected price */
  padding-bottom: 160px;
}

/* Remove Woo default borders */
.ti-premium-body table.variations,
.ti-premium-body table.variations tbody,
.ti-premium-body table.variations tr,
.ti-premium-body table.variations th,
.ti-premium-body table.variations td{
  border: none !important;
}

/* Attribute cards */
.ti-premium-body .variations tr{
  display: block;
  padding: 14px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  margin-bottom: 14px;
}

.ti-premium-body .variations th.label{
  display: block;
  padding: 0;
  margin: 0 0 10px;
}

.ti-premium-body .variations th.label label{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .2px;
  text-transform: uppercase;
  color: rgba(15,23,42,0.72);
}

/* Select dropdown (fallback) */
.ti-premium-body select{
  width: 100%;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.12);
  padding: 0 12px;
  background: #fff;
  font-weight: 800;
  outline: none;
}

/* ===============================
   SWATCHES (XStore)
=============================== */
.ti-premium-body .variable-items-wrapper{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mobile: swatches single line */
.ti-premium-body .variable-items-wrapper{
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.ti-premium-body .variable-item{
  position: relative;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.10);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  color: rgba(15,23,42,0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
  user-select: none;

  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ti-premium-body .variable-item:hover{
  transform: translateY(-1px);
  border-color: rgba(15,23,42,0.18);
  box-shadow: 0 14px 28px rgba(15,23,42,0.12);
  color: #111827;
}

.ti-premium-body .variable-item.selected{
  border-color: var(--ti-brand);
  box-shadow: 0 0 0 2px rgba(17,24,39,0.12);
  color: #111827;
}

.ti-premium-body .variable-item.disabled{
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.ti-premium-body .variable-item.selected::after{
  content: "✓";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--ti-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pending required highlight */
.ti-premium-body .variations tr.ti-pending-attr{
  border-color: rgba(255, 140, 0, 0.55) !important;
  box-shadow: 0 12px 26px rgba(255, 140, 0, 0.12) !important;
}

.ti-premium-body .variations tr.ti-pending-attr th.label label::after{
  content: "Required";
  margin-left: 8px;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 140, 0, 0.12);
  color: rgba(255, 140, 0, 1);
}

/* Hide default Woo ATC inside popup */
.ti-popup .woocommerce-variation-add-to-cart,
.ti-popup .quantity,
.ti-popup .single_add_to_cart_button:not(.ti-foot-atc){
  display: none !important;
}

/* ===============================
   FOOTER: ONE LINE (RESET + CONFIRM + CLOSE)
   Always bottom pinned inside popup
=============================== */
/* ===============================
   FOOTER: ONE LINE (RESET + CONFIRM + CLOSE)
   Always bottom pinned inside popup
=============================== */
/* =========================================
   FOOTER FULL WIDTH (IGNORE POPUP PADDING)
========================================= */
.ti-premium-foot--sticky{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #fff;
  border-radius: 0px;
  border-top: 1px solid rgba(15,23,42,0.08);

  margin-left: -15px !important;
margin-right: -15px !important;
width: calc(100% + 30px) !important;


  /* ✅ Footer internal padding (buttons ko space mile) */
  padding: 20px 12px calc(20px + env(safe-area-inset-bottom)) !important;

  box-sizing: border-box;
}

/* =========================================
   FOOTER ROW (NO EXTRA SIDE PADDING)
========================================= */
.ti-footbar-row-compact{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;

  /* ✅ remove old padding */
  padding: 0 !important;
}

/* Reset fixed */
.ti-footbar-row-compact .ti-reset-btn-01{
  flex: 0 0 auto;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(17,24,39,0.06);
  color: #111827;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

/* Reset hidden */
.ti-reset-hidden{
  display: none !important;
}

/* Confirm expands/shrinks */
.ti-footbar-row-compact .ti-variant-confirm-btn{
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .2px;
  cursor: pointer;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Confirm inactive */
.ti-footbar-row-compact .ti-variant-confirm-btn--inactive{
  background:#ccc;
  color: #fafafa;
}

/* Confirm active */
.ti-footbar-row-compact .ti-variant-confirm-btn--active{
  background: #E36631;
  color: #ffffff;
}

/* Close fixed */
.ti-footbar-row-compact .ti-mini-icon-btn{
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.12);
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ti-footbar-row-compact .ti-mini-icon-btn:hover{
  border-color: rgba(15,23,42,0.18);
  box-shadow: 0 12px 26px rgba(15,23,42,0.10);
}

/* Desktop: hide footer close button */
@media (min-width: 992px){
  .ti-footbar-row-compact .ti-mini-icon-btn{
    display: none !important;
  }
}

/* Mobile: hide header close button */
@media (max-width: 768px){
  .ti-premium-head__top .ti-premium-close{
    display: none !important;
  }
}