:root {
  --palette-1: #EFECE3; /* very light cream */
  --palette-2: #8FABD4; /* light blue */
  --palette-3: #4A70A9; /* primary accent (blue) */
  --palette-4: #000000; /* black */

  --accent: var(--palette-3);
  --text-primary: #1b1f2a;
  --text-muted: #5f677a;
  --brand-bg: var(--palette-1);
  --page-bg: #f8f9fb;
  --card-radius: .75rem;
  --product-image-height: 260px; /* adjust globally */
}

html, body { height: 100%; background: var(--page-bg); font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; color: var(--text-primary); }

/* Product discount badge - góc trên trái */
.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  color: white;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  font-weight: 700;
  font-size: 0.75rem;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(255, 65, 108, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ===== DESIGN 1: Sản phẩm mặc định (không giảm giá) ===== */
.product-card-normal .card {
  border: 1px solid rgba(0,0,0,0.06);
  transition: all 0.3s ease;
}

.product-card-normal .card:hover {
  border-color: var(--palette-3);
  box-shadow: 0 8px 24px rgba(74, 112, 169, 0.15);
}

.product-card-normal .normal-price .badge-price {
  background: var(--palette-3);
}

/* ===== DESIGN 2: Sản phẩm có giảm giá ===== */
.product-card-discount .card {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, rgba(255, 65, 108, 0.3), rgba(255, 75, 43, 0.2)) border-box;
  transition: all 0.3s ease;
  position: relative;
}

.product-card-discount .card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--card-radius);
  padding: 2px;
  background: linear-gradient(135deg, rgba(255, 65, 108, 0.15), rgba(255, 75, 43, 0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-card-discount .card:hover::before {
  opacity: 1;
}

.product-card-discount .card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(255, 65, 108, 0.25), 
              0 0 0 1px rgba(255, 65, 108, 0.1);
}

.product-card-discount .discount-price .badge-price {
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  box-shadow: 0 4px 12px rgba(255, 65, 108, 0.3);
}

/* Product price wrapper - đồng nhất chiều cao cho tất cả sản phẩm */
.product-price-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 42px;
  gap: 2px;
}

/* Cards */
.card { border-radius: var(--card-radius); box-shadow: 0 6px 16px rgba(18,38,63,0.06); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 12px 30px rgba(18,38,63,0.12); }

/* Add a subtle border to cards for visual separation */
.card-border { border: 1px solid rgba(0,0,0,0.06); }

/* Product image sizing — remove inline styles in HTML and use class */
.product-img { height: var(--product-image-height); object-fit: contain; width: 100%; display: block; background: linear-gradient(180deg, #fff, #f6f8fb); }

/* Ensure card bodies have a minimum height so cards align in a grid */
.card-body-min { min-height: 160px; }

/* Price badge */
.badge-price { background: var(--accent); color: #fff; font-weight: 700; padding: .45rem .8rem; border-radius: 999px; }

/* Price display improvements */
#modalProductPriceContainer {
  border-left: 3px solid var(--palette-3);
  background: rgba(74, 112, 169, 0.03);
  border-radius: 0.5rem;
  padding: 1rem;
}

.modal-price-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 60px;
  justify-content: center;
}

#modalProductPrice .badge-price {
  font-size: 1.35rem !important;
  padding: 0.5rem 1rem;
}

/* Footer background handling */
.footer-bg { height: 220px; object-fit: cover; width: 100%; }
.card-img-overlay.footer-overlay { background: rgba(0,0,0,0.55); }

/* Small utilities */
.text-muted-strong { color: #6c757d; }
.text-muted { color: var(--text-muted) !important; }

/* Focus outlines to aid accessibility */
.btn:focus { outline: 3px solid rgba(13,110,253,0.18); outline-offset: 2px; }
.nav-link:focus { outline: none; }

/* Make offcanvas header visually consistent */
.offcanvas-header .btn-close { filter: invert(1); opacity: .9; }

/* Navbar (header) styles using palette */
.site-navbar { background: linear-gradient(90deg, var(--palette-1), var(--palette-2)); }
.site-navbar .navbar-brand { color: var(--palette-4); font-size: 1.6rem; letter-spacing: .5px; }
.site-navbar .nav-link { color: var(--palette-4); }
.site-navbar .nav-link.active { font-weight: 700; color: var(--palette-4); background: transparent; }
.site-navbar .btn-outline-light { border-color: rgba(0,0,0,0.08); color: var(--palette-4); background: transparent; }
.site-navbar { padding: 1.25rem 0; }

/* Playful brand + navbar animation */
.brand-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--palette-4);
  padding: .2rem .65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  box-shadow: 0 6px 16px rgba(74,112,169,0.18);
  transition: transform .25s ease, box-shadow .25s ease;
}
.brand-logo::before {
  content: "36";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--palette-3);
  color: #fff;
  font-weight: 800;
  margin-right: .35rem;
}
.brand-logo:hover {
  transform: translateY(-2px) rotate(-1deg) scale(1.02);
  box-shadow: 0 10px 24px rgba(74,112,169,0.25);
}

.site-navbar .nav-link {
  position: relative;
  transition: all .25s ease;
}
.site-navbar .nav-link::after {
  content: "";
  position: absolute;
  left: .5rem;
  right: .5rem;
  bottom: .15rem;
  height: 3px;
  border-radius: 999px;
  background: var(--palette-3);
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity .25s ease, transform .25s ease;
}
.site-navbar .nav-link:hover {
  transform: translateY(-2px);
}
.site-navbar .nav-link:hover::after,
.site-navbar .nav-link.active::after {
  opacity: .9;
  transform: scaleX(1);
}
.site-navbar .nav-link:active {
  transform: translateY(0) scale(0.98);
}

/* Dropdown toggle specific styles */
.site-navbar .dropdown-toggle::after {
  border-top-color: var(--palette-3);
  border-bottom-color: var(--palette-3);
}
.site-navbar .dropdown-toggle:focus {
  outline: none;
  box-shadow: none;
}

/* Footer styles reflecting header visual language */
.site-footer { background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(138,164,196,0.2)); color: var(--palette-4); border-radius: var(--card-radius); box-shadow: 0 6px 18px rgba(74,112,169,0.06); width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; }
.site-footer .footer-grid { align-items: flex-start; }
.site-footer .footer-col { display: flex; flex-direction: column; gap: .4rem; }
.site-footer h6 { font-weight: 700; letter-spacing: .2px; }
.site-footer .footer-text { max-width: 260px; }
.site-footer .footer-link { color: var(--palette-4); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.site-footer .footer-link:hover { text-decoration: underline; }
.site-footer .palette { margin-left: .25rem; }
.site-footer .footer-bottom { row-gap: .75rem; }
.palette .swatch { display: inline-block; width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.06); }
.swatch-1 { background: var(--palette-1); }
.swatch-2 { background: var(--palette-2); }
.swatch-3 { background: var(--palette-3); }
.swatch-4 { background: var(--palette-4); }

/* Responsive tweak: slightly reduce product image height on small screens */
@media (max-width: 576px) {
  :root { --product-image-height: 200px; }
}

/* Small utility to ensure long text wraps and doesn't overflow */
.text-wrap-break { word-break: break-word; overflow-wrap: break-word; }

/* Floating contact widget */
.contact-float { position: fixed; right: 18px; bottom: 24px; z-index: 1300; }
.contact-btn { width: 52px; height: 52px; border-radius: 50%; background: var(--palette-3); color: #fff; border: none; box-shadow: 0 6px 18px rgba(74,112,169,0.18); font-size: 1.1rem; }
.contact-panel { width: 220px; background: #fff; border-radius: .5rem; position: absolute; right: 0; bottom: 64px; }
.contact-panel h6 { color: var(--palette-3); }

/* Reviews cards styling */
#reviews .card { border: 1px solid rgba(0,0,0,0.05); border-radius: .6rem; }
#reviews .text-warning { color: var(--palette-3); font-size: 1rem; }

/* Responsive: ensure navbar collapse shows cart and search correctly */
@media (max-width: 767px) {
  .site-navbar .navbar-brand { font-size: 1.05rem; }
  .product-img { height: 200px; }
}

/* Reviews slide-in animation from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.review-item {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.review-item:hover {
  transform: translateX(-5px);
}

.review-item .card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* ===== Cart Offcanvas Styles ===== */
.offcanvas-body {
  padding: 1.25rem;
}

/* Custom close button for cart */
.btn-close-custom {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  color: var(--palette-4);
}

.btn-close-custom:hover {
  background: rgba(74, 112, 169, 0.15);
  transform: rotate(90deg) scale(1.1);
}

.btn-close-custom:active {
  transform: rotate(90deg) scale(0.95);
}

.btn-close-custom i {
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.btn-close-custom:hover i {
  color: var(--palette-3);
}

/* Empty cart icon animation */
.empty-cart-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(239, 236, 227, 0.5), rgba(143, 171, 212, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: emptyCartPulse 2s ease-in-out infinite;
}

.empty-cart-icon i {
  font-size: 3.5rem;
  color: var(--palette-3);
  opacity: 0.7;
}

@keyframes emptyCartPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(74, 112, 169, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 15px rgba(74, 112, 169, 0);
  }
}

/* Promo card in empty cart */
.promo-card {
  transition: all 0.3s ease;
  animation: promoSlideUp 0.5s ease 0.3s backwards;
}

@keyframes promoSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.promo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(74, 112, 169, 0.15) !important;
}

.cart-item {
  transition: all 0.2s ease;
  animation: cartItemFadeIn 0.3s ease;
}

@keyframes cartItemFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cart-item:hover {
  background: rgba(74, 112, 169, 0.03);
  border-radius: 0.5rem;
  padding: 0.5rem;
  margin: -0.5rem;
  margin-bottom: 0.75rem;
}

.cart-item-img {
  transition: transform 0.2s ease;
}

.cart-item:hover .cart-item-img {
  transform: scale(1.05);
}

#cartFooter {
  background: rgba(239, 236, 227, 0.3);
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 0 -1.25rem -1.25rem;
  padding-top: 1.25rem;
}

/* Dropdown menu animation - đồng nhất với header */
.dropdown-menu {
  animation: dropdownSlideIn 0.2s ease;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 6px 16px rgba(74,112,169,0.12);
  padding: 0.5rem;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  transition: all 0.2s ease;
  position: relative;
  padding: 0.5rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 0.375rem;
}

.dropdown-item:last-child {
  margin-bottom: 0;
}

.dropdown-item:hover {
  background: rgba(74, 112, 169, 0.08);
  color: var(--palette-3);
  transform: translateX(3px);
}

.dropdown-item.active {
  background: rgba(74, 112, 169, 0.1);
  color: var(--palette-3);
  font-weight: 600;
  border-left: 3px solid var(--palette-3);
  padding-left: calc(1rem - 3px);
}

.dropdown-divider {
  margin: 0.5rem 0;
  border-color: rgba(0,0,0,0.08);
}