/* ============================================================
   MIDORI (緑) — extras.css
   Sticky Bar · Size Selector · Volume Discount · Stock Meter · Price Savings
   ============================================================ */

/* ===== Price Savings Badge ===== */
/* Shown when user selects a larger/better-value size */
.price-savings {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #2A7A52;
  background: #D6F0E3;
  border: 1px solid rgba(42,122,82,0.25);
  border-radius: var(--radius-full);
  padding: 3px var(--sp-3);
  margin-top: var(--sp-2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  align-self: flex-start;
  min-height: 1.25rem; /* Reserve space to keep footer height consistent */
}
.price-savings.show {
  opacity: 1;
  transform: translateY(0);
}
/* Featured card (dark bg) variant */
.product-card--featured .price-savings {
  color: var(--color-gold-light);
  background: rgba(201,168,76,0.15);
  border-color: rgba(201,168,76,0.35);
}



/* ===== Sticky Purchase Bar ===== */
.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1500;
  background: var(--color-forest);
  color: var(--color-white);
  padding: var(--sp-3) 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.sticky-bar.visible { transform: translateY(0); }
.sticky-bar.hidden { display: none !important; }

.sticky-bar__close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--color-white);
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}
.sticky-bar__close:hover { background: rgba(255,255,255,0.25); }

@media (max-width: 819px) {
  .sticky-bar__close { top: 12px; transform: none; }
}

.sticky-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}
.sticky-bar__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sticky-bar__name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-cream);
}
.sticky-bar__sub {
  font-size: var(--text-xs);
  color: rgba(245,240,232,0.55);
  letter-spacing: 0.06em;
}
.sticky-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.sticky-bar__offer {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold-light);
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.35);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ===== Size Selector ===== */
.size-selector {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
}
.size-selector__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.size-options { display: flex; gap: var(--sp-2); }

.size-opt {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(74,124,89,0.30);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.size-opt:hover {
  border-color: var(--color-jade);
  color: var(--color-jade);
}
.size-opt.active {
  background: var(--color-jade);
  border-color: var(--color-jade);
  color: var(--color-white);
}
/* Featured card size opt overrides */
.product-card--featured .size-selector__label { color: rgba(245,240,232,0.55); }
.product-card--featured .size-opt {
  border-color: rgba(245,240,232,0.25);
  color: rgba(245,240,232,0.70);
}
.product-card--featured .size-opt:hover {
  border-color: var(--color-gold-light);
  color: var(--color-gold-light);
}
.product-card--featured .size-opt.active {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-white);
}

/* ===== Stock Meter (Miyabi) ===== */
.stock-meter {
  padding: var(--sp-3) var(--sp-4);
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
}
.stock-meter__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
}
.stock-meter__text {
  font-size: var(--text-xs);
  color: rgba(245,240,232,0.70);
  letter-spacing: 0.05em;
}
.stock-meter__count {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-gold-light);
  letter-spacing: 0.04em;
}
.stock-meter__bar {
  height: 4px;
  background: rgba(245,240,232,0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.stock-meter__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
  border-radius: var(--radius-full);
  width: 73%;
  transition: width 1.5s cubic-bezier(0.25,0.46,0.45,0.94);
}
/* Countdown timer on Miyabi */
.miyabi-countdown {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: rgba(245,240,232,0.55);
  margin-top: var(--sp-2);
}
.miyabi-countdown__icon { color: var(--color-gold-light); }
.miyabi-countdown__time { font-weight: 600; color: var(--color-gold-light); }

/* ===== Volume Discount Section ===== */
.volume-discount {
  padding: var(--sp-24) 0;
  background: var(--color-forest);
  position: relative;
  overflow: hidden;
}
.volume-discount::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(201,168,76,0.12), transparent 65%);
  pointer-events: none;
}
.vd-inner {
  text-align: center;
  position: relative;
  z-index: 1;
}
.vd-inner .eyebrow { color: var(--color-gold-light); }
.vd-inner .section-title { color: var(--color-white); margin-bottom: var(--sp-4); }
.vd-inner .section-title em { color: var(--color-gold-light); }
.vd-sub {
  font-size: var(--text-lg);
  color: rgba(245,240,232,0.65);
  margin-bottom: var(--sp-12);
  line-height: 1.7;
}

/* Tier cards */
.vd-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-10);
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}
.vd-tier {
  position: relative;
  background: rgba(245,240,232,0.06);
  border: 1px solid rgba(245,240,232,0.12);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  transition: background var(--ease-med), border-color var(--ease-med), transform var(--ease-med);
}
.vd-tier:hover { background: rgba(245,240,232,0.10); transform: translateY(-4px); }

/* Best value card */
.vd-tier--best {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.40);
  transform: scale(1.05);
}
.vd-tier--best:hover { transform: scale(1.05) translateY(-4px); }

.vd-tier__badge {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--color-gold);
  color: var(--color-white);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px var(--sp-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.vd-tier__qty {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.60);
}
.vd-tier__save-pct {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300;
  color: var(--color-white);
  line-height: 1;
}
.vd-tier--best .vd-tier__save-pct { color: var(--color-gold-light); }
.vd-tier__label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.45);
}
.vd-tier__example {
  font-size: var(--text-xs);
  color: rgba(245,240,232,0.40);
  margin-top: var(--sp-1);
  font-style: italic;
}

.vd-note {
  font-size: var(--text-sm);
  color: rgba(245,240,232,0.45);
  margin-bottom: var(--sp-8);
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 1023px) {
  .vd-tiers { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 819px) {
  .sticky-bar__sub { display: none; }
  .sticky-bar__offer { display: none; }
  .sticky-bar__inner { justify-content: space-between; }

  .vd-tiers {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
  .vd-tier--best { transform: scale(1); }
  .vd-tier--best:hover { transform: translateY(-4px); }
  .vd-tier { padding: var(--sp-6); flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
  .vd-tier__save-pct { font-size: 2rem; }
  .vd-tier__badge { top: auto; left: auto; position: relative; transform: none; margin-bottom: 0; }

  .stock-meter { padding: var(--sp-3); }
}

@media (max-width: 389px) {
  .sticky-bar__actions .btn { padding: var(--sp-2) var(--sp-4); }
}

/* ===== Zalo Floating Button ===== */
.zalo-float {
  position: fixed;
  bottom: calc(var(--sticky-height, 0px) + 100px); /* Well above Feedback */
  right: var(--sp-6);
  z-index: 1000;
  width: 64px;
  height: 64px;
  background: #0084ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 132, 255, 0.4);
  text-decoration: none;
  color: white !important;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8) translateY(20px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.is-feedback-hidden .zalo-float {
  bottom: calc(var(--sticky-height, 0px) + 24px);
}
.zalo-float.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.zalo-float__text {
  font-family: Arial, sans-serif; /* Zalo-like font */
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Pulsing effect */
.zalo-float::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  z-index: -1;
  animation: pulse-zalo 2.5s infinite;
}

@keyframes pulse-zalo {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* Tooltip */
.zalo-float__tooltip {
  position: absolute;
  right: 75px;
  background: white;
  color: var(--color-forest);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
}

.zalo-float:hover .zalo-float__tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Mobile adjustments */
@media (max-width: 819px) {
  .zalo-float {
    right: var(--sp-4);
    width: 60px; height: 60px;
    bottom: calc(var(--sticky-height, 0px) + 90px); /* Stacked above feedback */
  }
  .is-feedback-hidden .zalo-float {
    bottom: calc(var(--sticky-height, 0px) + 24px);
  }
  .zalo-float__text { font-size: 13px; }
  .zalo-float__tooltip { display: none; } /* Hide tooltip on mobile */
}

/* ===== Favorite Button ===== */
.favorite-btn {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08); /* Better visibility on light */
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}
.favorite-btn svg {
  width: 24px;
  height: 24px;
  fill: none; /* Outlined by default */
  stroke: rgba(26,58,42,0.4); /* Faded forest for inactive heart */
  stroke-width: 1.8;
  transition: all 0.3s ease;
}
.favorite-btn:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.favorite-btn.is-active {
  background: rgba(255, 255, 255, 0.9);
  border-color: #ff4757;
  animation: heartRateIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.favorite-btn.is-active svg {
  fill: #ff4757; /* Solid red for active */
  stroke: #ff4757;
}
@keyframes heartRateIn {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Fix Layout Shift in Footer */
.product-card__footer {
  min-height: 36px; /* Footer top height + spacing */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Keep price/button at the absolute bottom */
}
.price-savings {
  display: block;
  min-height: 22px; /* Reserved space above price */
  font-size: 13px;
  color: var(--color-jade);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}
.product-card--featured .price-savings { color: var(--color-gold-light); }

/* ===== Feedback Float Button ===== */
.feedback-group {
  position: fixed;
  bottom: calc(var(--sticky-height, 0px) + 24px);
  right: var(--sp-6);
  z-index: 1100;
  display: flex;
  align-items: center;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}
.feedback-group.hidden {
  display: none;
}
.feedback-float {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--color-white);
  border: 1px solid var(--color-gold-light);
  border-radius: var(--radius-full);
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  cursor: pointer;
  color: var(--color-forest);
  transition: all 0.3s ease;
}
.feedback-dismiss {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--color-white);
  border: 1px solid var(--color-gold-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s ease;
  z-index: 2;
}
.feedback-group:hover .feedback-dismiss {
  opacity: 1;
  transform: scale(1);
}
.feedback-dismiss:hover {
  background: var(--color-background);
  color: var(--color-forest);
}
@media (max-width: 819px) {
  .feedback-group {
    right: var(--sp-4);
    bottom: calc(var(--sticky-height, 0px) + 24px);
  }
  .feedback-float {
    padding: 10px 16px;
  }
  .feedback-dismiss {
    opacity: 1;
    transform: scale(1);
  }
}
.feedback-float__text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.feedback-float svg {
  width: 20px;
  height: 20px;
  color: var(--color-gold);
  flex-shrink: 0;
}
@media (max-width: 819px) {
  .feedback-float {
    right: var(--sp-4);
    bottom: calc(var(--sticky-height, 0px) + 24px);
    padding: 10px 16px;
  }
}

/* ===== Feedback Modal ===== */
/* ===== Feedback Popover (Redesign from Modal) ===== */
.feedback-modal {
  position: fixed;
  bottom: calc(var(--sticky-height, 0px) + 80px);
  right: var(--sp-6);
  z-index: 2000;
  display: block;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(20px);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.feedback-modal.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}
.feedback-modal__content {
  position: relative;
  background: var(--color-white);
  border: 1px solid rgba(74,124,89,0.1);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  width: 360px;
  box-shadow: 0 16px 48px rgba(26,58,42,0.15);
}
@media (max-width: 819px) {
  .feedback-modal {
    right: 10px;
    left: 10px;
    bottom: calc(var(--sticky-height, 0px) + 80px);
  }
  .feedback-modal__content { width: auto; max-width: none; }
}
.feedback-modal__close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-light);
  line-height: 1;
  transition: color 0.2s ease;
}
.feedback-modal__close:hover { color: var(--color-forest); }
.feedback-modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  color: var(--color-forest);
  margin-bottom: var(--sp-6);
  text-align: center;
}
.feedback-section { margin-bottom: var(--sp-6); }
.feedback-section__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-forest);
  margin-bottom: var(--sp-3);
}

/* Custom Checkbox */
.feedback-check-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.feedback-check-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.4;
}
.feedback-check-label input {
  margin-top: 2px;
  accent-color: var(--color-jade);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Rating Stars */
.feedback-rating {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
}
.feedback-star {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  color: var(--color-text-muted);
  transition: transform var(--ease-fast);
}
.feedback-star svg { width: 100%; height: 100%; }
.feedback-star:hover { transform: scale(1.1); }

.feedback-submit {
  width: 100%;
}
