/**
 * FYOOL global side cart drawer (fyool.me style)
 */

.fy-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.45);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}

.fy-cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.fy-cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: #fff;
  z-index: 501;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 40px rgba(0, 0, 0, 0.12);
}

.fy-cart-sidebar.open {
  transform: translateX(0);
}

.fy-cs-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.fy-cs-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 22px;
  margin: 0;
  line-height: 1.2;
}

.fy-cs-count {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.fy-cs-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  transition: background 0.2s;
}

.fy-cs-close:hover {
  background: #e5e7eb;
}

/* Free shipping goal */
.fy-cs-goal {
  flex-shrink: 0;
  padding: 16px 24px 0;
}

.fy-cs-goal .cart-goal-wrap {
  text-align: center;
  margin: 0;
}

.fy-cs-goal .cart-goal {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
}

.fy-cs-goal .cart-goal-text {
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}

.fy-cs-goal .cart-goal-text strong {
  font-weight: 700;
}

.fy-cs-goal .fyool-progress {
  --bar-color: #e9e9e9;
  --fill-color: #ffbc11;
  --bar-height: 10px;
  --bar-rounded: 10px;
}

.fy-cs-goal .cart-goal-done .fyool-progress {
  --fill-color: var(--green);
}

.fy-cs-goal .progress-bar-wrap {
  background: var(--bar-color);
  border-radius: var(--bar-rounded);
  height: var(--bar-height);
  overflow: hidden;
}

.fy-cs-goal .progress-bar {
  height: 100%;
  background: var(--fill-color);
  border-radius: var(--bar-rounded);
  transition: width 0.35s ease;
  position: relative;
  min-width: 24px;
}

.fy-cs-goal .progress-value {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fy-cs-goal .progress-value svg {
  width: 9px;
  height: 10px;
  fill: #fff;
}

.fy-cs-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 20px;
}

.fy-cs-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
}

.fy-cs-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.fy-cs-empty-text {
  margin: 0 0 16px;
}

.fy-cart-item {
  display: flex;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.fy-cart-item:last-child {
  border-bottom: none;
}

.fy-ci-img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.fy-ci-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fy-ci-img-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

a.fy-ci-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1px;
  text-decoration: none;
}

a.fy-ci-name:hover {
  color: var(--blue);
}

.fy-ci-info {
  flex: 1;
  min-width: 0;
}

.fy-ci-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1px;
  line-height: 1.3;
}

.fy-ci-name a {
  color: inherit;
  text-decoration: none;
}

.fy-ci-name a:hover {
  color: var(--blue);
}

.fy-ci-variant {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  line-height: 1.35;
}

/* Editable quantity stepper (lines with no add-ons linked). */
.fy-ci-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.fy-ci-qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--muted);
  border: none;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}

.fy-ci-qty-btn:hover:not(:disabled) {
  background: var(--blue-soft);
  color: var(--blue);
}

.fy-ci-qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fy-ci-qty-val {
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  border-left: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
}

.fy-ci-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fy-ci-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

/* Struck regular price shown before the discounted bundle total. */
.fy-ci-was {
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-decoration: line-through;
  margin-right: 3px;
}

.fy-ci-remove {
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.fy-ci-remove:hover {
  color: #ef4444;
}

.fy-ci-remove:disabled {
  cursor: default;
  text-decoration: none;
  color: var(--muted);
  opacity: 0.7;
}

/* In-progress indication while an item is being removed or its quantity is
   updated: fade the row, block further interaction, and overlay a spinner.
   The list re-renders on success. */
.fy-cart-item--removing,
.fy-cart-item--updating {
  position: relative;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.fy-cart-item--removing::after,
.fy-cart-item--updating::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: fy-cart-remove-spin 0.6s linear infinite;
}

@keyframes fy-cart-remove-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading state while the drawer fetches its contents after the cart icon is
   clicked: dim the body and overlay a centred spinner. */
.fy-cart-sidebar.is-loading .fy-cs-body {
  position: relative;
  min-height: 160px;
}

.fy-cart-sidebar.is-loading .fy-cs-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  z-index: 4;
}

.fy-cart-sidebar.is-loading .fy-cs-body::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: fy-cart-remove-spin 0.6s linear infinite;
  z-index: 5;
}

.fy-ci-gift-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9px;
  margin-bottom: 4px;
}

.fy-ci-addon-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9px;
  margin-bottom: 4px;
}

.fy-cart-item--addon {
  border-left: 2px solid #bfdbfe;
  margin-left: 10px;
  padding-left: 10px;
}

.fy-ci-box-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fefce8;
  border: 1px solid #fef08a;
  color: #854d0e;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9px;
  margin-bottom: 4px;
}

.fy-cart-item--box {
  border-left: 2px solid #fef08a;
  margin-left: 12px;
  padding-left: 12px;
}

/* Collapsible bundle add-on group */
.fy-ci-addon-group {
  margin: -2px 0 6px;
}

.fy-ci-addon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 3px 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}

.fy-ci-addon-toggle:hover {
  opacity: 0.8;
}

.fy-ci-addon-chevron::before {
  content: '▸';
  display: inline-block;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.fy-ci-addon-toggle.open .fy-ci-addon-chevron::before {
  transform: rotate(90deg);
}

.fy-ci-addon-group-body[hidden] {
  display: none;
}

.fy-ci-addon-group-body .fy-cart-item {
  padding: 8px 0;
  border-bottom: none;
}

.fy-cs-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.fy-cs-totals {
  margin-bottom: 14px;
}

.fy-cs-subtotal,
.fy-cs-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.fy-cs-subtotal {
  margin-bottom: 6px;
}

.fy-cs-subtotal-lbl,
.fy-cs-total-lbl {
  font-size: 13px;
  color: var(--muted);
}

.fy-cs-subtotal-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.fy-cs-total-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.fy-cs-checkout {
  display: block;
  width: 100%;
  text-align: center;
  background: linear-gradient(90deg, var(--blue), #1477d2);
  color: #fff;
  padding: 15px;
  border-radius: 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s;
}

.fy-cs-checkout:hover {
  opacity: 0.9;
  color: #fff;
}

.fy-cs-continue {
  width: 100%;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  margin-top: 6px;
  border: none;
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
}

.fy-cs-continue:hover {
  opacity: 0.75;
}

.fy-cs-continue--empty {
  margin-top: 0;
}

/* Continue shopping (left) + View cart (right) row under the checkout button. */
.fy-cs-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.fy-cs-actions .fy-cs-continue {
  width: auto;
  margin-top: 0;
  padding: 10px 0;
  text-align: left;
}

.fy-cs-viewcart {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  text-align: right;
  text-decoration: none;
}

.fy-cs-viewcart:hover {
  opacity: 0.75;
  color: var(--blue);
}

/* ── Coupon: toggle, applied chips, and the slide-up form panel ───────── */
.fy-cs-coupon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 0 12px;
}

.fy-cs-coupon-toggle:hover {
  opacity: 0.8;
}

.fy-cs-coupons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.fy-cs-coupon-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-soft, #f0fdf4);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.fy-cs-coupon-code {
  font-weight: 700;
  color: #15803d;
}

.fy-cs-coupon-amt {
  margin-left: auto;
  color: #15803d;
  font-weight: 600;
}

.fy-cs-coupon-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #15803d;
  font-size: 12px;
  line-height: 1;
  padding: 2px;
}

.fy-cs-coupon-remove:hover {
  color: #b91c1c;
}

.fy-cs-coupon-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.12);
  padding: 18px 20px 24px;
  transform: translateY(110%);
  transition: transform 0.3s ease;
  z-index: 6;
}

.fy-cs-coupon-panel.open {
  transform: translateY(0);
}

.fy-cs-coupon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.fy-cs-coupon-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.fy-cs-coupon-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 4px;
}

.fy-cs-coupon-form {
  display: flex;
  gap: 8px;
}

.fy-cs-coupon-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: 'Barlow', sans-serif;
}

.fy-cs-coupon-input:focus {
  outline: none;
  border-color: var(--blue);
}

.fy-cs-coupon-apply {
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--blue), #1477d2);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fy-cs-coupon-apply:hover {
  opacity: 0.9;
}

.fy-cs-coupon-msg {
  font-size: 12px;
  margin-top: 8px;
  min-height: 15px;
}

.fy-cs-coupon-msg.is-success {
  color: #15803d;
}

.fy-cs-coupon-msg.is-error {
  color: #b91c1c;
}

.fy-cs-pay-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
}

.fy-cs-pay-row img {
  max-width: 100%;
  height: auto;
  opacity: 0.85;
}

.fy-csp {
  height: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}


body.fy-cart-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .fy-cart-sidebar {
    width: 100%;
    border-radius: 20px 20px 0 0;
    top: auto;
    max-height: 92vh;
    transform: translateY(100%);
  }

  .fy-cart-sidebar.open {
    transform: translateY(0);
  }
}
