:root {
  --primary-color: #3b4b94;
  --secondary-color: #8F6B6C;
  --dark-text: #171717;
  --light-text: #6B7280;
  --background-light: #ffffff;
  --white: #ffffff;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition: all 0.3s ease;
}

body {
  background-color: var(--background-light);
  color: var(--dark-text);
}

/* ================= Header Improvements ================= */
.top-bar {
  background: linear-gradient(90deg, #2c3e50, #3b4b94);
  color: #fff;
  padding: 8px 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.top-bar a {
  color: rgba(255, 255, 255, 0.9);
  transition: var(--transition);
}

.top-bar a:hover {
  color: #fff;
  text-decoration: none;
  opacity: 1;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

body.menu-open header {
  z-index: 9999 !important;
}

body.menu-open .mg-slider-section,
body.menu-open .mg-slider-section-home2,
body.menu-open .slick-slider,
body.menu-open main,
body.menu-open footer {
  z-index: 1 !important;
  position: relative;
}

.mg-header-outer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 10px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

.mg-menu-outer li a {
  font-weight: 600;
  color: var(--dark-text);
  padding: 10px 15px;
  border-radius: 6px;
  transition: var(--transition);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
}

.mg-menu-outer li a:hover {
  color: var(--primary-color);
  background-color: rgba(59, 75, 148, 0.05);
}

.header-icons-outer ul li img {
  transition: transform 0.3s ease;
}

.header-icons-outer ul li:hover img {
  transform: scale(1.1);
}

/* Badge for cart count */
.mg-header-icon-counter {
  background: var(--secondary-color) !important;
  top: -8px;
  right: -10px;
  left: auto;
  width: 20px;
  height: 20px;
  font-size: 11px;
  border: 2px solid white;
}

/* ================= Hero Slider Improvements ================= */
.mg-slider-section {
  position: relative;
  overflow: hidden;
}

.mg-slide {
  height: 600px;
  /* Original better height for standard screens */
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #333;
}

.mg-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 1;
}

/* Specific heavy overlay for the 2nd image to make white-text readable */
.mg-slide.slide-dark-overlay::before {
  background: transparent;
}

.mg-slide.slide-dark-overlay {
  background-position: center;
}

/* Fix for potential huge logo */
.mg-logo {
  font-size: 24px !important;
  display: block;
  white-space: nowrap;
}

.mg-slider-text-box {
  position: relative;
  z-index: 2;
}

.mg-slide-text h2 {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  text-transform: none;
  /* Sentence case is more premium */
  animation: fadeInUp 0.8s ease-out forwards;
}

.mg-slide-text p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 30px;
  max-width: 600px;
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
  opacity: 0;
}

.mg-shop-btn {
  background: #ffffff !important;
  color: #000000 !important;
  border: none;
  padding: 14px 45px !important;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  animation: fadeInUp 0.8s ease-out 0.4s forwards;
  opacity: 0;
  display: inline-block;
  overflow: hidden;
  position: relative;
}

.mg-shop-btn::after {
  content: '';
  position: absolute;
  bottom: 13px;
  left: 50%;
  width: 135px;
  /* Further widened to cover text perfectly */
  height: 2px;
  background-color: #000000;
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.mg-shop-btn:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* Category 'View All' Button - Exact CSS from inspector */
.mg-tp-btn a.btn.btn-lg {
  background-color: #000000 !important;
  color: #ffffff !important;
  border-radius: 0 !important;
  padding: 10px 36px !important;
  font-size: 14px !important;
  font-family: 'Sora-Bold', sans-serif !important;
  text-transform: none !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
}

.mg-tp-btn a.btn.btn-lg:hover {
  background-color: var(--primary-color) !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 75, 148, 0.3);
}

.mg-shop-btn:hover {
  background: #f0f0f0 !important;
  color: #000000 !important;
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mg-cart-section {
  padding: 40px 0 !important;
}

/* ================= Product Cards ================= */
.mg-tab-grid-box {
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 25px;
}

.mg-tab-grid-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-color);
  z-index: 5;
  transition: opacity 0.3s ease;
}

.mg-tab-grid-box.category-box::before {
  display: none;
}

.mg-tab-grid-box:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(59, 75, 148, 0.12);
  border-color: rgba(59, 75, 148, 0.2);
}

.mg-tab-img-box {
  overflow: hidden;
  position: relative;
  background: #fdfdfd;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding: 30px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mg-tab-img-box img,
.mg-tabs-img img {
  max-width: 90%;
  max-height: 85%;
  object-fit: contain;
  transition: transform 0.6s ease;
  display: block;
  margin: 0 auto;
}

.mg-tab-grid-box:hover img {
  transform: scale(1.08);
  /* Premium subtle zoom */
  filter: brightness(1) !important;
}

.mg-atc-container {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: #fcfcfc;
}

.mg-cart-box,
.add-to-cart {
  background: var(--dark-text) !important;
  color: #fff !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  padding: 12px !important;
  text-transform: uppercase !important;
  font-size: 13px !important;
  border: none !important;
  transition: all 0.3s ease !important;
}

.add-to-cart:hover {
  background: var(--primary-color) !important;
  transform: scale(1.02);
}

.mg-tab-text {
  padding: 25px !important;
  /* Increased padding */
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.mg-tab-text h5 {
  font-size: 18px;
  /* Slightly larger */
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a1a1a;
  line-height: 1.4;
}

.mg-pricing {
  color: #3b4b94;
  font-size: 19px;
  /* More prominent */
  font-weight: 800;
}

/* Subsection Headings (Category names inside product lists) */
.mg-tp-heading h5 {
  font-size: 32px;
  font-weight: 800;
  color: #1a1a1a;
  position: relative;
  display: inline-block;
  padding-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.mg-tp-heading h5::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--secondary-color);
  border-radius: 2px;
}

/* ================= Features Section ================= */
.mg-feature-overlay-section {
  background: #eef1f7;
  /* Premium subtle themed background */
  padding: 100px 0;
}

.mg-home2-feature-section-heading h5 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 15px;
}

/* Contact Page Header Visibility Fix */
.mg-page-header-section8 .mg-page-header-heading h3,
.mg-page-header-section8 .breadcrumb-item.active {
  color: #171717 !important;
}

.mg-page-header-section8 .breadcrumb-item a {
  color: #555 !important;
}

/* Cart Page Header Visibility Fix */
.mg-page-header-section6 .mg-page-header-heading h3,
.mg-page-header-section6 .breadcrumb-item.active {
  color: #171717 !important;
}

.mg-page-header-section6 .breadcrumb-item a {
  color: #555 !important;
}

/* Cart Typography Enhancements */
.mg-cpd-qty span {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #171717 !important;
}

.mg-cpd-price span {
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #171717 !important;
}

.mg-feature-box .card {
  border: 1px solid rgba(59, 75, 148, 0.05);
  background: #ffffff;
  border-radius: 20px;
  padding: 25px;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.mg-feature-box .card:hover {
  background: white;
  box-shadow: var(--hover-shadow);
  transform: translateY(-5px);
}

.mg-feature-box .card-body {
  padding: 10px;
  box-shadow: none !important;
  /* Override existing */
  background: transparent !important;
}

.mg-feature-box .card-body:hover {
  background: transparent !important;
}

.mg-feature-box img {
  width: 55px;
  height: 55px;
  margin-bottom: 25px;
  filter: invert(24%) sepia(35%) saturate(1966%) hue-rotate(212deg) brightness(96%) contrast(87%);
  /* Sharper primary blue */
}

/* ================= Section Layouts ================= */
.mg-section-padding-large {
  padding: 80px 0;
  /* Reduced from 90px for tighter spacing */
}

/* Tighten the gap specifically between product category sections */
.mg-custome-section+.mg-custome-section {
  padding-top: 0;
}

.mg-bg-themed {
  background-color: #f6f8ff;
  /* Re-adjusted themed tint */
}

.mg-section-heading h5 {
  font-size: 38px;
  font-weight: 800;
  color: #111;
  letter-spacing: -1px;
}

.mg-section-heading span {
  font-size: 16px;
  color: #666;
  max-width: 600px;
  margin: 15px auto 0;
  line-height: 1.6;
}

.mg-tabs-box .nav-tabs .nav-link {
  border-radius: 30px;
  padding: 10px 25px;
  margin: 0 5px;
  border: 1px solid #eee;
  font-weight: 600;
  background: white;
  transition: var(--transition);
}

.mg-tabs-box .nav-tabs .nav-link.active {
  background: var(--dark-text);
  border-color: var(--dark-text);
  color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* --- High-End Popular Categories Overhaul --- */
.mg-popular-categories-section {
  background-color: #eef1f7;
  padding: 100px 0 120px;
  position: relative;
  overflow: hidden;
}

.mg-best-selling-section {
  background-color: #fff !important;
  padding: 80px 0 0px;
  position: relative;
  overflow: hidden;
}

/* Subtle tech-mesh pattern */
.mg-popular-categories-section::after,
.mg-best-selling-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(59, 75, 148, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 75, 148, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.mg-tabs-img {
  height: 250px;
  /* Increased from 200px */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  position: relative;
  padding: 10px;
  /* Reduced from 15px */
  will-change: transform, background-color;
  backface-visibility: hidden;
}

/* Lens flare effect on image container */
.mg-tabs-img::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 40%);
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 2;
}

.mg-tab-grid-box.category-box:hover .mg-tabs-img::before {
  opacity: 0.2;
}

.mg-tabs-img img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.mg-tab-grid-box.category-box {
  text-align: left;
  background: #ffffff;
  padding: 0 !important;
  border-radius: 4px;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  height: 100%;
  /* Stretch to match the tallest card */
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  position: relative;
  will-change: transform, box-shadow;
  backface-visibility: hidden;
}

/* Left-edge brand accent */
.mg-tab-grid-box.category-box::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.mg-tab-grid-box.category-box:hover::after {
  width: 4px;
}

.mg-category-content-wrap {
  padding: 15px 25px 28px;
  /* Slightly tighter vertical padding */
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  /* Expand to fill available height */
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.mg-tab-grid-box.category-box h5 {
  font-size: 17px;
  font-weight: 700;
  text-transform: capitalize !important;
  letter-spacing: 0px;
  margin: 0;
  color: #1a1a1a;
  transition: all 0.3s ease;
  line-height: 1.2;
}

.mg-category-explore {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: capitalize !important;
  letter-spacing: 1px;
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), color 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  will-change: transform, color;
}

.mg-category-explore::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0.5;
}

/* Premium Hover States */
.mg-tab-grid-box.category-box:hover {
  transform: translateY(-12px);
  border-color: rgba(59, 75, 148, 0.15);
  box-shadow: 0 30px 60px rgba(59, 75, 148, 0.12);
}

.mg-tab-grid-box.category-box:hover .mg-tabs-img {
  background: #fafbff;
}

.mg-tab-grid-box.category-box:hover .mg-tabs-img img {
  transform: scale(1.05) rotate(1deg);
}

.mg-tab-grid-box.category-box:hover .mg-category-explore {
  transform: translateX(8px);
  color: var(--primary-color);
}

.mg-tab-grid-box.category-box:hover .mg-category-explore::after {
  width: 100%;
  opacity: 1;
}

/* Utilities */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

/* Global Responsive Fixes */
@media screen and (max-width: 767px) {

  .mg-slider-section.mg-slider-section-home2 .mg-slide,
  .mg-slider-section-home2 .mg-slide,
  .mg-slide {
    height: 250px !important;
    min-height: 250px !important;
  }

  .slide-power {
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
  }

  .mg-slide-text h2 {
    font-size: 24px !important;
    margin-bottom: 10px !important;
  }

  .mg-slide-text p {
    font-size: 13px !important;
    display: none;
  }

  .mg-shop-btn {
    padding: 8px 20px !important;
    font-size: 12px !important;
  }

  /* Responsive section headings */
  .mg-section-heading h2,
  .mg-section-heading h5.display-6 {
    font-size: 26px !important;
    letter-spacing: 2px !important;
  }

  .mg-section-heading p {
    font-size: 14px !important;
  }

  .section-underline {
    width: 60px !important;
    height: 3px !important;
  }

  /* Compact cards for mobile (only for products, not category grid) */
  .mg-tab-grid-box:not(.category-box) .mg-tab-text {
    padding: 15px !important;
  }

  .mg-tab-grid-box:not(.category-box) .mg-tab-img-box {
    padding: 15px !important;
    height: 180px !important;
  }

  .compact-carousel .slick-slide {
    padding: 0 4px !important;
  }

  .mg-custome-section .mg-tab-grid-box {
    margin: 0 4px !important;
  }

  /* Mobile Spacing Reductions */
  .mg-popular-categories-section {
    padding: 60px 0 !important;
  }

  .mg-best-selling-section {
    padding: 60px 0 20px !important;
  }

  .mg-section-heading.mb-5 {
    margin-bottom: 30px !important;
  }

  .mg-tp-heading h5 {
    font-size: 24px !important;
    padding-bottom: 10px !important;
  }

  .mg-section-padding-large {
    padding: 30px 0 !important;
  }

  /* Product page card spacing */
  .mg-grid-filter-section .row>[class*="col-"] {
    margin-bottom: 15px;
  }
}

@media (max-width: 767px) {
  .mg-home2-fetaure-section .mg-feature-box {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Cart page mobile layout */
  .mg-cart-section {
    padding: 5px 0 !important;
  }

  /* Feature cards mobile text size */
  .mg-feature-service .card-title {
    font-size: 15px !important;
    font-weight: 700 !important;
  }

  .mg-feature-service .card-text {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  /* Index page feature cards mobile text size */
  .mg-home2-fetaure-section .card-title {
    font-size: 15px !important;
    font-weight: 700 !important;
  }

  .mg-home2-fetaure-section .card-text {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }
}