/* Home Modern Styles - Redesigned UI */

:root {
  --brand: #2e7d71;
  --brand-600: #25655b;
  --accent: #ffb703;
}

body {
  background: #fff;
  color: #111;
  overflow-x: hidden !important;
  max-width: 100vw;
}

html {
  overflow-x: hidden !important;
  max-width: 100vw;
}

.section {
  padding: 3rem 0;
}

.section-title {
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 1.25rem;
  position: relative;
  padding-left: 14px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 4px;
  height: 1.2em;
  background: var(--brand);
  border-radius: 2px;
}

.card-soft {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-brand:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}

.badge-accent {
  background: var(--accent);
  color: #111;
  border-radius: 0.75rem;
}

.mb-30 {
  margin-bottom: 30px;
}

/* HERO */
.carousel-modern .carousel-item {
  height: 430px;
  border-radius: 1rem;
  overflow: hidden;
}

.carousel-modern .carousel-caption {
  bottom: 0;
  left: 0;
  right: 0;
}

.carousel-modern .carousel-caption .box {
  backdrop-filter: blur(2px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.45));
  border-radius: 1rem;
  padding: 1.25rem;
}

.carousel-modern .carousel-caption .box h1,
.carousel-modern .carousel-caption .box h2,
.carousel-modern .carousel-caption .box h3,
.carousel-modern .carousel-caption .box h4,
.carousel-modern .carousel-caption .box h5,
.carousel-modern .carousel-caption .box h6,
.carousel-modern .carousel-caption .box p,
.carousel-modern .carousel-caption .box .display-4 {
  color: #fff !important;
}

/* Carousel Indicators Styling */
.carousel-modern .carousel-indicators {
  bottom: 20px;
  margin-bottom: 0;
}

.carousel-modern .carousel-indicators li {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  margin: 0 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-modern .carousel-indicators li.active {
  width: 30px;
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 1);
}

/* Carousel Controls (Arrows) Styling */
.carousel-modern .carousel-control-prev,
.carousel-modern .carousel-control-next {
  width: 50px;
  height: 50px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.carousel-modern .carousel-control-prev:hover,
.carousel-modern .carousel-control-next:hover {
  opacity: 1;
}

.carousel-modern .carousel-control-prev-icon,
.carousel-modern .carousel-control-next-icon {
  width: 30px;
  height: 30px;
  background-size: 100%;
}

/* OFFERS */
.offer-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.offer-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.offer-card .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.6));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: #fff;
}

.offer-card .overlay h1,
.offer-card .overlay h2,
.offer-card .overlay h3,
.offer-card .overlay h4,
.offer-card .overlay h5,
.offer-card .overlay h6,
.offer-card .overlay p {
  color: #fff !important;
}

/* FEATURES */
.feature-tile {
  border-radius: 1rem;
  padding: 24px;
  background: #f8fafb;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.feature-tile i {
  color: var(--brand);
  font-size: 26px;
}

/* PRODUCT */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 100% !important;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

.product-card .product-img {
  aspect-ratio: 1/1;
  overflow: hidden;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}

.product-card .product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.product-card:hover .product-img img {
  transform: scale(1.05);
}

.product-card > .p-3 {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.product-card > .p-3 > * {
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

.product-card .h6 {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto;
  white-space: normal !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 2.5em;
  max-height: 3.125em !important;
  line-height: 1.25 !important;
  margin-bottom: 0.5rem !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.product-card .h6.d-block {
  display: -webkit-box !important;
}

.product-card .product-action {
  margin-top: auto;
  padding-top: 0.75rem;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.product-card .d-flex {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

.product-card h5 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
}

.product-card .product-action a {
  border-radius: 0.75rem !important;
}

/* Ensure all product cards in a row have equal height */
/* Make columns containing product cards use flexbox */
.section .row > [class*="col-"] > .product-card,
.section .row > [class*="col-"] > .deal-card {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

/* Prevent columns from expanding beyond their grid width */
.section .row {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.section .row > [class*="col-"] {
  min-width: 0 !important;
  overflow: hidden;
  /* Ensure flex items don't grow beyond their basis */
  flex-shrink: 1;
}

/* Apply flexbox to columns that directly contain product cards */
/* Modern browsers with :has() support */
.section .row > [class*="col-"]:has(> .product-card),
.section .row > [class*="col-"]:has(> .deal-card) {
  display: flex;
  flex-direction: column;
}

/* Fallback for older browsers - apply to pb-3 columns (product cards use pb-3) */
/* Cat-card will still work since it has its own internal flex layout */
@supports not selector(:has(*)) {
  .section .row > [class*="col-"].pb-3 {
    display: flex;
    flex-direction: column;
  }

  .section .row > [class*="col-"].pb-3 > a {
    display: flex;
    flex: 1;
  }
}

/* DEAL carousel (strip) */
.deal-carousel .item {
  padding: 6px;
  height: 100%;
  display: flex;
}

.deal-carousel .item > .product-card {
  flex: 1;
}

.deal-card {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  height: 100%;
  width: 100%;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

.deal-card .product-img {
  flex: 0 0 200px;
}

.deal-card > .p-3 {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.deal-card > .p-3 > * {
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

.deal-card .h6 {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto;
  white-space: normal !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 2.5em;
  max-height: 3.125em !important;
  line-height: 1.25 !important;
  margin-bottom: 0.5rem !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.deal-card .h6.d-block,
.deal-card .h6.text-truncate {
  display: -webkit-box !important;
}

.deal-card .deal-price-section {
  margin-top: auto;
}

.badge-off {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ef4444;
  color: #fff;
  border-radius: 50px;
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  z-index: 10;
  white-space: nowrap;
}

/* Deal Price Section - Vertical Layout */
.deal-price-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
}

.price-new {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ef4444;
  line-height: 1.4;
  white-space: nowrap;
}

.price-old {
  font-size: 0.9rem;
  color: #999;
  text-decoration: line-through;
  line-height: 1.3;
  white-space: nowrap;
}

.price-save {
  display: inline-block;
  font-size: 0.875rem;
  color: #16a34a;
  font-weight: 600;
  background: #dcfce7;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Old price styles for backward compatibility */
.price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.price .old {
  color: #999;
  text-decoration: line-through;
  font-size: 0.95rem;
}

.price .new {
  font-weight: 700;
}

.price .save {
  color: #ef4444;
  font-weight: 600;
  font-size: 0.95rem;
}

/* CATEGORIES */
.cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.cat-thumb {
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 0.75rem;
  flex: 0 0 100px;
}

.cat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* VENDOR (giữ nguyên setup Owl) */
.vendor-carousel .bg-light {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-radius: 1rem;
}

.vendor-carousel img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: grayscale(1) opacity(0.7);
  transition: 0.2s;
}

.vendor-carousel img:hover {
  filter: none;
  opacity: 1;
}

/* ===== Product Card Styles (from shop-modern.css) ===== */
.card.product-card {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

.card.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

.product-img {
  position: relative;
  overflow: hidden;
  padding-top: 100%;
  border-radius: 1rem 1rem 0 0;
  background: #eff1f3;
}

.product-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.35s ease;
}

.product-card:hover .product-img img {
  transform: scale(1.04);
}

/* ===== Brand Logo ===== */
.product-brand-logo {
  position: absolute;
  top: 0.875rem;
  left: 0.875rem;
  max-width: 160px;
  min-height: 40px;
  z-index: 2;
  line-height: 0;
}

.product-brand-logo .brand-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.product-brand-logo img {
  height: 28px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0;
  padding: 0;
}

.product-brand-logo img.img-brand-logo {
  margin-top: 5px;
  padding-left: 6px;
  width: 50px !important;
  height: 24px !important;
  max-width: 50px !important;
}

.product-action {
  position: absolute;
  inset: auto 0.75rem 0.75rem auto;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out, visibility 0.18s;
  z-index: 2;
}

.product-card:hover .product-action {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Luôn hiện trên mobile */
@media (max-width: 768px) {
  .product-card .product-action {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

.btn-square {
  width: 42px;
  height: 42px;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: white;
  transition: all 0.2s ease;
}

.btn-square:hover:not(.fav-btn) {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(46, 125, 113, 0.2);
}

.fav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

.fav-btn.active {
  color: #ef4444;
}

.product-card .card-body {
  padding: 0;
}

.product-meta {
  padding: 0.85rem 0.9rem 1rem 0.9rem;
  text-align: center;
}

/* ===== Product Subline (Brand + Category) ===== */
.product-subline {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.product-brand {
  font-weight: 600;
  color: #6b7280;
}

.product-group {
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  border: 1px solid #ececec;
  background: #f9fafb;
  font-size: 0.7rem;
  color: #6b7280;
}

.dot-separator {
  font-size: 0.8rem;
  opacity: 0.6;
  color: #6b7280;
}

.product-title {
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111;
  text-decoration: none;
}

.product-title:hover {
  color: var(--brand);
  text-decoration: none;
}

.price {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.price .now {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111;
}

/* ===== MOBILE-ONLY ELEMENTS - Hidden by default ===== */
.mobile-features-grid,
.mobile-categories-scroll {
  display: none !important;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 991.98px) {
  /* 1. Layout & Spacing */
  .container-fluid.section {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  .container-fluid.mb-3.mt-3 {
    padding-left: 10px;
    padding-right: 10px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .section-title {
    margin-left: 5px !important;
    margin-right: 5px !important;
    font-size: 1.3rem;
  }

  /* 2. Banner/Carousel */
  .carousel-modern .carousel-item {
    height: 60vh !important;
    min-height: 350px;
  }

  .carousel-modern .carousel-caption {
    bottom: 10%;
    padding-bottom: 0 !important;
  }

  .carousel-modern .carousel-caption .box {
    background: rgba(0, 0, 0, 0.7);
    width: 90%;
    padding: 1rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .carousel-modern .display-4 {
    font-size: 2rem;
    font-weight: 800;
  }

  /* 3. Features (Grid 2x2) */
  .desktop-features {
    display: none !important;
  }

  .mobile-features-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 5px;
  }

  .feature-tile-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f8fafb;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px 10px;
  }

  .feature-tile-mobile i {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--brand);
  }

  .feature-tile-mobile h5 {
    font-size: 0.85rem;
    margin: 0;
    font-weight: 600;
    color: #333;
  }

  /* 4. Products (Grid 2 Cột) */
  .mobile-product-col {
    padding-left: 6px !important;
    padding-right: 6px !important;
    margin-bottom: 12px !important;
  }

  .product-meta {
    padding: 8px 4px;
  }

  .product-title {
    font-size: 0.9rem;
  }

  .price .now {
    font-size: 0.95rem;
  }

  .product-subline {
    font-size: 0.65rem;
  }

  /* 5. Categories (Horizontal Scroll) */
  .desktop-categories {
    display: none !important;
  }

  .mobile-categories-scroll {
    display: flex !important;
    overflow-x: auto;
    gap: 10px;
    padding: 5px 5px 15px 5px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mobile-categories-scroll::-webkit-scrollbar {
    display: none;
  }

  .cat-card-mobile {
    flex: 0 0 130px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .cat-thumb-mobile {
    width: 100%;
    height: 90px;
    object-fit: cover;
  }

  .cat-info-mobile {
    padding: 8px 4px;
    text-align: center;
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .cat-info-mobile h6 {
    font-size: 0.8rem;
    margin: 0;
    color: #333;
    font-weight: 600;
    line-height: 1.2;
  }

  .cat-info-mobile small {
    font-size: 0.65rem;
    color: #888;
    display: none;
  }

  /* 6. Offer Cards */
  .offer-card {
    height: 160px !important;
    margin-bottom: 10px !important;
  }

  /* 7. Deal Carousel - Mobile Optimization */
  .deal-carousel .owl-stage-outer {
    padding-left: 5px;
    padding-right: 5px;
  }

  .deal-card {
    min-height: 300px;
  }

  .deal-card .product-img {
    flex: 0 0 160px;
  }

  .badge-off {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .price-new {
    font-size: 1.1rem;
  }

  .price-save {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  /* 8. Additional Mobile Adjustments */
  .section.pt-0 {
    padding-top: 0 !important;
  }

  .product-brand-logo img.img-brand-logo {
    width: 40px !important;
    height: 20px !important;
    max-width: 40px !important;
  }

  /* Reduce padding for row */
  .row.px-xl-5 {
    padding-left: 5px !important;
    padding-right: 5px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Carousel controls on mobile */
  .carousel-modern .carousel-control-prev,
  .carousel-modern .carousel-control-next {
    width: 40px;
    height: 40px;
  }

  .carousel-modern .carousel-control-prev-icon,
  .carousel-modern .carousel-control-next-icon {
    width: 20px;
    height: 20px;
  }

  .carousel-modern .carousel-indicators {
    bottom: 10px;
  }

  /* Vendor carousel on mobile */
  .vendor-carousel .bg-light {
    height: 80px;
  }

  .vendor-carousel img {
    max-height: 60px;
  }
}

/* Desktop Utilities - Hide mobile-only elements on desktop */
@media (min-width: 992px) {
  .mobile-features-grid,
  .mobile-categories-scroll {
    display: none !important;
  }
}
