/* ==========================================================================
   xSmart Homepage v2 — Clean card-based layout
   White cards on #ECF8FF background, subtle shadows, professional look
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --x-blue: #3662A1;
  --x-blue-hover: #2a4e80;
  --x-bg: #ECF8FF;
  --x-white: #ffffff;
  --x-text: #111827;
  --x-text-secondary: #6b7280;
  --x-border: #e5e7eb;
  --x-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --x-shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --x-radius: 12px;
  --x-radius-sm: 8px;
  --x-font: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --x-transition: 0.2s ease;
}

/* ---------- Page base ---------- */
.page-home {
  background: var(--x-bg);
  font-family: var(--x-font);
  padding: 0;
}

/* ---------- Shared button ---------- */
.xhome-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--x-blue);
  color: var(--x-white);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--x-radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--x-transition);
}
.xhome-btn:hover {
  background: var(--x-blue-hover);
  color: var(--x-white);
  text-decoration: none;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.xhome-hero {
  background: var(--x-white);
  border-radius: var(--x-radius);
  overflow: hidden;
  box-shadow: var(--x-shadow);
  margin-bottom: 16px;
}
.xhome-hero img {
  width: 100%;
  display: block;
  min-height: 280px;
  object-fit: cover;
}
/* PS imageslider overrides */
.xhome-hero .homeslider,
.xhome-hero .nivoSlider,
.xhome-hero .bx-wrapper,
.xhome-hero .bx-viewport {
  min-height: 280px !important;
}
.xhome-hero .bx-wrapper {
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  background: transparent !important;
}
.xhome-hero .homeslider li {
  min-height: 280px;
}
.xhome-hero .homeslider li img {
  min-height: 280px;
  object-fit: cover;
}
/* Fallback hero */
.xhome-hero__fallback {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #3662A1 100%);
  padding: 60px 40px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.xhome-hero__fallback h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.2;
  max-width: 500px;
}
.xhome-hero__fallback p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.75);
  margin: 0 0 24px;
  max-width: 420px;
}

/* ==========================================================================
   USP BAR
   ========================================================================== */
.xhome-usp {
  background: var(--x-white);
  border-radius: var(--x-radius);
  box-shadow: var(--x-shadow);
  padding: 0;
  margin-bottom: 16px;
  display: flex;
}
.xhome-usp__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--x-text-secondary);
  border-right: 1px solid var(--x-border);
}
.xhome-usp__item:last-child {
  border-right: none;
}
.xhome-usp__item svg {
  color: var(--x-blue);
  flex-shrink: 0;
}
.xhome-usp__item strong {
  font-weight: 600;
  color: var(--x-text);
  white-space: nowrap;
}
.xhome-usp__item span {
  white-space: nowrap;
}

/* ==========================================================================
   PRODUCT SECTIONS (Featured, Recommended, Viewed)
   ========================================================================== */
.xhome-section {
  background: var(--x-white);
  border-radius: var(--x-radius);
  box-shadow: var(--x-shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.xhome-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.xhome-section__header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--x-text);
  margin: 0;
  line-height: 1.3;
}
.xhome-section__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--x-blue);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--x-transition);
}
.xhome-section__link:hover {
  color: var(--x-blue-hover);
  text-decoration: underline;
}

/* Products horizontal scroll */
.xhome-section .products,
.xhome-section .products.row {
  display: flex !important;
  overflow-x: auto !important;
  flex-wrap: nowrap !important;
  gap: 14px !important;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  grid-template-columns: unset !important;
}
/* Product miniature sizing in scroll → see cards.css */

/* Scrollbar */
.xhome-section .products::-webkit-scrollbar {
  height: 4px;
}
.xhome-section .products::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

/* Hide duplicate PS module titles and links */
.xhome-section .featured-products h2,
.xhome-section .new-products h2,
.xhome-section .products-section-title,
.xhome-section [class*="section-title"] {
  display: none !important;
}
.xhome-section .all-product-link {
  display: none !important;
}
.xhome-section .featured-products,
.xhome-section .new-products {
  margin: 0;
  padding: 0;
}

/* Product miniature card styles → see cards.css (SINGLE SOURCE OF TRUTH) */

/* ==========================================================================
   SERVICES
   ========================================================================== */
.xhome-services {
  background: var(--x-white);
  border-radius: var(--x-radius);
  box-shadow: var(--x-shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.xhome-services__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--x-text);
  margin: 0 0 20px;
}
.xhome-services__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.xhome-services__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #f9fafb;
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius);
  padding: 20px 12px;
  text-align: center;
  transition: var(--x-transition);
}
.xhome-services__card:hover {
  border-color: var(--x-blue);
  box-shadow: var(--x-shadow-hover);
  transform: translateY(-2px);
}
.xhome-services__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(54,98,161,0.08);
  border-radius: 50%;
  color: var(--x-blue);
  margin-bottom: 4px;
}
.xhome-services__card strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--x-text);
  line-height: 1.3;
}
.xhome-services__card span {
  font-size: 12px;
  color: var(--x-text-secondary);
  line-height: 1.3;
}

/* ==========================================================================
   CATEGORIES
   ========================================================================== */
.xhome-categories {
  background: var(--x-white);
  border-radius: var(--x-radius);
  box-shadow: var(--x-shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.xhome-categories__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--x-text);
  margin: 0 0 20px;
}
.xhome-categories__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.xhome-categories__item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius);
  padding: 14px 16px;
  text-decoration: none;
  transition: var(--x-transition);
}
.xhome-categories__item:hover {
  border-color: var(--x-blue);
  box-shadow: var(--x-shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
}
.xhome-categories__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(54,98,161,0.08);
  border-radius: var(--x-radius);
  color: var(--x-blue);
  flex-shrink: 0;
}
.xhome-categories__item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--x-text);
  line-height: 1.3;
}
.xhome-categories__item:hover span {
  color: var(--x-blue);
}

/* ==========================================================================
   RESPONSIVE — 1200px
   ========================================================================== */
@media (max-width: 1200px) {
  .xhome-services__grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .xhome-categories__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   RESPONSIVE — 991px
   ========================================================================== */
@media (max-width: 991px) {
  .xhome-categories__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   RESPONSIVE — 768px
   ========================================================================== */
@media (max-width: 768px) {
  .xhome-usp {
    flex-wrap: wrap;
    padding: 0;
  }
  .xhome-usp__item {
    flex: 1 1 50%;
    border-bottom: 1px solid var(--x-border);
    font-size: 12px;
    padding: 10px 12px;
  }
  .xhome-usp__item:nth-child(2) {
    border-right: none;
  }
  .xhome-usp__item:nth-last-child(-n+2) {
    border-bottom: none;
  }
  .xhome-usp__item span {
    display: none;
  }
  .xhome-section {
    padding: 16px;
    margin-bottom: 12px;
  }
  .xhome-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
  }
  .xhome-services__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .xhome-services__card {
    padding: 16px 10px;
  }
  .xhome-categories__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .xhome-hero__fallback {
    padding: 40px 24px;
    min-height: 240px;
  }
  .xhome-hero__fallback h1 {
    font-size: 1.5rem;
  }
}

/* ==========================================================================
   RESPONSIVE — 480px
   ========================================================================== */
@media (max-width: 480px) {
  .xhome-usp {
    flex-direction: column;
  }
  .xhome-usp__item {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--x-border);
    justify-content: flex-start;
    padding: 10px 16px;
  }
  .xhome-usp__item:last-child {
    border-bottom: none;
  }
  .xhome-usp__item span {
    display: inline;
  }
  .xhome-section__header h2 {
    font-size: 16px;
  }
  .xhome-services__title,
  .xhome-categories__title {
    font-size: 16px;
  }
  .xhome-services__grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .xhome-services__icon {
    width: 40px;
    height: 40px;
  }
  .xhome-services__icon svg {
    width: 22px;
    height: 22px;
  }
  .xhome-categories__grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .xhome-hero__fallback h1 {
    font-size: 1.3rem;
  }
  .xhome-hero__fallback p {
    font-size: 0.9rem;
  }
}

/* XS-CARD styles → see cards.css (SINGLE SOURCE OF TRUTH) */
