/* FILE: includes/lottery-add-to-cart/assets/lottery-add-to-cart.css */

/* Center module */
.phtm-atc-wrap{
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Card */
.phtm-atc-card{
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;          /* compact */
  background: rgba(25,25,25,.92);
  padding: 12px;                /* compact */
  box-sizing: border-box;       /* ✅ safety */
}

/* Tabs – segmented */
.phtm-atc-tabs{
  display: flex;
  width: 100%;
  margin: 0 0 10px;             /* compact */
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;          /* compact */
  overflow: hidden;
}

.phtm-atc-tab{
  flex: 1 1 50%;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 10px;            /* compact */
  cursor: pointer;
  font: inherit;
  font-size: .95em;             /* compact */
  line-height: 1.1;
  opacity: .9;
  text-align: center;
  white-space: nowrap;
}

.phtm-atc-tab + .phtm-atc-tab{
  border-left: 1px solid rgba(255,255,255,.10);
}

.phtm-atc-tab.is-active{
  font-weight: 700;
  opacity: 1;
  background: rgba(255,255,255,.06);
}

.phtm-atc-tab:focus{ outline: none; }
.phtm-atc-tab:focus-visible{
  outline: 2px solid rgba(255,255,255,.30);
  outline-offset: -2px;
}

/* Panels */
.phtm-atc-panels{ width: 100%; }
.phtm-atc-panel[hidden]{ display: none !important; }

/* Slider */
.phtm-atc-slider{
  margin: 0 auto 8px;           /* compact */
  max-width: 520px;
  display: grid;
  gap: 4px;                     /* compact */
}

.phtm-atc-slider-top{
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: baseline;
}

.phtm-atc-range{ width: 100%; }

.phtm-atc-slider-scale{
  display: flex;
  justify-content: space-between;
  opacity: .8;
  font-size: .88em;
}

/* Controls */
.phtm-atc-controls{
  display: grid;
  gap: 8px;                     /* compact */
  justify-items: center;
  width: 100%;
}

.phtm-atc-qty{
  display: inline-flex;
  align-items: center;
  gap: 6px;                     /* compact */
}

.phtm-qty-input{
  width: 78px;                  /* compact */
  text-align: center;
  padding: 6px 8px;             /* compact */
}

/* CTA row (totals ABOVE button) */
.phtm-atc-cta-row{
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 6px;                     /* compact */
}

/* Button fills the row */
.phtm-atc-cta{
  width: 100%;
  max-width: 100%;
}

/* Totals row above the CTA */
.phtm-atc-totals{
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 0;           /* compact */
  opacity: .95;
  font-size: .95em;             /* compact */
}

.phtm-atc-total-left{
  font-size: .95em;
  opacity: .9;
}

.phtm-atc-total-price{
  font-size: 1.05em;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
}

.phtm-atc-total-amount--regular{
  opacity: .55;
  text-decoration: line-through;
  font-weight: 600;
  font-size: .95em;
}

.phtm-atc-total-amount--sale{
  color: #E01A23;
  font-weight: 800;
}

/* Notice styles (hidden unless has a state class) */
.phtm-atc-msg{
  display: none;
  width: 100%;
  text-align: center;
  padding: 8px 10px;            /* compact */
  border-radius: 9px;           /* compact */
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

/* Only show when set to success OR error */
.phtm-atc-msg.is-success,
.phtm-atc-msg.is-error{
  display: block;
}

/* Success (green) */
.phtm-atc-msg.is-success{
  border-color: rgba(70, 200, 120, .35);
  background: rgba(70, 200, 120, .10);
}

/* Error / unavailable / closed / ended / max reached (yellow) */
.phtm-atc-msg.is-error{
  border-color: rgba(230, 190, 90, .45);
  background: rgba(230, 190, 90, .12);
}

/* Hide injected Woo “View cart” beside button */
.phtm-atc-card a.added_to_cart.wc-forward{
  display: none !important;
}

/* Locked button (adds a lock icon) */
.phtm-atc-btn.phtm-is-locked{
  position: relative;
  opacity: .85;
}
.phtm-atc-btn.phtm-is-locked .phtm-atc-cta-text::after{
  content: " 🔒";
}

/* Postal */
.phtm-postal{
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: left;
  width: 100%;
  font-size: 11px;
}

.phtm-postal-address{
  margin: 0;
  white-space: pre-wrap;
  width: 100%;
  max-width: 520px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 12px;
  background: rgba(0,0,0,.18);
}

/* Mobile */
@media (max-width: 520px){
  .phtm-atc-card{ padding: 11px; }  /* compact */
  .phtm-qty-input{
    width: 100%;
    max-width: 220px;
  }
  .phtm-atc-cta{ max-width: 100%; }
}

/* Loading state */
.phtm-atc-btn.is-loading{
  opacity: .9;
  cursor: wait;
}
.phtm-atc-btn.is-loading .phtm-atc-cta-text{
  display: none !important;
}

/* Spinner (hidden by default) */
.phtm-atc-spinner{
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: rgba(255,255,255,.95);
  animation: phtmSpin .75s linear infinite;
  vertical-align: middle;
}
.phtm-atc-btn.is-loading .phtm-atc-spinner{
  display: inline-block;
}

@keyframes phtmSpin{
  to { transform: rotate(360deg); }
}

/* Remove number input arrows (Chrome, Safari, Edge) */
.phtm-atc-qty input[type="number"]::-webkit-outer-spin-button,
.phtm-atc-qty input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

/* Remove number input arrows (Firefox) */
.phtm-atc-qty input[type="number"]{
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Optional: hide blinking cursor */
.phtm-atc-qty input[type="number"]{
  caret-color: transparent;
}

/* ✅ Quick select cards — QTY ONLY (fixed overflow) */
.phtm-atc-quick{
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* ✅ critical */
  gap: 8px;
  margin: 10px auto 6px;
  box-sizing: border-box;
}

@media (max-width: 520px){
  .phtm-atc-quick{
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* ✅ critical */
  }
}

/* Card base */
.phtm-atc-quickBtn{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;                  /* ✅ ensure fits cell */
  max-width: 100%;
  min-width: 0 !important;      /* ✅ beats theme min-width */
  box-sizing: border-box;

  height: 42px;                 /* short, fixed height */
  padding: 0 10px;
  border-radius: 10px;

  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  cursor: pointer;

  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;             /* ✅ safety */
  text-overflow: ellipsis;      /* ✅ safety */
}

/* Theme override for .us-btn-style_2 specifically */
.phtm-atc-quickBtn.us-btn-style_2{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

/* Main text */
.phtm-atc-quickQty{ font-weight: 800; }

/* Change text format: Buy X */
.phtm-atc-quickQty::before{
  content: "Buy ";
  font-weight: 600;
  opacity: .9;
}

/* Remove label entirely */
.phtm-atc-quickLbl{ display: none !important; }

/* ✅ REMOVE discount badge (keep class hidden if old HTML still outputs it) */
.phtm-atc-quickDisc{ display: none !important; }

/* ✅ Active step */
.phtm-atc-quickBtn.is-active{
  border-color: rgba(70, 200, 120, .75);
  background: rgba(70, 200, 120, .12);
  box-shadow:
    0 0 0 1px rgba(70, 200, 120, .35) inset,
    0 6px 14px rgba(0,0,0,.25);
}

/* Slight emphasis on text when active */
.phtm-atc-quickBtn.is-active .phtm-atc-quickQty{
  color: #46c878;
}

/* -----------------------------
 * ADD-TO-CART POPUP (NEW LAYOUT)
 * - Top message: same
 * - Upsells: 4 products stacked
 * - Bottom buttons: View Basket + Close
 * ----------------------------- */

.phtm-pop-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 18px;
}
.phtm-pop-overlay.is-open{ display: flex; }

.phtm-pop{
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  background: #111;
  border: 1px solid rgba(255,255,255,.12);
  padding: 20px 18px;
  text-align: center;
  position: relative;
  color: #afb1bd;
}

/* Topline badge */
.phtm-pop-topline{
  font-weight: 900;
  font-size: 15px;
  line-height: 1.2;
  color: #46c878;
  border: 1px solid #46c878;
  border-radius: 5px;
  padding: 7px 12px;
  background: rgba(70, 200, 120, .14);
}

.phtm-pop-divider{
  height: 1px;
  background: rgba(255,255,255,.12);
  margin: 18px 0 18px;
}

/* Upsell section title */
.phtm-pop-upsell-title{
  font-weight: 800;
  font-size: 14px;
  margin: 10px 0 12px;
  text-align: center;
  text-transform: uppercase;
  font-style: italic;
}

/* Upsells list container */
.phtm-pop-upsells{
  display: grid;
  gap: 12px;
  margin: 0 0 10px;
}

/* Each upsell row: thumb left, content right */
.phtm-upsell-item{
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  box-sizing: border-box;
}

/* ✅ allow grid children to shrink (prevents overflow) */
.phtm-upsell-body{
  text-align: left;
  min-width: 0; /* ✅ critical */
}

.phtm-upsell-thumb{
  display: block;
  width: 74px;
  height: 74px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.phtm-upsell-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.phtm-upsell-title{
  display: block;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  color: #afb1bd;
  text-decoration: none;
  margin-bottom: 4px;

  /* ✅ prevent long titles forcing overflow */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phtm-upsell-title:hover{ text-decoration: underline; }

/* ✅ PRICE (supports sale/regular) */
.phtm-upsell-price{
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  opacity: .9;
  margin-bottom: 8px;
}

.phtm-upsell-price-regular{
  opacity: .55;
  text-decoration: line-through;
  font-weight: 600;
  font-size: 12px;
}

.phtm-upsell-price-sale{
  color: #E01A23;      /* red */
  font-weight: 800;
  font-size: 12px;
}

.phtm-upsell-price-single{
  font-weight: 700;
  font-size: 12px;
}

/* Row under price: [-][input][+][Add] */
.phtm-upsell-row{
  display: grid;
  grid-template-columns: 34px 52px 34px minmax(0, 1fr); /* ✅ critical */
  gap: 8px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.phtm-upsell-qbtn{
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  box-sizing: border-box;
}

.phtm-upsell-qty{
  width: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
  height: 32px !important;
  padding: 0 !important;
  text-align: center !important;
  line-height: 32px !important;
  box-sizing: border-box;
}

/* Add button (per product) */
.phtm-upsell-add{
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;           /* ✅ beat theme min-width */
  min-height: 32px;
  justify-content: center;
  position: relative;
  box-sizing: border-box;

  /* ✅ prevent theme padding from blowing width */
  padding-left: 10px !important;
  padding-right: 10px !important;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Theme override for .us-btn-style_1 specifically */
.phtm-upsell-add.us-btn-style_1{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Spinner used inside per-product add buttons */
.phtm-upsell-spinner{
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: rgba(255,255,255,.95);
  animation: phtmSpin .75s linear infinite;
  vertical-align: middle;
}

/* ✅ loading shows spinner only */
.phtm-upsell-add.is-loading .phtm-upsell-addText{ display: none !important; }
.phtm-upsell-add.is-loading .phtm-upsell-spinner{ display: inline-block; }

/* Locked state */
.phtm-upsell-item.is-locked{ opacity: .75; }
.phtm-upsell-add.phtm-is-locked{ opacity: .85; }
.phtm-upsell-add.phtm-is-locked .phtm-upsell-addText::after{ content: " 🔒"; }

/* Bottom buttons (divider above) */
.phtm-pop-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.phtm-pop-actions .us-btn-style_1,
.phtm-pop-actions .us-btn-style_2{
  width: 100%;
  justify-content: center;
}

/* Mobile */
@media (max-width: 520px){
  .phtm-pop-overlay{ padding: 12px; }
  .phtm-pop{
    padding: 16px 14px;
    max-width: 100%;
    border-radius: 16px;
  }
  .phtm-pop-topline{
    font-size: 14px;
    padding: 8px 10px;
  }
  .phtm-pop-divider{ margin: 16px 0 16px; }

  .phtm-upsell-item{
    grid-template-columns: 64px 1fr;
    gap: 10px;
    padding: 10px;
  }
  .phtm-upsell-thumb{
    width: 64px;
    height: 64px;
    border-radius: 12px;
  }

  .phtm-upsell-row{
    grid-template-columns: 36px 58px 36px minmax(0, 1fr); /* ✅ critical */
    gap: 8px;
  }
  .phtm-upsell-qbtn{
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 34px !important;
  }
  .phtm-upsell-qty{
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
    height: 34px !important;
    line-height: 34px !important;
  }

  .phtm-pop-actions{
    gap: 10px;
    margin-top: 18px;
    padding-top: 18px;
  }
}

/* ================================
 * FIX: upsell - / + / Add overflow
 * Put this at the VERY END of the CSS file
 * ================================ */

/* allow grid items to actually shrink */
.phtm-upsell-row,
.phtm-upsell-row > *{
  min-width: 0 !important;
  box-sizing: border-box;
}

/* kill theme "min-width" + big padding on buttons */
.phtm-upsell-qbtn,
.phtm-upsell-add{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* specifically override theme button classes used on them */
.phtm-upsell-qbtn.us-btn-style_2,
.phtm-upsell-add.us-btn-style_1{
  min-width: 0 !important;
  width: 100% !important;          /* keep inside the grid cell */
  padding-left: 0 !important;       /* stop padding blowing width */
  padding-right: 0 !important;
}

/* keep -/+ as fixed squares no matter what theme does */
.phtm-upsell-qbtn,
.phtm-upsell-qbtn.us-btn-style_2{
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 32px !important;
  padding: 0 !important;
  flex: 0 0 34px !important;        /* extra safety */
}

/* quantity input fixed width */
.phtm-upsell-qty{
  width: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
}

/* Add button is the only one that flexes */
.phtm-upsell-add,
.phtm-upsell-add.us-btn-style_1{
  width: 100% !important;
  min-width: 0 !important;
  padding-left: 10px !important;    /* small safe padding */
  padding-right: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile sizes */
@media (max-width: 520px){
  .phtm-upsell-qbtn,
  .phtm-upsell-qbtn.us-btn-style_2{
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 34px !important;
    flex: 0 0 36px !important;
  }
  .phtm-upsell-qty{
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
  }
}
