:root {
  --brand-color: #121f48;
  --brand-light: #24356f;

  /* Tabler variable overrides */
  --tblr-primary: var(--brand-color);
  --tblr-primary-rgb: 18, 31, 72;
}

/*
  Root layout reset
  -----------------
  Fixes a persistent left-side vertical seam caused by a non-zero `margin-left`
  being applied to the root element (`html` was observed at 15px on product pages).
  This forces the document to start at x=0 and prevents horizontal bleed.
*/
html,
body {
  margin: 0 !important;
  padding: 0 !important;
  left: 0 !important;
  transform: none !important;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

/* Tabler overrides and shop-specific styles */
body {
  font-family: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  /* Use Tabler theme variables so `data-bs-theme` (light/dark) actually works. */
  background-color: var(--tblr-body-bg);
  color: var(--tblr-body-color);
}

/* Fix for the vertical line issue: Aggressively remove all borders from layout containers */
.page,
.page-wrapper,
.page-body,
.page-header,
[class*="col-"] {
  border: 0 !important;
  box-shadow: none !important;
}

/* Navbar refinements */
.navbar {
  background-color: var(--brand-color) !important;
  border: 0 !important;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}



/* Hero Section */
.product-hero {
  position: relative;
  overflow: hidden;
  padding: 3rem 0;
  min-height: 550px;
  background-color: var(--tblr-body-bg);
  transition: min-height 0.3s ease;
}

.hero-media {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  /* Mask the image so it fades out on the left, ensuring text readability */
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.2) 10%, black 50%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.2) 10%, black 50%);
}

.hero-media .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 1;
}

[data-bs-theme="dark"] .hero-media .hero-img {
  opacity: 0.8;
}

.product-description {
  position: relative;
  z-index: 2;
  /* Subtle shadow to maintain readability over the more visible hero image */
  text-shadow: 0 1px 8px var(--tblr-body-bg);
}

.product-description h2 {
  letter-spacing: -0.02em;
}

.product-description .text-muted {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--tblr-body-color) !important;
  /* Ensure it's not too muted for readability */
}

.z-index-1 {
  z-index: 1;
}

/* Product List */
.card-img-top-fixed {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

/* Form Selectgroup refinements */
.form-selectgroup-boxes .form-selectgroup-label {
  transition: all 0.15s ease;
  border: 0 !important;
  padding: 0.25rem 0.6rem !important;
  font-size: 0.875rem;
}

.form-selectgroup-boxes .form-selectgroup-label:hover {
  background-color: rgba(var(--tblr-primary-rgb), 0.04);
}

/* Checked state: Light blue background, primary color text */
.form-selectgroup-input:checked+.form-selectgroup-label {
  background-color: rgba(var(--tblr-primary-rgb), 0.08) !important;
  color: var(--brand-color) !important;
}

[data-bs-theme="dark"] .form-selectgroup-input:checked+.form-selectgroup-label {
  background-color: rgba(var(--tblr-primary-rgb), 0.25) !important;
  color: #fff !important;
}

.form-selectgroup-input:checked+.form-selectgroup-label .text-muted,
.form-selectgroup-input:checked+.form-selectgroup-label .small {
  color: inherit !important;
  opacity: 0.8;
}

/* Ensure price and savings stay on one line */
.form-selectgroup-label-content {
  white-space: nowrap;
}

/* Breadcrumb refinements */
.breadcrumb-alternate .breadcrumb-item+.breadcrumb-item::before {
  content: "›";
  font-size: 1.2rem;
  line-height: 1;
  vertical-align: middle;
}

/* Tap-target sizing for breadcrumb links (WCAG 2.5.8 AA) */
.breadcrumb-item a {
  display: inline-block;
  padding: .25rem 0;
  min-height: 24px;
}

/* Configurator Card */
.configurator-card {
  border: 5px solid rgba(var(--tblr-primary-rgb), 0.15) !important;
  border-radius: 0.75rem;
}

[data-bs-theme="dark"] .configurator-card {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Price Box */
.price-box .h2 {
  letter-spacing: -0.03em;
}

/* Utility: Aspect Ratio for images without inline styles */
.ratio-4x3 {
  aspect-ratio: 4 / 3;
}

.object-cover {
  object-fit: cover;
}

/* Toast refinements */
.django-toast-container {
  z-index: 1080;
}

/* FilePond tweaks */
.filepond--root {
  font-family: inherit;
  margin: 0 !important;
  min-height: 250px;
}

.filepond--drop-label {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.artwork-dropzone .filepond--panel-root {
  border-radius: inherit !important;
  background-color: #f6f8fb !important;
}

[data-bs-theme="dark"] .artwork-dropzone .filepond--panel-root {
  background-color: #1d273b !important;
}

/* Animations & Transitions */
.expandable {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out;
  opacity: 0;
  margin-bottom: 0 !important;
}

.expandable.show {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 1rem !important;
}

/* Locker-picker map wrapper (GLS widget requires intrinsic height). */
.locker-map-wrapper {
  height: 600px;
}

/* ============================================
   Navbar Products Dropdown
   ============================================ */

/* Navbar dropdown menu styling */
.navbar-dropdown-menu {
  min-width: 220px;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dropdown items with avatar support */
.navbar-dropdown-menu .dropdown-item.dropdown-item-with-avatar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, padding-left 0.15s ease;
  border-radius: 0;
}


/* Avatar in dropdown - 50x50 size */
.navbar-dropdown-menu .dropdown-item-with-avatar .avatar {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  /* Fallback placeholder color */
  background-color: var(--tblr-bg-surface-secondary);
}

/* Hover state - uniform background */
.navbar-dropdown-menu .dropdown-item:hover {
  background-color: rgba(var(--tblr-primary-rgb), 0.06);
  padding-left: 1.25rem;
}

/* Active state */
.navbar-dropdown-menu .dropdown-item.active,
.navbar-dropdown-menu .dropdown-item:active {
  background-color: rgba(var(--tblr-primary-rgb), 0.1);
  color: var(--brand-color);
}

/* Icon styling in dropdown - smaller, supporting role */
.navbar-dropdown-menu .dropdown-item .nav-link-icon {
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.navbar-dropdown-menu .dropdown-item:hover .nav-link-icon {
  opacity: 1;
}

/* Navbar dropdown trigger */
.navbar .nav-item.dropdown .nav-link.dropdown-toggle {
  cursor: pointer;
}

.navbar .nav-item.dropdown .nav-link.dropdown-toggle::after {
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ============================================
   Cart Icon Redesign
   ============================================ */

/* Larger cart icon */
.cart-icon-lg {
  font-size: 1.375rem;
  line-height: 1;
}

/* Improved cart badge */
.cart-badge-custom {
  font-size: 0.6rem;
  min-width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  line-height: 1;
  border: 0 !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  /* Better visibility */
  background-color: #dc3545 !important;
  color: white !important;
  border-radius: 9999px !important;
  /* Position adjustment - down 2px and left 2px */
  top: 2px !important;
  left: -2px !important;
}

/* ============================================
   User Section Improvements
   ============================================ */

/* User dropdown trigger hover */
.navbar .nav-item.dropdown .nav-link.user-dropdown-trigger {
  border-radius: var(--tblr-border-radius);
  transition: background-color 0.15s ease;
}

.navbar .nav-item.dropdown .nav-link.user-dropdown-trigger:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* User text improvements */
.navbar .nav-item.dropdown .nav-link.user-dropdown-trigger .text-warning {
  font-weight: 500;
  opacity: 0.9;
}

/* Navbar nav links - match cart "Tervem" styling */
.navbar .nav-item .nav-link.link-light {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.navbar .nav-item .nav-link.link-light:hover {
  color: #fff !important;
}

.navbar .nav-item .nav-link.link-light .nav-link-title {
  font-size: inherit;
}

/* Cart and user spacing */
#navbar-cart {
  margin-right: 0.5rem;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

/* Mobile: adjust navbar height considerations */
@media (max-width: 991.98px) {
  .navbar-dropdown-menu {
    border-radius: 0;
    margin-top: 0;
    box-shadow: none;
    position: static !important;
    display: block !important;
    border: 0;
    background: transparent;
    padding-left: 1rem;
  }

  .cart-icon-lg {
    font-size: 1.25rem;
  }
}

/* Small mobile */
@media (max-width: 575.98px) {
  .navbar-brand {
    font-size: 1.1rem;
  }

  .cart-badge-custom {
    min-width: 1.1rem;
    height: 1.1rem;
    font-size: 0.65rem;
  }
}

/* ============================================
   Inline Styles Extracted from base.html
   ============================================ */

/* Dropdown focus state */
.nav-link.dropdown-toggle:focus {
  outline: none;
  box-shadow: none;
}

/* SVG Logo styles */
.navbar-brand-logo .st0 {
  fill: #FFFFFF;
}

.navbar-brand-logo .st1 {
  fill: #001639;
}

/* ============================================
   Price Animation (from product_detail.html)
   ============================================ */

.price-box {
  transition: opacity 0.3s ease-in-out;
}

.price-value {
  transition: transform 0.2s ease-out, color 0.3s ease;
  display: inline-block;
}

.price-value.updated {
  animation: pricePulse 0.4s ease-out;
}

@keyframes pricePulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
    color: #0d6efd;
  }

  100% {
    transform: scale(1);
  }
}

/* ============================================
   Footer Styles
   ============================================ */

.footer {
  background-color: #f7f7f7;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer .footer-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tblr-body-color);
  letter-spacing: -0.01em;
}

.footer .footer-link {
  color: var(--tblr-body-color);
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
  font-size: 0.9rem;
  display: inline-block;
  padding: .25rem 0;
  min-height: 32px;
}

.footer .footer-link:hover {
  opacity: 1;
  color: var(--brand-color);
}

.footer .footer-link.fw-medium {
  font-weight: 500;
  opacity: 0.85;
}

.footer hr {
  opacity: 0.15;
}

/* Footer responsive adjustments */
@media (max-width: 767.98px) {
  .footer .col-4 {
    text-align: center;
  }

  .footer .list-unstyled {
    display: inline-block;
    text-align: left;
  }
}