:root{
  --to-bg: #def3eef2;
  --to-bg-alt: #DDF7F0;

  --to-primary: #107378;
  --to-text: #0C5A5E;

  --to-track: var(--to-bg);

  --to-border-soft: rgba(16,115,120,.25);
  --to-shadow: 0 0 20px rgba(0,0,0,.2);

  --to-backdrop: rgba(0,0,0,.5);
  --to-modal-bg: rgba(222,243,238,.95);

  --to-white-45: rgba(255,255,255,.45);
}

/* =========================
   Trigger / Button
   ========================= */

.target-offers-trigger-wrap{
  padding: 0 !important;
  background: var(--to-bg-alt) !important;
}

.woo_grid_compact .target-offers-trigger-wrap{
  width: 40px;
  height: 40px;
  line-height: 36px;
  margin-left: .2rem;
  margin-right: .2rem !important;
}

.target-offers-button,
.target-offers-button--img{
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

.target-offers-button--img{
  margin: 0;
  cursor: pointer;
  object-fit: contain;
}

/* =========================
   Modal
   ========================= */

.target-offers-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.target-offers-modal__backdrop{
  position: absolute;
  inset: 0;
  background: var(--to-backdrop);
}

.target-offers-modal__content{
  position: relative;
  width: 90vw;
  max-width: 900px;
  margin: 15vh auto;
  max-height: 80vh;

  padding: 20px;
  border-radius: 10px;
  background: var(--to-modal-bg);
  box-shadow: var(--to-shadow);

  overflow: auto;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.target-offers-modal__close{
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.target-offers-modal__title{
  margin: 0 0 15px;
  font-size: 18px;
  font-weight: 600;
  color: var(--to-text);
}

/* Hide embedded titles */
.target-offers-embedded__title,
.to-products-wrapper-title{
  display: none !important;
}

/* =========================
   Form
   ========================= */

.target-offers-form label{
  display: block;
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--to-text);
}

.target-offers-form :is(
  input[type="text"],
  input[type="email"],
  input[type="number"],
  textarea,
  .iti__tel-input
){
  width: 100%;
  height: 44px;
  padding: 8px 10px;

  border: 1px solid var(--to-primary);
  border-radius: 8px;
  background: transparent;

  font: inherit;
  box-sizing: border-box;
}

.target-offers-form textarea{
  height: 130px;
  min-height: 130px;
  resize: none;
}

.target-offers-form :is(
  input[type="text"],
  input[type="email"],
  input[type="number"],
  textarea,
  .iti__tel-input
):focus{
  outline: 0;
  border-color: var(--to-text);
  box-shadow: 0 0 0 2px rgba(16,115,120,.15);
}

/* Remove number spinners */
.target-offers-form input[type="number"]::-webkit-outer-spin-button,
.target-offers-form input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}
.target-offers-form input[type="number"]{
  -moz-appearance: textfield;
}

/* Layout */
.target-offers-form .to-form-row{
  display: flex;
  flex-wrap: wrap;
  margin: 0 -7.5px 12px;
}

.target-offers-form .to-form-col{
  flex: 0 0 50%;
  max-width: 50%;
  padding: 0 7.5px;
  margin: 0;
  box-sizing: border-box;
}

.target-offers-form__feedback{
  margin-top: 10px;
  color: #DC2626;
  font-size: 14px;
}

.target-offers-form__actions{
  margin-top: 15px;
  text-align: center;
}

.target-offers-form__actions :is(.button,.button-primary){
  padding: 15px 20px;
  border-radius: 8px !important;

  background: var(--to-primary) !important;
  border: 1px solid var(--to-primary) !important;
  color: #fff !important;

  font-size: 17px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
}

.target-offers-form__actions :is(.button,.button-primary):is(:hover,:focus){
  outline: 0;
  filter: brightness(.95);
}

/* =========================
   Phone (intl-tel-input)
   ========================= */

.target-offers-phone-input{
  margin-bottom: 12px;
}

.target-offers-phone-input .iti{
  width: 100%;
  display: block;
  position: relative;
}

.target-offers-phone-input .iti__country-list{
  z-index: 10000;
}

.target-offers-phone-input .iti__flag,
.target-offers-phone-input .iti__country-name{
  display: none !important;
}

.target-offers-phone-input .iti__dial-code{
  font-weight: 600;
  color: var(--to-text);
}

.target-offers-phone-input .iti__flag-container{
  position: absolute;
  inset: 0 auto 0 0;

  display: flex;
  align-items: center;
  padding: 0 10px;

  border-right: 1px solid var(--to-border-soft);
  background: var(--to-white-45);
  border-radius: 8px 0 0 8px;

  z-index: 1;
}

.target-offers-phone-input .iti__selected-country{
  padding: 0 !important;
}

.target-offers-phone-input .iti .iti__tel-input{
  padding-left: 80px !important;
}

/* =========================
   Products wrapper (scroll)
   ========================= */

.to-products-wrapper{
  margin-bottom: 20px;
  max-height: 25vh;

  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Modal: give products area more room */
.target-offers-modal__content .to-products-wrapper{
  max-height: 35vh;
}

/* =========================
   Product row + buttons
   ========================= */

.to-product-row{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.to-product-row .to-field{
  flex: 1 1 0;
  min-width: 140px;
}

.to-field--qty,
.to-field--price{
  max-width: 140px;
}

.to-product-row__add,
.to-product-row__remove{
  min-width: 44px;
  min-height: 44px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--to-primary);
  border-radius: 8px;

  background: var(--to-primary);
  color: #fff;

  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.to-product-row__add:hover,
.to-product-row__remove:hover{
  filter: brightness(.95);
}

/* =========================
   Search results (dropdown + portal)
   ========================= */

.to-field--part{
  position: relative;
}

.to-search-results{
  max-height: 260px;
  overflow: auto;

  display: none;
  list-style: none;
  margin: 0;
  padding: 0;

  background: var(--to-primary);
  border: 1px solid var(--to-primary);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,.08);

  -webkit-mask-image: -webkit-radial-gradient(white,black);
}

.to-search-results__item{
  padding: 10px 12px;
  cursor: pointer;

  color: #fff;
  line-height: 1.3;

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

  border-top: 1px solid rgba(255,255,255,.18);
}

.to-search-results__item:first-child{
  font-weight: 600;
}

.to-search-results__item:hover,
.to-search-results__item.is-active{
  background: rgba(255,255,255,.10);
}

/* Portal dropdown: fixed + above any overflow */
.to-search-results--portal{
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000000;
  display: none;
}

/* =========================
   Unified scrollbars
   ========================= */

.target-offers-modal__content,
.to-products-wrapper,
.to-search-results,
.target-offers-form textarea{
  scrollbar-color: var(--to-primary) var(--to-track);
  scrollbar-width: thin;
}

.target-offers-modal__content::-webkit-scrollbar,
.to-products-wrapper::-webkit-scrollbar,
.to-search-results::-webkit-scrollbar,
.target-offers-form textarea::-webkit-scrollbar{
  width: 10px;
}

.target-offers-modal__content::-webkit-scrollbar-track,
.to-products-wrapper::-webkit-scrollbar-track,
.to-search-results::-webkit-scrollbar-track,
.target-offers-form textarea::-webkit-scrollbar-track{
  background: var(--to-track);
  border-left: 1px solid var(--to-border-soft);
  border-radius: 10px;
}

.target-offers-modal__content::-webkit-scrollbar-thumb,
.to-products-wrapper::-webkit-scrollbar-thumb,
.to-search-results::-webkit-scrollbar-thumb,
.target-offers-form textarea::-webkit-scrollbar-thumb{
  background: var(--to-primary);
  border-radius: 10px;
  border: 2px solid var(--to-track);
}

.target-offers-modal__content::-webkit-scrollbar-button,
.to-products-wrapper::-webkit-scrollbar-button,
.to-search-results::-webkit-scrollbar-button,
.target-offers-form textarea::-webkit-scrollbar-button{
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

/* =========================
   Success popup
   ========================= */

.target-offers-success-popup{
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}

.target-offers-success-popup__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.target-offers-success-popup__box{
  position: relative;
  max-width: 420px;
  margin: 20vh auto 0;

  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 20px 22px;

  text-align: center;
}

.target-offers-success-popup__message{
  margin: 0 0 16px;
  font-size: 15px;
}

.target-offers-success-popup__ok{
  display: inline-block;
  min-width: 120px;
  padding: 8px 18px;

  border: 0;
  border-radius: 4px;

  background: #0A875A;
  color: #fff;

  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.target-offers-success-popup__ok:hover{
  opacity: .92;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 768px){
  .target-offers-modal__content{
    width: 98vw;
    max-height: 84vh;
    margin: 6vh auto;
    padding: 16px;
  }
}

@media (max-width: 600px){
  .target-offers-form .to-form-row{
    margin: 0 0 12px;
  }

  .target-offers-form .to-form-col{
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0;
    margin-bottom: 12px;
  }

  .to-products-wrapper{
    max-height: 55vh;
  }

  .target-offers-modal__content .to-products-wrapper{
    max-height: 50vh;
  }

  .to-product-row{
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    grid-template-areas:
      "part part part"
      "qty price action";
    gap: 10px;
    align-items: end;
  }

  .to-product-row .to-field{
    min-width: 0;
  }

  .to-product-row .to-field--part{ grid-area: part; }
  .to-product-row .to-field--qty{
    grid-area: qty;
    max-width: none;
  }
  .to-product-row .to-field--price{
    grid-area: price;
    max-width: none;
  }

  .to-product-row__add,
  .to-product-row__remove{
    grid-area: action;
    justify-self: end;
  }
}
