/**
 * Product Optionals - front styles (trigger button + side panels).
 */

.th-optionals {
  width: 100%;
}

/* --- trigger button ---------------------------------------------------- */

.th-optionals__open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  border-radius: 8px;
}

.th-optionals__open-label {
  font-weight: 700;
}

.th-optionals__open-count {
  font-weight: 700;
}

/* --- shared panel layout ------------------------------------------------ */

.th-optionals-panel,
.th-cart-panel {
  --bs-offcanvas-width: 470px;
  width: min(92vw, 470px);
}

.th-optionals-panel .offcanvas-header,
.th-cart-panel .offcanvas-header {
  border-bottom: 1px solid #ebe9ef;
}

.th-optionals-panel .offcanvas-title,
.th-cart-panel .offcanvas-title {
  display: flex;
  align-items: center;
  color: #2a1a46;
}

/* --- optionals panel ---------------------------------------------------- */

.th-optionals__hint {
  font-size: 0.85rem;
  color: #625182;
  margin-bottom: 0.75rem;
}

.th-optionals__list {
  display: flex;
  flex-direction: column;
}

.th-optionals__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #ebe9ef;
}

.th-optionals__row:last-child {
  border-bottom: 0;
}

.th-optionals__row.is-disabled {
  opacity: 0.45;
}

.th-optionals__row.is-selected {
  background: #f7f5fb;
  border-radius: 10px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.th-optionals__info {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.th-optionals__name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #2a1a46;
  text-decoration: none;
}

.th-optionals__name:hover {
  text-decoration: underline;
}

.th-optionals__ref {
  font-size: 0.78rem;
  color: #9b91ad;
}

.th-optionals__stock {
  font-size: 0.78rem;
  color: #3eb449;
}

.th-optionals__row.is-disabled .th-optionals__stock {
  color: #c0392b;
}

.th-optionals__price {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
  font-size: 0.9rem;
}

.th-optionals__price-value {
  font-weight: 700;
  color: #2a1a46;
}

.th-optionals__price-unit {
  color: #9b91ad;
}

.th-optionals__qty {
  flex: 0 0 74px;
  width: 74px;
}

.th-optionals__qty-input {
  text-align: center;
}

.th-optionals__qty-na {
  display: block;
  text-align: center;
  color: #9b91ad;
}

.th-optionals__footer {
  padding: 1rem;
  border-top: 1px solid #ebe9ef;
  background: #fff;
}

.th-optionals__subtotal {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: #2a1a46;
  margin-bottom: 0.5rem;
}

.th-optionals__subtotal-value {
  color: #e83892;
}

.th-optionals__footer .th-optionals__add.btn-primary {
  --bs-btn-bg: #1ec3a4;
  --bs-btn-border-color: #1ec3a4;
  --bs-btn-hover-bg: #1aa98e;
  --bs-btn-hover-border-color: #1aa98e;
  --bs-btn-active-bg: #178f79;
  --bs-btn-active-border-color: #178f79;
  --bs-btn-disabled-bg: #1ec3a4;
  --bs-btn-disabled-border-color: #1ec3a4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  background-color: #1ec3a4;
  border-color: #1ec3a4;
  border-radius: 8px;
  color: #fff;
}

.th-optionals__footer .th-optionals__add.btn-primary:hover,
.th-optionals__footer .th-optionals__add.btn-primary:focus {
  background-color: #1aa98e;
  border-color: #1aa98e;
  color: #fff;
}

.th-optionals__footer .th-optionals__add.btn-primary:disabled,
.th-optionals__footer .th-optionals__add.btn-primary.disabled {
  background-color: #1ec3a4;
  border-color: #1ec3a4;
  color: #fff;
}

.th-optionals__add.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* Same look as the product page "Adauga in oferta" (.th_quotation_add on the
   gastro shop): green outline, fills green on hover — not Bootstrap primary. */
.th-optionals__footer .th-optionals__quote {
  --bs-btn-color: #1ec3a4;
  --bs-btn-border-color: #1ec3a4;
  --bs-btn-bg: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #1ec3a4;
  --bs-btn-hover-border-color: #1ec3a4;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1aa98e;
  --bs-btn-active-border-color: #1aa98e;
  --bs-btn-disabled-color: #1ec3a4;
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: #1ec3a4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 8px;
  color: #1ec3a4;
  background-color: #fff;
  border-color: #1ec3a4;
}

.th-optionals__footer .th-optionals__quote:hover,
.th-optionals__footer .th-optionals__quote:focus {
  color: #fff;
  background-color: #1ec3a4;
  border-color: #1ec3a4;
}

.th-optionals__quote.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.th-optionals__feedback {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.th-optionals__feedback:empty {
  display: none;
}

.th-optionals__feedback.is-success {
  color: #3eb449;
}

.th-optionals__feedback.is-error {
  color: #c0392b;
}

/* --- cart panel ---------------------------------------------------------- */

.th-cart-panel__added {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  background: #e9f7ea;
  color: #2c8534;
  font-weight: 600;
  font-size: 0.9rem;
}

.th-cart-panel .cart_product_list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.th-cart-panel .cart_product_line_wrapper {
  border-bottom: 1px solid #ebe9ef;
}

.th-cart-panel .cart_product_line {
  align-items: center;
  padding: 0.6rem 0;
}

.th-cart-panel .cart_product_line .product-name {
  font-size: 0.88rem;
  color: #2a1a46;
}

.th-cart-panel .cart_product_price {
  text-align: right;
  font-weight: 600;
  color: #2a1a46;
  white-space: nowrap;
}

.th-cart-panel .th-cart-totals {
  margin-top: 1rem;
}

.th-cart-panel .cart-summary__line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.th-cart-panel__footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #ebe9ef;
  background: #fff;
}

.th-cart-panel__footer .btn {
  width: 100%;
}

/* --- rows already at their per-parent quantity limit --------------------- */

.th-optionals__row.is-maxed {
  opacity: 0.65;
}

.th-optionals__maxed-note {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b3fa0;
}

/* --- "Optional" badge on optional cart lines ---------------------------- */

.th-optional-badge {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.75rem;
  background: #f3eefb;
  color: #6b3fa0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  max-width: 100%;
}

.th-optional-badge .material-icons {
  font-size: 0.9rem;
  line-height: 1;
  flex: 0 0 auto;
  margin-top: 0.08rem;
}
