:root {
  --font-body: 'Outfit', sans-serif;
  --font-bangla: 'Hind Siliguri', sans-serif;
  --primary-color: #00e510;
  --secondary-color: #00b80d;
  --hover-color: #00b80d;
  --accent-secondary: #ffb300;
  --button-bg: #00e510;
  --button-hover: #0a0a0a;
  --body-bg: #ffffff;
  --bg-color: var(--body-bg, #ffffff);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --white: #ffffff;
  --border-light: #e2e8f0;
  --transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none !important;
  user-select: none;
  -webkit-user-drag: none;
  caret-color: transparent;
}

input, textarea, select, [contenteditable="true"] {
  user-select: text;
  caret-color: auto;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font-body), var(--font-bangla), system-ui, sans-serif;
  background-color: var(--body-bg, var(--bg-color));
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  position: relative;
  /* Offset for fixed header (matches .revel-header height + safe area) */
  padding-top: calc(env(safe-area-inset-top, 0px) + 1.15rem + 42px + 1.15rem);
}

a {
  text-decoration: none;
  color: inherit;
}

/* Header Base — fixed so it stays visible on all viewports (sticky breaks when html/body use overflow-x: hidden) */
.revel-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding-bottom: 1.15rem;
  padding-top: calc(1.15rem + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  user-select: none;
  cursor: default;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 3.5rem; /* Slightly reduced for better fit */
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  min-width: 0;
}

/* Desktop header: grid keeps search and nav in separate columns (no overlap) */
@media (min-width: 769px) {
  .revel-header .container {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0 clamp(0.75rem, 2vw, 1.5rem);
    align-items: center;
    justify-content: stretch;
  }

  .revel-header .logo {
    grid-column: 1;
  }

  .revel-header .search-container {
    grid-column: 2;
    flex: unset;
    max-width: min(500px, 100%);
    width: 100%;
    margin: 0 auto;
    justify-self: center;
    min-width: 0;
  }

  .revel-header .header-right {
    grid-column: 3;
    flex: unset;
    justify-content: flex-end;
    min-width: 0;
  }
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  min-width: 130px;
  flex-shrink: 0;
  cursor: pointer;
}

.logo img {
  height: 42px !important;
  width: auto !important;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.logo-text {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--primary-color) !important;
}

/* Header Right Area */
.header-right {
  display: flex;
  align-items: center;
  gap: 2.25rem; /* Balanced gap */
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

/* Search Box (Desktop) */
.search-container {
  flex: 1;
  max-width: 500px;
  margin: 0 1.5rem;
}

.search-container input {
  width: 100%;
  padding: 0.8rem 1.5rem 0.8rem 3.5rem;
  border-radius: 50px;
  border: 1px solid var(--border-light);
  font-size: 0.95rem;
  background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2.5' stroke='%2394a3b8' %3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z' /%3E%3C/svg%3E") no-repeat 18px center;
  background-size: 18px;
  height: 48px;
  transition: var(--transition);
  color: var(--text-dark);
}

/* Main Menu (Desktop) - No Wrap Fix */
.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.75rem; /* Reduced to fit on one line */
  align-items: center;
  flex-shrink: 0;
}

.nav-link {
  font-weight: 700;
  font-size: 0.95rem; /* Reduced font size to prevent wrapping */
  color: var(--text-dark);
  transition: var(--transition);
  white-space: nowrap; /* Forces one line always */
  cursor: pointer;
}

.nav-link:hover {
  color: var(--secondary-color) !important;
}

/* Actions Icons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem; /* Reduced gap */
  flex-shrink: 0;
}

.header-action-btn {
  font-size: 1.4rem; /* Slightly smaller icons */
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  color: var(--primary-color) !important;
}

.header-action-btn:hover {
  color: var(--secondary-color) !important;
  transform: translateY(-2px);
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--secondary-color) !important;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Visibility Classes */
.mobile-only { display: none; }

/* Mobile drawer menu — dark panel, white type (desktop unchanged) */
/* Panel height ends above fixed bottom dock so nav stays visible below */
@media (max-width: 992px) {
  :root {
    --mobile-dock-h: 68px;
  }
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  left: 0;
  bottom: calc(var(--mobile-dock-h, 68px) + env(safe-area-inset-bottom, 0px));
  width: min(88vw, 340px);
  max-width: 100%;
  height: auto;
  max-height: none;
  background: linear-gradient(165deg, #0f0f0f 0%, #050505 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  transform: translateX(-105%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

.mobile-menu-overlay.active .mobile-menu-content {
  transform: translateX(0);
}

.mm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mm-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mm-logo-img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

.mm-logo-text {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 1.1;
}

.mm-tagline {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.mm-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mm-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--secondary-color, #fff);
}

.mm-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
  margin-right: -4px;
}

.mm-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.45);
  margin: 18px 0 10px 4px;
}

.mm-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mm-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.15s ease;
  border: 1px solid transparent;
}

.mm-link:active {
  transform: scale(0.98);
}

.mm-link:hover,
.mm-link:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  outline: none;
  border-color: rgba(255, 255, 255, 0.06);
}

.mm-ico {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--secondary-color, #ffb300);
}

.mm-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.mm-chevron {
  font-size: 0.65rem;
  opacity: 0.35;
  flex-shrink: 0;
}

.mm-link-cat .mm-ico {
  font-size: 0.9rem;
}

.mm-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  margin: 18px 0;
}

.mm-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mm-foot-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 12px 4px;
}

.mm-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mm-soc {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.05rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mm-soc:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--secondary-color, #fff);
  border-color: rgba(255, 255, 255, 0.2);
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 1400px) {
  .nav-menu { gap: 1rem; }
  .nav-link { font-size: 0.9rem; }
}

@media (max-width: 1200px) {
  .revel-header .search-container {
    max-width: min(350px, 100%);
  }
  .revel-header .header-right {
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  body {
    padding-top: calc(env(safe-area-inset-top, 0px) + 0.85rem + 38px + 0.85rem);
  }
  .revel-header {
    padding-bottom: 0.85rem;
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
  }
  .container { padding: 0 1rem; }
  .logo {
    min-width: 0;
    max-width: 48%;
    flex-shrink: 1;
  }
  .logo img { height: 38px !important; max-width: 100%; }
  .header-right { flex: 1; gap: 0; min-width: 0; justify-content: flex-end; }
  .header-actions { gap: clamp(0.75rem, 3vw, 1.5rem); flex-shrink: 1; min-width: 0; }
  .header-action-btn { font-size: clamp(1.1rem, 4.2vw, 1.4rem); }
}

/* AJAX Search UI */
.search-container { position: relative; }
.search-results-dropdown { 
  position: absolute; top: calc(100% + 8px); left: 0; width: 100%; 
  background: #fff; border-radius: 20px; 
  box-shadow: 0 15px 40px rgba(0,0,0,0.15); 
  z-index: 9999; display: none; padding: 10px 0; 
  border: 1px solid rgba(0,0,0,0.05); 
  max-height: 420px; overflow-y: auto;
}
.s-result-item { 
  display: flex; align-items: center; gap: 15px; 
  padding: 12px 20px; text-decoration: none; 
  transition: 0.2s; border-bottom: 1px solid #f8f9fa; 
  color: #111; 
}
.s-result-item:last-child { border-bottom: none; }
.s-result-item:hover { background-color: #f8f9fa; }
.s-result-img { width: 45px; height: 45px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid #eee; flex-shrink: 0; }
.s-result-info { flex: 1; min-width: 0; }
.s-result-name { font-weight: 800; font-size: 0.9rem; line-height: 1.2; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #111; }
.s-result-meta { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.s-result-price { color: #00af4c; font-weight: 900; }
.s-result-old { color: #bbb; text-decoration: line-through; display: none; }
.s-result-cat { color: #888; font-weight: 700; text-transform: uppercase; font-size: 0.6rem; padding: 2px 6px; background: #f0f0f0; border-radius: 4px; margin-left: auto; }

@media (min-width: 1200px) {
    .s-result-old { display: inline; }
}

/* Mobile Search — full-screen panel (slides in from the right). Desktop: hidden. */
@media (min-width: 993px) {
  .mobile-search-modal {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mobile-search-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: #fff;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mobile-search-modal.active {
  transform: translateX(0);
}

.msearch-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(14px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.msearch-top {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
}

.msearch-back {
  flex: 0 0 44px;
  width: 44px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msearch-form {
  flex: 1;
  min-width: 0;
}

.msearch-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1.5px solid var(--primary-color, #ff6600);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  min-height: 48px;
}

.msearch-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 12px 12px;
  font-family: var(--font-body), var(--font-bangla), sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
}

.msearch-input-wrap input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.msearch-submit {
  flex: 0 0 auto;
  padding: 0 16px;
  border: none;
  background: var(--primary-color, #ff6600);
  color: #fff;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: var(--font-body), var(--font-bangla), sans-serif;
}

.msearch-quick-scroll {
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.msearch-quick-scroll::-webkit-scrollbar {
  display: none;
}
.msearch-quick-inner {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 4px 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.msearch-quick-sep {
  color: #cbd5e1;
  user-select: none;
}
.msearch-quick-link {
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
}
.msearch-quick-link:active {
  color: var(--primary-color, #ff6600);
}

.msearch-discovery {
  margin-bottom: 12px;
}
.msearch-discovery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.msearch-discovery-title {
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
}
.msearch-hide-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 4px;
  font-family: var(--font-body), var(--font-bangla), sans-serif;
}

.msearch-chips-wrap.is-hidden {
  display: none;
}

.msearch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.msearch-chip {
  display: inline-block;
  padding: 10px 14px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.msearch-chip:active {
  background: #e2e8f0;
}

.ms-results-container.msearch-results-ajax {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fafafa;
  border-radius: 12px;
  padding: 8px 0;
  margin-top: 4px;
}

.msearch-empty {
  padding: 28px 16px;
  text-align: center;
  color: #64748b;
  font-weight: 700;
  font-size: 0.95rem;
}

@media (max-width: 992px) {
  .ms-results-container.msearch-results-ajax .s-result-item {
    padding: 12px 14px;
  }
}

/* --- Performance: reserve space + stable layout for product thumbnails (pairs with width/height on <img>) --- */
.product-card .p-image-area img,
.archive-grid .p-image-area img,
.p-related-grid .p-image-area img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}



/* Social Proof / Rating Global */
.p-card-rating {
    font-size: 0.82rem;
    margin-bottom: 8px;
    min-height: 1.35em;
    line-height: 1.3;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
}

@media (max-width: 576px) {
    .p-card-rating {
        font-size: 0.72rem;
    }
    .p-sold-divider {
        margin: 0 5px !important;
    }
}

.variant-mobile { display: none !important; }
@media (max-width: 576px) {
    .variant-desktop { display: none !important; }
    .variant-mobile { display: inline-flex !important; }
    
    /* Optimized tap targets for mobile grid buttons */
    .btn-buy-now {
        padding: 12px 10px !important;
        font-size: 0.72rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        width: 100% !important;
    }
    .btn-cart-mini {
        padding: 10px 10px !important;
        font-size: 0.72rem !important;
        border-radius: 10px !important;
        white-space: nowrap !important;
        width: 100% !important;
    }
}
