/* ==========================================================================
   NABRIJAN — STOREFRONT MASTER DESIGN SYSTEM & SHOP.APP UX
   Mobile-First Optimization, Dynamic Grid, Live Search, Wishlist & Cart Drawers
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap');

:root {
  --store-primary: #087A4B;
  --store-primary-hover: #06633D;
  --store-primary-soft: #E7F8EF;
  --store-accent: #D8F34A;
  --store-accent-hover: #c4df39;
  --store-surface: #FFFFFF;
  --store-bg: #F8FAFC;
  --store-card-bg: #FFFFFF;
  --store-border: #E2E8F0;
  --store-text: #0F172A;
  --store-muted: #64748B;
  --store-shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --store-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --store-shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --store-radius-sm: 8px;
  --store-radius-md: 12px;
  --store-radius-lg: 16px;
  --store-radius-pill: 9999px;
  --font-store: 'Inter', 'Noto Sans Bengali', system-ui, -apple-system, sans-serif;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* --- Zero Horizontal Scroll & Core Reset --- */
* {
  box-sizing: border-box;
}

html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative;
  width: 100%;
}

body.storefront-body {
  background-color: var(--store-bg);
  color: var(--store-text);
  font-family: var(--font-store);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

img, svg, iframe, video, canvas {
  max-width: 100% !important;
  height: auto;
}

/* --- Prevent iOS Zoom on Input Focus --- */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* --- Touch Targets Standard (Minimum 44x44px) --- */
.store-touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Announcement Top Bar --- */
.store-announcement-bar {
  background-color: var(--store-primary-soft);
  color: var(--store-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(8, 122, 75, 0.12);
}
.store-announcement-bar .pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--store-primary);
  border-radius: 50%;
  margin-right: 6px;
  animation: storePulse 1.8s infinite;
}
@keyframes storePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(8, 122, 75, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(8, 122, 75, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(8, 122, 75, 0); }
}

/* --- Sticky Modern Header --- */
.store-navbar {
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--store-border);
  position: sticky;
  top: 0;
  z-index: 1020;
  padding: 12px 0;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
}
.store-brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--store-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.store-brand-logo img {
  max-height: 36px;
  object-fit: contain;
}

/* --- Search Bar & Live Suggestions Overlay --- */
.store-search-container {
  max-width: 520px;
}
.store-search-form {
  position: relative;
  width: 100%;
}
.store-search-input {
  width: 100%;
  height: 44px;
  padding: 10px 48px 10px 18px;
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-pill);
  font-size: 0.9rem;
  background-color: var(--store-bg);
  transition: all 0.2s ease;
}
.store-search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--store-primary);
  box-shadow: 0 0 0 3px rgba(8, 122, 75, 0.12);
}
.store-search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--store-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.store-search-btn:hover {
  background: var(--store-primary-hover);
}

/* Live Search Dropdown */
.store-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-width: 100vw;
  background: var(--store-surface);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-md);
  box-shadow: var(--store-shadow-lg);
  z-index: 1050;
  overflow: hidden;
  display: none;
  box-sizing: border-box;
}
.store-search-suggestions.active {
  display: block;
}
.store-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--store-text);
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.store-suggestion-item:last-child {
  border-bottom: none;
}
.store-suggestion-item:hover {
  background: var(--store-primary-soft);
}
.store-suggestion-img {
  width: 40px;
  height: 40px;
  border-radius: var(--store-radius-sm);
  object-fit: contain;
  background: #f8fafc;
}
.store-suggestion-info {
  flex: 1;
  min-width: 0;
}
.store-suggestion-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.store-suggestion-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--store-primary);
}

/* --- Header Action Triggers --- */
.store-header-action-btn {
  position: relative;
  background: var(--store-bg);
  color: var(--store-text);
  border: 1px solid var(--store-border);
  height: 44px;
  padding: 0 14px;
  border-radius: var(--store-radius-pill);
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.store-header-action-btn:hover {
  background: var(--store-primary-soft);
  color: var(--store-primary);
  border-color: rgba(8, 122, 75, 0.3);
}
.store-action-badge {
  background: #EF4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--store-radius-pill);
  line-height: 1;
}

/* --- Category Navigation Chips Bar --- */
.store-category-bar {
  background: var(--store-surface);
  border-bottom: 1px solid var(--store-border);
  padding: 10px 0;
  max-width: 100vw;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.store-category-bar::-webkit-scrollbar {
  display: none;
}
.store-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 38px;
  background: var(--store-bg);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-pill);
  color: var(--store-text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  margin-right: 8px;
}
.store-category-chip:hover, .store-category-chip.active {
  background: var(--store-primary);
  color: #ffffff;
  border-color: var(--store-primary);
}

/* --- Hero Banner Section --- */
.store-hero-banner {
  background: linear-gradient(135deg, #087A4B 0%, #064E3B 100%);
  border-radius: var(--store-radius-lg);
  color: #ffffff;
  padding: 36px 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--store-shadow-md);
  margin-bottom: 24px;
}
.store-hero-banner::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 220px;
  height: 220px;
  background: rgba(216, 243, 74, 0.12);
  border-radius: 50%;
  pointer-events: none;
}
.store-hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.store-hero-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 20px;
  max-width: 540px;
}
.store-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--store-accent);
  color: #0F172A;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--store-radius-pill);
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
}
.store-hero-cta:hover {
  background: var(--store-accent-hover);
  transform: translateY(-2px);
  color: #0F172A;
}

/* --- Section Titles --- */
.store-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.store-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--store-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.store-section-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--store-primary);
  text-decoration: none;
}
.store-section-link:hover {
  text-decoration: underline;
}

/* --- FLUID RESPONSIVE PRODUCT GRID SPECIFICATION ---
   320px–480px: Exactly 2 columns
   481px–767px: 2–3 columns (fluid)
   768px–1023px: 3–4 columns (fluid)
   1024px–1279px: 4–5 columns (fluid)
   1280px–1599px: 5–6 columns (fluid)
   1600px+: 6+ columns (fluid auto-fill)
*/
.store-fluid-grid,
.store-product-grid-mobile {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
}

@media (min-width: 481px) {
  .store-fluid-grid,
  .store-product-grid-mobile {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 14px !important;
  }
}

@media (min-width: 768px) {
  .store-fluid-grid,
  .store-product-grid-mobile {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }
}

@media (min-width: 1024px) {
  .store-fluid-grid,
  .store-product-grid-mobile {
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)) !important;
    gap: 18px !important;
  }
}

@media (min-width: 1280px) {
  .store-fluid-grid,
  .store-product-grid-mobile {
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)) !important;
    gap: 20px !important;
  }
}

/* --- PRODUCT CARD DESIGN --- */
.store-product-card {
  background: var(--store-card-bg);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-md);
  overflow: hidden;
  height: 100%;
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
}

/* Desktop Hover Effects */
@media (hover: hover) and (pointer: fine) {
  .store-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: rgba(8, 122, 75, 0.3);
  }
  .store-product-card:hover .store-product-thumb img {
    transform: scale(1.05);
  }
  .store-product-card:hover .store-btn-add-cart {
    background: var(--store-primary-hover);
    box-shadow: 0 2px 8px rgba(8, 122, 75, 0.25);
  }
}

/* Square Product Image Container with contain object-fit for Tech Products */
.store-product-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  background: #f8fafc;
  overflow: hidden;
}
.store-product-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Prevents cropping tech items */
  padding: 8px;
  transition: transform 0.3s ease;
}

/* Badges & Wishlist Overlay Button */
.store-badge-discount {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #EF4444;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: var(--store-radius-sm);
  z-index: 2;
  box-shadow: var(--store-shadow-sm);
}
.store-badge-stock {
  position: absolute;
  top: 8px;
  right: 46px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.6rem;
  padding: 3px 6px;
  border-radius: var(--store-radius-sm);
  z-index: 2;
}

.store-wishlist-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--store-border);
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 3;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.store-wishlist-toggle:hover, .store-wishlist-toggle.active {
  background: #FFE4E6;
  color: #E11D48;
  border-color: #FDA4AF;
}

.store-product-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.store-product-category {
  font-size: 0.65rem;
  color: var(--store-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-product-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--store-text);
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
}
.store-product-title:hover {
  color: var(--store-primary);
}

.store-product-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}
.store-price-current {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--store-primary);
}
.store-price-original {
  font-size: 0.75rem;
  color: var(--store-muted);
  text-decoration: line-through;
}

.store-btn-add-cart {
  width: 100%;
  height: 38px;
  margin-top: 8px;
  padding: 0 8px;
  font-size: 0.78rem;
  background: var(--store-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--store-radius-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.store-btn-add-cart:hover {
  background: var(--store-primary-hover);
}

/* --- DRAWERS (WISHLIST & CART) --- */
.store-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: 100dvh;
  background: var(--store-surface);
  box-shadow: var(--store-shadow-lg);
  z-index: 1060;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
@media (max-width: 576px) {
  .store-drawer {
    max-width: 100%;
  }
}
.store-drawer.open {
  right: 0;
}
.store-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 1055;
  display: none;
}
.store-drawer-backdrop.open {
  display: block;
}
.store-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--store-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.store-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.store-drawer-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--store-muted);
  cursor: pointer;
  padding: 4px;
}
.store-drawer-body {
  padding: 16px 20px;
  flex-grow: 1;
  overflow-y: auto;
}
.store-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--store-border);
  background: var(--store-bg);
  padding-bottom: calc(16px + var(--safe-area-bottom));
}

/* Drawer Cart/Wishlist Items */
.store-drawer-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--store-border);
  position: relative;
}
.store-drawer-item:last-child {
  border-bottom: none;
}
.store-drawer-item-img {
  width: 64px;
  height: 64px;
  border-radius: var(--store-radius-sm);
  border: 1px solid var(--store-border);
  object-fit: contain;
  background: #f8fafc;
}
.store-drawer-item-details {
  flex: 1;
  min-width: 0;
}
.store-drawer-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--store-text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-drawer-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--store-primary);
}
.store-drawer-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* --- DESKTOP FILTER BAR & MOBILE BOTTOM SHEET FILTER --- */
.store-filter-card {
  background: var(--store-surface);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius-md);
  padding: 18px;
  margin-bottom: 20px;
}
.store-filter-group {
  margin-bottom: 16px;
}
.store-filter-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--store-text);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* --- MOBILE BOTTOM NAVIGATION BAR --- */
.store-mobile-nav {
  display: none;
}
@media (max-width: 768px) {
  .store-mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--store-border);
    padding: 6px 12px calc(6px + var(--safe-area-bottom)) 12px;
    z-index: 1040;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .store-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--store-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    position: relative;
  }
  .store-mobile-nav-item.active, .store-mobile-nav-item:hover {
    color: var(--store-primary);
  }
  .store-mobile-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
  }
  
  /* Add padding at body bottom so mobile nav doesn't cover content */
  body.storefront-body {
    padding-bottom: 66px !important;
  }
}

/* --- SKELETON LOADERS --- */
.store-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--store-radius-sm);
}
@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
