/* Modern theme — NextMerce-inspired overlay on _base (scoped to .theme-modern) */

body.theme-modern {
  --modern-dark: #1c274c;
  --modern-body: #6c6f93;
  --modern-muted: #8d93a5;
  --modern-surface: #f6f7fb;
  --modern-container: 1170px;
  --modern-radius: 10px;
  --modern-radius-lg: 16px;
  --modern-shadow: 0 6px 24px rgba(235, 238, 251, 0.4), 0 2px 4px rgba(148, 163, 184, 0.05);
  background: var(--color-surface-subtle);
  color: var(--modern-dark);
}

body.theme-modern .site-header {
  background: var(--header-background);
  border-bottom: 1px solid #e5e7eb;
}

body.theme-modern .container,
body.theme-modern .header-inner,
body.theme-modern .footer-main {
  max-width: var(--modern-container);
  margin-inline: auto;
}

body.theme-modern .header-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-block: 0.85rem 0;
  grid-template-columns: unset;
  grid-template-areas: unset;
}

body.theme-modern .header-row-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  width: 100%;
  padding-bottom: 0.85rem;
  position: relative;
}

body.theme-modern .header-row-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 1.25rem;
  width: 100%;
  padding: 0.65rem 0 0.85rem;
  border-top: 1px solid #e5e7eb;
}

body.theme-modern .header-center {
  display: contents;
}

body.theme-modern .header-row-primary .logo,
body.theme-modern .header-row-primary .header-search,
body.theme-modern .header-row-primary .header-actions {
  grid-area: unset;
}

body.theme-modern .header-row-primary .logo {
  flex: 0 0 auto;
  order: 1;
  min-width: 0;
  max-width: min(14rem, 42vw);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--modern-dark);
  text-decoration: none;
  line-height: 1.2;
}

body.theme-modern .header-row-primary .logo:hover {
  text-decoration: none;
  color: var(--modern-dark);
}

body.theme-modern .header-row-primary .store-logo {
  display: block;
  max-width: 100%;
  max-height: 3rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

body.theme-modern .header-row-primary .header-search {
  flex: 1 1 14rem;
  order: 2;
  min-width: 0;
  max-width: 28rem;
  width: auto;
}

body.theme-modern .header-row-primary .header-actions {
  flex: 0 0 auto;
  order: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

@media (min-width: 769px) {
  body.theme-modern .header-inner {
    grid-template-columns: unset;
  }

  body.theme-modern .header-row-primary {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) minmax(0, 32rem) minmax(9rem, 1fr);
    align-items: center;
    gap: 1rem 1.5rem;
  }

  body.theme-modern .header-row-primary .logo {
    justify-self: start;
    order: unset;
  }

  body.theme-modern .header-row-primary .header-search {
    order: unset;
    justify-self: center;
    width: 100%;
    max-width: 32rem;
    flex: unset;
    margin-inline: 0;
  }

  body.theme-modern .header-row-primary .header-actions {
    order: unset;
    justify-self: end;
    margin-left: 0;
  }

  body.theme-modern .nav-cart-desktop {
    display: inline-flex;
  }

  body.theme-modern .nav-cart-mobile {
    display: none;
  }
}

body.theme-modern .header-search-form {
  border-radius: 5px;
  border-color: #d1d5db;
  background: #f9fafb;
}

body.theme-modern .header-search-input {
  padding: 0.65rem 0.85rem;
}

body.theme-modern .main-nav > a,
body.theme-modern .nav-products-trigger {
  color: var(--modern-dark);
  font-weight: 500;
}

body.theme-modern .nav-cart {
  border-radius: 5px;
}

body.theme-modern .nav-cart-badge {
  background: var(--primary-color);
}

@media (max-width: 768px) {
  body.theme-modern .header-row-primary .logo {
    max-width: min(11rem, 55vw);
  }

  body.theme-modern .header-row-primary .header-search {
    flex: 1 1 100%;
    order: 4;
    max-width: none;
    margin-inline: 0;
  }

  body.theme-modern .header-row-primary .header-actions {
    order: 2;
  }

  body.theme-modern .site-header:not(.is-nav-open) .header-row-nav {
    display: none;
  }

  body.theme-modern .site-header.is-nav-open .header-row-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.75rem;
  }
}

/* Hero slider — full-width commerce banner */
body.theme-modern .home-hero-slider {
  margin-bottom: 0;
}

body.theme-modern .home-hero-slider-viewport {
  border-radius: var(--modern-radius);
  background: #fff;
  box-shadow: var(--modern-shadow);
}

body.theme-modern .home-hero-slider-image {
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

body.theme-modern .home-hero-slider-nav {
  background: rgba(255, 255, 255, 0.92);
  color: var(--modern-dark);
  border: 1px solid #e5e7eb;
}

body.theme-modern .home-hero-slider-dot.is-active {
  background: var(--primary-color);
}

/* Benefit row */
body.theme-modern .home-benefits {
  margin: 2rem 0 0;
  padding: 1.25rem 1rem;
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
}

body.theme-modern .home-benefits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
}

body.theme-modern .home-benefit {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}

body.theme-modern .home-benefit-icon {
  flex-shrink: 0;
  display: block;
  line-height: 0;
}

body.theme-modern .home-benefit-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--modern-dark);
}

body.theme-modern .home-benefit-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--modern-body);
  line-height: 1.4;
}

@media (min-width: 900px) {
  body.theme-modern .home-benefits-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  body.theme-modern .home-benefits-list {
    grid-template-columns: 1fr;
  }
}

/* Intro hero (when no slider) */
body.theme-modern .hero-panel {
  border-radius: var(--modern-radius);
  background: #fff;
  box-shadow: var(--modern-shadow);
  border: none;
}

body.theme-modern .hero h1 {
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--modern-dark);
}

body.theme-modern .hero .lead {
  color: var(--modern-body);
}

/* Homepage blocks */
body.theme-modern .home-block {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

body.theme-modern .home-block:last-of-type {
  border-bottom: 0;
}

body.theme-modern .home-block-head {
  margin-bottom: 1.35rem;
}

body.theme-modern .home-block-head h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 600;
  color: var(--modern-dark);
}

body.theme-modern .home-block-foot {
  margin: 1.35rem 0 0;
  text-align: center;
}

body.theme-modern .home-block-categories .home-slider-carousel.is-carousel .home-slider-nav {
  margin-top: 2.5rem;
}

body.theme-modern .home-slider-nav {
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(28, 39, 76, 0.72);
  box-shadow: 0 4px 14px rgba(28, 39, 76, 0.18);
}

body.theme-modern .home-slider-carousel.is-static,
body.theme-modern .home-slider-carousel.is-carousel {
  grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
}

@media (max-width: 640px) {
  body.theme-modern .home-slider-carousel.is-static,
  body.theme-modern .home-slider-carousel.is-carousel {
    grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  }
}

body.theme-modern .home-slider-nav:disabled {
  background: rgba(28, 39, 76, 0.14);
  color: rgba(28, 39, 76, 0.38);
  box-shadow: none;
}

body.theme-modern .home-slider-nav:hover:not(:disabled) {
  background: var(--modern-dark);
}

body.theme-modern .home-block-link {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--button-outline-border, #e5e7eb);
  border-radius: 6px;
  background: var(--button-outline-background, #f9fafb);
  color: var(--button-outline-text, var(--modern-dark));
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body.theme-modern .home-block-link:hover {
  background: var(--button-outline-hover-background, var(--modern-dark));
  border-color: var(--button-outline-hover-background, var(--modern-dark));
  color: var(--button-outline-hover-text, #fff);
  text-decoration: none;
}

/* Category circles */
body.theme-modern .home-block-categories .home-slider-item {
  flex: 0 0 8.5rem;
  max-width: 8.5rem;
}

@media (min-width: 641px) {
  body.theme-modern .home-block-categories .home-slider-item {
    flex: 0 0 11rem;
    max-width: 11rem;
  }
}

body.theme-modern .home-block-categories .home-category-card {
  border: none;
  background: transparent;
  box-shadow: none;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

body.theme-modern .home-block-categories .home-category-card:hover {
  box-shadow: none;
}

body.theme-modern .home-block-categories .home-category-image,
body.theme-modern .home-block-categories .home-category-image.media-placeholder {
  width: 7.5rem;
  height: 7.5rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--modern-surface);
  object-fit: cover;
  min-height: 0;
}

body.theme-modern .home-block-categories .home-category-image.media-placeholder {
  display: flex;
  border: 1px dashed color-mix(in srgb, var(--modern-dark) 16%, transparent);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.96) 0%,
    var(--modern-surface) 100%
  );
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  gap: 0.2rem;
}

body.theme-modern .home-block-categories .home-category-image.media-placeholder .media-placeholder-icon {
  width: 1.15rem;
  height: 1.15rem;
}

body.theme-modern .home-block-categories .home-category-name {
  padding: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--modern-dark);
}

body.theme-modern .home-block-categories .home-category-card:hover .home-category-name {
  color: var(--primary-color);
}

/* Product cards */
body.theme-modern .home-slider-item {
  flex: 0 0 min(240px, 72vw);
  max-width: 280px;
  display: flex;
  align-items: stretch;
}

body.theme-modern .home-slider-item > .product-card {
  width: 100%;
  overflow: visible;
}

body.theme-modern .home-slider-item .product-card-link {
  border-radius: var(--modern-radius);
  overflow: hidden;
}

body.theme-modern .product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: none;
  border-radius: var(--modern-radius);
  background: #fff;
  box-shadow: var(--modern-shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.theme-modern .home-slider-item .product-card:hover {
  box-shadow: 0 8px 28px rgba(28, 39, 76, 0.12);
  transform: none;
}

body.theme-modern .product-card:hover {
  box-shadow: 0 8px 28px rgba(28, 39, 76, 0.12);
  transform: translateY(-2px);
}

body.theme-modern .product-card-link {
  color: inherit;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

body.theme-modern .product-card-image {
  aspect-ratio: 1;
  background: var(--modern-surface);
}

body.theme-modern .product-card-image.media-placeholder {
  display: flex;
  border: 1px dashed color-mix(in srgb, var(--modern-dark) 16%, transparent);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.96) 0%,
    var(--modern-surface) 100%
  );
}

body.theme-modern .product-card-body {
  padding: 1rem 1rem 1.1rem;
  min-height: 12rem;
}

body.theme-modern .product-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--modern-dark);
  min-height: calc(2 * 1.35 * 1em);
}

body.theme-modern .badge.sale {
  background: var(--color-sale);
  border-radius: 4px;
  letter-spacing: 0.04em;
}

body.theme-modern .price.current {
  color: var(--primary-color);
  font-weight: 600;
}

body.theme-modern .price.compare {
  color: var(--modern-muted);
}

body.theme-modern .product-card-hints-slot .qty-hint-more {
  color: var(--primary-color);
}

body.theme-modern .product-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.75rem;
}

/* Buttons */
body.theme-modern .btn.primary,
body.theme-modern button[type="submit"]:not(.nav-toggle):not(.qty-stepper-btn):not(.gallery-nav):not(.gallery-thumb):not(.gallery-main-trigger):not(.product-tab-btn):not(.product-lightbox-close):not(.cart-delete-btn):not(.product-card-add-btn):not(.home-hero-slider-nav):not(.home-hero-slider-dot):not(.home-slider-nav) {
  border-radius: 6px;
  font-weight: 600;
}

/* Product detail, cart, checkout */
body.theme-modern .product-detail-grid {
  gap: 2.5rem;
}

body.theme-modern .product-detail-image,
body.theme-modern .gallery-main-image {
  border-radius: var(--modern-radius-lg);
}

body.theme-modern .cart-table,
body.theme-modern .checkout-panel,
body.theme-modern .cart-summary-panel {
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
}

body.theme-modern .checkout-form input,
body.theme-modern .checkout-form textarea,
body.theme-modern .tracking-form input,
body.theme-modern .contact-form input,
body.theme-modern .contact-form textarea {
  border-radius: 6px;
  border-color: #d1d5db;
}

/* Footer */
body.theme-modern .site-footer {
  background: var(--footer-background);
  border-top: 1px solid #e5e7eb;
  color: var(--modern-body);
  margin-top: 2rem;
}

body.theme-modern .footer-main {
  padding-block: 2.75rem 1.75rem;
  gap: 2rem 2.5rem;
}

body.theme-modern .footer-brand .footer-logo {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--modern-dark);
  text-decoration: none;
}

body.theme-modern .footer-brand .footer-logo:hover {
  text-decoration: none;
  color: var(--primary-color);
}

body.theme-modern .footer-description {
  margin: 0;
  line-height: 1.55;
  max-width: 22rem;
}

body.theme-modern .footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

body.theme-modern .footer-nav a {
  color: var(--modern-body);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

body.theme-modern .footer-nav a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

body.theme-modern .footer-legal p {
  margin: 0 0 0.35rem;
  line-height: 1.5;
}

body.theme-modern .footer-bottom {
  border-top: 1px solid #e5e7eb;
  padding-block: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--modern-muted);
}

/* Inner pages */
body.theme-modern .container > h1,
body.theme-modern .product-detail-title {
  color: var(--modern-dark);
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.theme-modern .empty-state-panel,
body.theme-modern .hero-panel,
body.theme-modern .contact-panel,
body.theme-modern .checkout-panel,
body.theme-modern .tracking-panel {
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  border: none;
}

body.theme-modern .cart-table {
  background: #fff;
}

body.theme-modern .cart-totals,
body.theme-modern .cart-grand-total {
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  padding: 1rem 1.25rem;
}

body.theme-modern .btn.secondary {
  border-radius: 6px;
  border-color: var(--button-outline-border, #d1d5db);
  background: var(--button-outline-background, #fff);
  color: var(--button-outline-text, var(--modern-dark));
  font-weight: 600;
}

body.theme-modern .btn.secondary:hover {
  border-color: var(--button-outline-hover-background, var(--modern-dark));
  background: var(--button-outline-hover-background, var(--modern-dark));
  color: var(--button-outline-hover-text, #fff);
}

body.theme-modern .muted,
body.theme-modern .empty-state-title {
  color: var(--modern-body);
}

/* Breadcrumbs */
body.theme-modern .breadcrumbs-list {
  color: var(--modern-muted);
}

/* —— Product detail —— */
body.theme-modern .product-detail-gallery .product-gallery-main {
  background: var(--modern-surface);
  border: none;
  border-radius: var(--modern-radius-lg);
  box-shadow: var(--modern-shadow);
}

body.theme-modern .gallery-nav {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7eb;
  color: var(--modern-dark);
}

body.theme-modern .gallery-thumb {
  border-radius: 6px;
  border-color: #e5e7eb;
}

body.theme-modern .gallery-thumb.is-active {
  border-color: var(--primary-color);
}

body.theme-modern .product-detail-prices .price.current {
  font-size: 1.75rem;
  color: var(--primary-color);
}

body.theme-modern .product-qty-discounts li {
  background: var(--modern-surface);
  border-radius: 6px;
  color: var(--modern-dark);
}

body.theme-modern .product-short-description,
body.theme-modern .product-specification {
  color: var(--modern-body);
}

body.theme-modern .qty-stepper {
  border-radius: 6px;
  border-color: #d1d5db;
}

body.theme-modern .add-to-cart-btn {
  border-radius: 6px;
}

body.theme-modern .product-detail-tabs {
  border-top-color: #e5e7eb;
}

body.theme-modern .product-tab-btn {
  border-radius: 6px;
  color: var(--modern-dark);
}

body.theme-modern .product-tab-btn.is-active {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 10%, white);
  color: var(--primary-color);
}

body.theme-modern .product-video {
  border-radius: var(--modern-radius);
}

/* —— Category & listing —— */
body.theme-modern .category-header {
  padding: 1.25rem 1.5rem;
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  margin-bottom: 1.75rem;
}

body.theme-modern .category-image {
  border-radius: var(--modern-radius);
}

body.theme-modern .category-image.media-placeholder {
  display: flex;
  border: 1px dashed color-mix(in srgb, var(--modern-dark) 16%, transparent);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.96) 0%,
    var(--modern-surface) 100%
  );
}

body.theme-modern .category-nav-thumb.media-placeholder {
  display: flex;
  border: 1px dashed color-mix(in srgb, var(--modern-dark) 16%, transparent);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.96) 0%,
    var(--modern-surface) 100%
  );
}

body.theme-modern .category-description {
  color: var(--modern-body);
}

/* —— Cart & checkout —— */
body.theme-modern .cart-shipping-fieldset,
body.theme-modern .checkout-payment-fieldset,
body.theme-modern .checkout-company-fieldset,
body.theme-modern .checkout-shipping-summary {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  padding: 1rem 1.25rem;
}

body.theme-modern .cart-table th {
  background: var(--modern-surface);
  color: var(--modern-dark);
  font-weight: 600;
}

body.theme-modern .cart-table td {
  border-bottom-color: #f3f4f6;
}

body.theme-modern .cart-page-footer {
  margin-top: 1.25rem;
}

body.theme-modern .cart-checkout-btn {
  min-width: min(100%, 16rem);
}

body.theme-modern .checkout-section-title {
  color: var(--modern-dark);
  font-weight: 600;
}

body.theme-modern .checkout-form-fieldset {
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  padding: 1.25rem 1.5rem;
  border: none;
}

body.theme-modern .checkout-form > label,
body.theme-modern .tracking-form > label,
body.theme-modern .contact-form > label {
  color: var(--modern-dark);
}

body.theme-modern .form-hint {
  color: var(--modern-muted);
}

body.theme-modern .alert {
  border-radius: var(--modern-radius);
}

body.theme-modern .alert.warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

/* —— Contact & tracking —— */
body.theme-modern .store-form-panel {
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  border: none;
  padding: 1.25rem 1.5rem;
}

body.theme-modern .contact-location-card,
body.theme-modern .contact-map-block {
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  border: 1px solid #e5e7eb;
}

body.theme-modern .contact-location-title {
  color: var(--modern-dark);
}

/* —— Dialogs & errors —— */
body.theme-modern .store-dialog-panel {
  border-radius: var(--modern-radius-lg);
  box-shadow: 0 20px 48px rgba(28, 39, 76, 0.18);
}

body.theme-modern .store-dialog-title {
  color: var(--modern-dark);
}

body.theme-modern .error-page {
  background: #fff;
  border-radius: var(--modern-radius);
  box-shadow: var(--modern-shadow);
  max-width: 28rem;
  margin-inline: auto;
}

body.theme-modern .error-page h1 {
  color: var(--modern-dark);
}

/* —— Page spacing —— */
body.theme-modern .container {
  padding-block: 1.75rem 3rem;
}

body.theme-modern .container > h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
}

@media (max-width: 768px) {
  body.theme-modern .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  body.theme-modern .cart-table {
    font-size: 0.88rem;
  }

  body.theme-modern .checkout-form-fieldset,
  body.theme-modern .store-form-panel {
    padding: 1rem;
  }
}
