/* ===========================================================
   ShopSphere BD — Core Stylesheet
   Original design system inspired by compact marketplace layouts.
   =========================================================== */

:root {
  --primary: #0E9F6E;
  --secondary: #0B7A56;
  --text-dark: #1F2937;
  --text-muted: #6B7280;
  --bg-light: #F5F7F8;
  --border-color: #E5E7EB;
  --danger: #E53E3E;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --container-w: 1280px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------------- FLASH ---------------- */
.flash-wrap { position: fixed; top: 12px; right: 12px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-md); color: #fff; font-size: 13px; }
.flash-success { background: var(--primary); }
.flash-error { background: var(--danger); }
.flash-info { background: #3B82F6; }

/* ---------------- HEADER ---------------- */
.site-header { background: #fff; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 500; }
.topbar { display: flex; align-items: center; gap: 20px; padding: 12px 16px; flex-wrap: nowrap; }

.logo-block { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-stack { display: flex; flex-direction: column; gap: 2px; }
.logo-img { height: 44px; max-height: 44px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.logo-text { font-size: 20px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.logo-tagline { font-size: 9px; color: var(--text-muted); letter-spacing: 0.02em; white-space: nowrap; }

.delivery-block { display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding-right: 16px; border-right: 1px solid var(--border-color); }
.delivery-block i.fa-location-dot { color: var(--primary); font-size: 18px; }
.delivery-block div { display: flex; flex-direction: column; line-height: 1.2; }
.delivery-label { font-size: 11px; color: var(--text-muted); }
.small-caret { font-size: 9px; margin-left: 3px; }

.search-block { flex: 1; display: flex; align-items: stretch; max-width: 640px; border: 1.5px solid var(--primary); border-radius: 8px; overflow: visible; position: relative; height: 42px; }
.search-select { border: none; background: #F0FAF6; padding: 0 10px; font-size: 13px; border-right: 1px solid var(--border-color); border-radius: 8px 0 0 8px; max-width: 90px; }
.search-block input { flex: 1; border: none; padding: 0 12px; font-size: 13px; outline: none; }
.search-block button { background: var(--primary); color: #fff; border: none; width: 46px; border-radius: 0 6px 6px 0; }
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border-color); border-radius: 0 0 8px 8px; box-shadow: var(--shadow-md); display: none; z-index: 600; max-height: 320px; overflow-y: auto; }
.search-suggestions.active { display: block; }
.search-suggestions .sugg-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border-color); }
.search-suggestions .sugg-item:hover { background: var(--bg-light); }
.search-suggestions img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }

.header-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.account-block, .cart-block { display: flex; align-items: center; gap: 8px; }
.account-block i, .cart-block .fa-cart-shopping { font-size: 20px; color: var(--text-dark); }
.hi-label { display: block; font-size: 11px; color: var(--text-muted); }
.account-block strong, .cart-block strong { font-size: 12.5px; }
.cart-icon-wrap { position: relative; }
.cart-badge { position: absolute; top: -8px; right: -10px; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 10px; }

/* second nav */
.site-nav { background: var(--primary); }
.nav-inner { display: flex; align-items: center; gap: 20px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }
.nav-link { color: #fff; font-size: 13px; white-space: nowrap; opacity: 0.92; }
.nav-link:hover { opacity: 1; text-decoration: underline; }
.nav-highlight { background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: 6px; }

/* ---------------- MAIN LAYOUT: SIDEBAR + HERO ---------------- */
.market-area { display: grid; grid-template-columns: 260px 1fr; gap: 16px; padding: 16px; max-width: var(--container-w); margin: 0 auto; align-items: start; }

.category-sidebar { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: visible; }
.cat-list { padding: 6px 0; }
.cat-item { position: relative; border-bottom: 1px solid #F1F3F4; }
.cat-item:last-child { border-bottom: none; }
.cat-item > a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; }
.cat-item > a:hover { background: var(--bg-light); color: var(--primary); }
.cat-icon { width: 20px; text-align: center; color: var(--primary); }
.cat-name { flex: 1; }
.cat-arrow { font-size: 10px; color: var(--text-muted); }

.mega-menu { display: none; position: absolute; left: 100%; top: 0; min-width: 420px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--border-color); z-index: 700; padding: 18px; }
.cat-item.has-mega:hover .mega-menu { display: block; }
.mega-menu h4 { margin: 0 0 10px; font-size: 14px; color: var(--primary); }
.mega-menu ul { display: flex; flex-direction: column; gap: 6px; }
.mega-menu a:hover { color: var(--primary); }

.hero-slider { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); min-height: 320px; aspect-ratio: 3 / 1; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.hero-slide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  position: absolute;
  inset: 0;
  min-height: 320px;
  padding: 40px;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  transition: opacity 0.9s ease, transform 1.1s ease, visibility 0s linear 0.9s;
  z-index: 1;
}
.hero-slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.9s ease, transform 1.1s ease;
  z-index: 2;
}
.hero-slide img.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; z-index: 0; opacity: 1; }
.hero-bg-blur { display: none; }
.hero-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.30) 35%, rgba(0,0,0,0.05) 60%, rgba(0,0,0,0) 75%);
  pointer-events: none;
}
.hero-slide .hero-content { position: relative; z-index: 2; max-width: 480px; opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease 0.25s, transform 0.7s ease 0.25s; }
.hero-slide.active .hero-content { opacity: 1; transform: translateY(0); }
.hero-slide h2 { font-size: 30px; margin: 0 0 8px; line-height: 1.25; }
.hero-slide p { font-size: 15px; margin: 0 0 16px; opacity: 0.95; }
.hero-cta { display: inline-block; background: #fff; color: var(--primary); padding: 10px 26px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.hero-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.hero-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; }
.hero-dots span.active { background: #fff; }
.hero-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.25); color: #fff; border: none; width: 34px; height: 34px; border-radius: 50%; z-index: 2; }
.hero-arrow.prev { left: 12px; } .hero-arrow.next { right: 12px; }

/* ---------------- SERVICE CARDS ---------------- */
.service-strip { max-width: var(--container-w); margin: 0 auto; padding: 0 16px 16px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.service-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 10px; text-align: center; }
.service-card i { font-size: 22px; color: var(--primary); margin-bottom: 8px; }
.service-card span { display: block; font-size: 12.5px; font-weight: 500; }

/* ---------------- SECTIONS ---------------- */
.section { max-width: var(--container-w); margin: 0 auto; padding: 20px 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-head h2 { font-size: 19px; margin: 0; }
.section-head a { font-size: 13px; color: var(--primary); font-weight: 600; }

.category-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.category-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); text-align: center; padding: 18px 10px; transition: transform .15s; }
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.category-card img, .category-card i { width: 46px; height: 46px; margin: 0 auto 8px; color: var(--primary); font-size: 32px; }
.category-card .cat-title { font-size: 13px; font-weight: 600; }
.category-card .cat-count { font-size: 11px; color: var(--text-muted); }

.product-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

/* ---------------- PRODUCT CARD ---------------- */
.product-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s; }
.product-card:hover { box-shadow: var(--shadow-md); }
.wishlist-btn { position: absolute; top: 8px; right: 8px; background: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; box-shadow: var(--shadow-sm); z-index: 2; color: var(--text-muted); }
.wishlist-btn.active, .wishlist-btn:hover { color: var(--danger); }
.product-image-link { position: relative; display: block; background: #FAFAFA; }
.product-image { width: 100%; height: 150px; object-fit: contain; padding: 10px; }
.badge-discount { position: absolute; top: 8px; left: 8px; background: var(--danger); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.badge-outofstock { position: absolute; bottom: 8px; left: 8px; background: #374151; color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 4px; }
.product-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-name { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.product-brand { font-size: 11px; color: var(--text-muted); }
.product-rating { font-size: 10.5px; color: #F59E0B; display: flex; align-items: center; gap: 3px; }
.rating-count { color: var(--text-muted); margin-left: 3px; }
.product-price { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.price-old { text-decoration: line-through; color: var(--text-muted); font-size: 12px; }
.price-new { font-size: 15px; font-weight: 700; color: var(--primary); }
.btn-add-cart { margin-top: 6px; width: 100%; background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 8px 0; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-add-cart:hover { background: var(--secondary); }
.btn-add-cart:disabled { background: #D1D5DB; cursor: not-allowed; }

/* ---------------- FOOTER ---------------- */
.site-footer { background: #14261F; color: #D1D5DB; margin-top: 30px; }
.footer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; padding: 40px 16px; }
.footer-col h4 { color: #fff; font-size: 14px; margin: 0 0 12px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { font-size: 12.5px; color: #B8C2BD; }
.footer-col a:hover { color: #fff; }
.contact-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin-bottom: 8px; }
.social-links { display: flex; gap: 10px; margin-top: 10px; }
.social-links a { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding: 14px 16px; }
.footer-bottom .container { display: flex; justify-content: space-between; align-items: center; font-size: 12px; flex-wrap: wrap; gap: 8px; }
.payment-icons { display: flex; gap: 12px; align-items: center; font-size: 12px; }

/* ---------------- MOBILE BOTTOM NAV ---------------- */
.mobile-bottom-nav { display: none; }

/* ---------------- FORM ELEMENTS (auth/checkout) ---------------- */
.auth-card, .checkout-card { max-width: 480px; margin: 40px auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 28px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; }
.form-group input[type="radio"], .form-group input[type="checkbox"] { width: auto; padding: 0; border: none; border-radius: 0; margin-right: 4px; vertical-align: middle; }

/* Password show/hide toggle (auto-applied via JS to every password field) */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 38px !important; }
.password-toggle-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px 6px; font-size: 14px; line-height: 1; }
.password-toggle-btn:hover { color: var(--text-dark); }
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 11px 0; width: 100%; border-radius: 6px; font-weight: 600; font-size: 13.5px; }
.btn-primary:hover { background: var(--secondary); }
.btn-outline { background: #fff; border: 1.5px solid var(--primary); color: var(--primary); padding: 10px 18px; border-radius: 6px; font-weight: 600; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .service-strip { grid-template-columns: repeat(3, 1fr); }
}

/* ---------------- RESPONSIVE TWO-COLUMN UTILITIES ----------------
   Used by checkout/cart/product/category/account pages so their
   layouts properly collapse to a single column on mobile instead
   of staying squeezed side-by-side. */
.two-col-fixed-first { display: grid; grid-template-columns: var(--col-w, 260px) 1fr; gap: 16px; align-items: start; }
.two-col-fixed-last { display: grid; grid-template-columns: 1fr var(--col-w, 320px); gap: 16px; align-items: start; }

/* ---------------- MOBILE CATEGORY CHIPS ----------------
   Horizontally scrollable category quick-links shown only on mobile,
   replacing the hidden desktop sidebar so categories stay reachable. */
.mobile-category-chips { display: none; }

@media (max-width: 900px) {
  .market-area { grid-template-columns: 1fr; }
  .category-sidebar { display: none; }
  .mobile-category-chips {
    display: none;
  }
  .mobile-category-chips::-webkit-scrollbar { display: none; }
  .mobile-category-chips a {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    padding: 10px 14px;
    min-width: 72px;
    font-size: 11px;
    text-align: center;
  }
  .mobile-category-chips a i { font-size: 18px; color: var(--primary); }
  .two-col-fixed-first, .two-col-fixed-last { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .delivery-block { display: none; }
  .header-actions .hi-label, .header-actions strong { display: none; }
  .topbar { gap: 10px; flex-wrap: wrap; row-gap: 10px; }
  .logo-block { order: 1; }
  .header-actions { order: 2; margin-left: auto; }
  .search-block { order: 3; flex: 1 1 100%; max-width: 100%; }
  .logo-img { max-width: 150px; height: 36px; }
  .logo-text { font-size: 16px; }
  .logo-tagline { display: none; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .mobile-bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
    border-top: 1px solid var(--border-color); z-index: 900; padding: 6px 0;
  }
  .mobile-bottom-nav a { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); }
  .mobile-bottom-nav a i { display: block; font-size: 17px; margin-bottom: 2px; color: var(--text-dark); }
  body { padding-bottom: 56px; }
  .hero-slide h2 { font-size: 22px; }
  .hero-slide { padding: 24px; min-height: 0; }
  .hero-slider { min-height: 0; aspect-ratio: 3 / 1; }
  .hero-slide img.hero-bg { object-fit: cover; }
  .hero-bg-blur { display: none; }
}

/* ---------------- FILTER SIDEBAR (search/category pages) ---------------- */
.filter-sidebar { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; }
.filter-group { border-bottom: 1px solid var(--border-color); padding-bottom: 14px; margin-bottom: 14px; }
.filter-group:last-child { border: none; }
.filter-group h5 { margin: 0 0 10px; font-size: 13px; }
.filter-group label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 7px; }

/* ---------------- ADMIN LOGIN (shared minimal look for front pages like login) ---------------- */
.page-title-bar { max-width: var(--container-w); margin: 0 auto; padding: 16px; font-size: 13px; color: var(--text-muted); }
.page-title-bar a { color: var(--primary); }

.stars-input i { font-size: 22px; color: #D1D5DB; cursor: pointer; }
.stars-input i.active { color: #F59E0B; }
