/* ============================================================
   PAIKARIBAZAR — MAIN STYLESHEET
   Color Palette:
   --pb-darkest:  #3a205a  (deepest purple, topbar bg)
   --pb-dark:     #472566  (dark purple)
   --pb-mid:      #4d2a72  (mid purple, buttons)
   --pb-accent:   #5f3b8e  (accent purple)
   --pb-light:    #8c60a7  (light purple)
   --pb-pale:     #b990c1  (pale purple)
   --pb-muted:    #d1b3d5  (muted lavender)
   --pb-danger:   #d63d5a  (red/danger)
   --pb-bg:       #ecebed  (page background)
   --pb-white:    #f7f8f9  (off-white)
   ============================================================ */

:root {
  --pb-darkest:  #3a205a;
  --pb-dark:     #472566;
  --pb-mid:      #4d2a72;
  --pb-accent:   #5f3b8e;
  --pb-light:    #8c60a7;
  --pb-pale:     #b990c1;
  --pb-muted:    #d1b3d5;
  --pb-danger:   #d63d5a;
  --pb-bg:       #ecebed;
  --pb-white:    #f7f8f9;
  --pb-card:     #ffffff;
  --pb-text:     #1a1a1a;
  --pb-text-2:   #555555;
  --pb-border:   #e0dde3;

  --topbar-h:    44px;
  --navbar-h:    72px;
  --sidebar-w:   270px;
  --cart-panel-w:320px;

  --radius-sm:   8px;
  --radius-md:   13px;
  --radius-pill: 23px;

  --shadow-card: 0 2px 12px rgba(58,32,90,0.10);
  --shadow-panel:0 8px 40px rgba(58,32,90,0.18);

  --transition:  0.22s cubic-bezier(.4,0,.2,1);
  --font-main:   'Inter', 'Segoe UI', Arial, sans-serif;
  --font-bangla: 'Noto Sans Bengali', 'Nirmala UI', sans-serif;
}

/* ── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-main);
  background: var(--pb-bg);
  color: var(--pb-text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
ul { list-style: none; }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--pb-darkest);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.topbar__greeting {
  font-size: 13px;
  color: var(--pb-muted);
}

.topbar__greeting span { color: var(--pb-white); font-weight: 500; }

.topbar__lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pb-muted);
}

.topbar__lang button {
  background: transparent;
  color: var(--pb-pale);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}

.topbar__lang button:hover,
.topbar__lang button.active {
  background: rgba(255,255,255,0.12);
  color: var(--pb-white);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--pb-muted);
}

.topbar__right a:hover { color: var(--pb-white); }

.topbar__coins {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #f5c842;
  font-size: 13px;
  font-weight: 600;
}

.topbar__coins svg { color: #f5c842; }

/* ── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--pb-mid);
  z-index: 999;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
}

.navbar__logo {
  flex-shrink: 0;
  height: 44px;
  display: flex;
  align-items: center;
}

.navbar__logo img,
.navbar__logo svg { height: 44px; width: auto; }

.navbar__logo-sq { display: none; }
.navbar__logo-rect { display: block; }

.navbar__search {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  background: var(--pb-white);
  border-radius: var(--radius-pill);
  overflow: hidden;
  height: 44px;
}

.navbar__search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 18px;
  font-size: 15px;
  color: var(--pb-text);
  outline: none;
}

.navbar__search input::placeholder { color: #999; }

.navbar__search-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-right: 1.5px solid var(--pb-border);
  font-size: 13px;
  color: var(--pb-accent);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  height: 100%;
  transition: background var(--transition);
}

.navbar__search-cat:hover { background: #f0edf4; }

.navbar__search-btn {
  width: 48px;
  height: 100%;
  background: var(--pb-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

.navbar__search-btn:hover { background: var(--pb-dark); }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.navbar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255,255,255,0.12);
  color: var(--pb-white);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.navbar__btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

.navbar__btn--cart {
  background: var(--pb-accent);
  position: relative;
}

.navbar__btn--cart:hover { background: var(--pb-dark); }

.navbar__btn .cart-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--pb-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.navbar__hamburger {
  display: none;
  background: transparent;
  color: var(--pb-white);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.navbar__hamburger:hover { background: rgba(255,255,255,0.12); }

/* ── LAYOUT SHELL ───────────────────────────────────────── */
.page-shell {
  margin-top: calc(var(--topbar-h) + var(--navbar-h));
  display: flex;
  min-height: calc(100vh - var(--topbar-h) - var(--navbar-h));
  position: relative;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--pb-card);
  border-right: 1.5px solid var(--pb-border);
  padding: 18px 12px;
  position: sticky;
  top: calc(var(--topbar-h) + var(--navbar-h));
  height: calc(100vh - var(--topbar-h) - var(--navbar-h));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--pb-muted) transparent;
  transition: transform var(--transition);
  z-index: 90;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--pb-muted); border-radius: 2px; }

.sidebar__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pb-light);
  padding: 4px 12px 10px;
}

.sidebar__list { display: flex; flex-direction: column; gap: 4px; }

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--pb-text);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar__item:hover {
  background: var(--pb-muted);
  color: var(--pb-darkest);
  transform: translateX(3px);
}

.sidebar__item.active {
  background: var(--pb-mid);
  color: white;
}

.sidebar__item.active:hover { background: var(--pb-accent); transform: translateX(0); }

.sidebar__item svg { flex-shrink: 0; opacity: 0.7; }
.sidebar__item.active svg { opacity: 1; }

.sidebar__divider {
  height: 1px;
  background: var(--pb-border);
  margin: 8px 12px;
}

.sidebar__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 89;
}

/* ── MAIN CONTENT ───────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 40px;
}

/* ── HERO BANNER / CAROUSEL ─────────────────────────────── */
.hero-carousel {
  background: var(--pb-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  height: 340px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.carousel__track {
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}

.carousel__slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--pb-white);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.carousel__slide--1 { background: linear-gradient(135deg, var(--pb-darkest) 0%, var(--pb-accent) 100%); }
.carousel__slide--2 { background: linear-gradient(135deg, var(--pb-mid) 0%, var(--pb-pale) 100%); }
.carousel__slide--3 { background: linear-gradient(135deg, var(--pb-accent) 0%, var(--pb-light) 100%); }
.carousel__slide--4 { background: linear-gradient(135deg, #2d1249 0%, var(--pb-mid) 100%); }

.carousel__slide-inner {
  text-align: center;
  z-index: 1;
  padding: 20px;
}

.carousel__slide-inner p {
  font-size: 1rem;
  font-weight: 400;
  color: var(--pb-muted);
  margin-top: 8px;
}

.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--transition);
}

.carousel__btn:hover { background: rgba(255,255,255,0.30); }
.carousel__btn--prev { left: 14px; }
.carousel__btn--next { right: 14px; }

.carousel__dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.carousel__dot.active {
  background: white;
  transform: scale(1.25);
}

/* ── PRODUCT SECTION ────────────────────────────────────── */
.product-section { margin-bottom: 36px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pb-darkest);
  position: relative;
}

.section-header h2::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: var(--pb-light);
  border-radius: 2px;
  margin-top: 4px;
}

.section-header__see-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--pb-accent);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition), gap var(--transition);
}

.section-header__see-more:hover { color: var(--pb-mid); gap: 8px; }

/* ── PRODUCT GRID ───────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── PRODUCT CARD ───────────────────────────────────────── */
.product-card {
  background: var(--pb-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  border: 1.5px solid transparent;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(58,32,90,0.16);
  border-color: var(--pb-muted);
}

.product-card__img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--pb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1.5px solid var(--pb-border);
  position: relative;
  overflow: hidden;
}

.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-card__img img { transform: scale(1.05); }

.product-card__img-placeholder {
  width: 60%;
  height: 60%;
  border-radius: var(--radius-md);
  border: 2px dashed var(--pb-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pb-muted);
}

.product-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--pb-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.product-card__body {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pb-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.product-card__shop {
  font-size: 12px;
  color: var(--pb-text-2);
}

.product-card__price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pb-darkest);
  margin-top: auto;
}

.product-card__price .currency { font-size: 0.95rem; margin-left: 2px; }

.product-card__footer {
  padding: 0 14px 14px;
}

.btn-add-cart {
  width: 100%;
  background: var(--pb-mid);
  color: white;
  border-radius: var(--radius-sm);
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background var(--transition), transform var(--transition);
}

.btn-add-cart:hover {
  background: var(--pb-accent);
  transform: translateY(-1px);
}

.btn-add-cart:active { transform: translateY(0); }

/* ── CART PANEL ─────────────────────────────────────────── */
.cart-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--navbar-h));
  right: 0;
  width: var(--cart-panel-w);
  height: calc(100vh - var(--topbar-h) - var(--navbar-h));
  background: var(--pb-card);
  border-left: 1.5px solid var(--pb-border);
  box-shadow: var(--shadow-panel);
  z-index: 980;
  transform: translateX(100%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-panel.open { transform: translateX(0); }

.cart-panel__header {
  padding: 18px 18px 14px;
  border-bottom: 1.5px solid var(--pb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--pb-mid);
  color: white;
}

.cart-panel__header h3 { font-size: 1rem; font-weight: 700; }

.cart-panel__close {
  background: rgba(255,255,255,0.15);
  color: white;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.cart-panel__close:hover { background: rgba(255,255,255,0.3); }

.cart-panel__items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

.cart-item {
  display: flex;
  gap: 10px;
  background: var(--pb-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  align-items: flex-start;
}

.cart-item__img {
  width: 52px; height: 52px;
  background: white;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--pb-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pb-muted);
}

.cart-item__info { flex: 1; }
.cart-item__name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.cart-item__qty-price { font-size: 12px; color: var(--pb-text-2); margin-top: 4px; }

.cart-item__remove {
  background: transparent;
  color: var(--pb-danger);
  padding: 2px;
  border-radius: 4px;
  transition: background var(--transition);
}
.cart-item__remove:hover { background: #fde8ec; }

.cart-panel__footer {
  padding: 14px 16px;
  border-top: 1.5px solid var(--pb-border);
  background: white;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--pb-darkest);
}

.cart-subtotal span:last-child { color: var(--pb-accent); font-size: 1.05rem; }

.cart-panel__btns { display: flex; gap: 8px; }

.btn-view-cart, .btn-clear-cart {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}

.btn-view-cart { background: var(--pb-mid); color: white; }
.btn-view-cart:hover { background: var(--pb-accent); }
.btn-clear-cart { background: var(--pb-danger); color: white; }
.btn-clear-cart:hover { opacity: 0.85; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--pb-muted);
  padding: 40px 20px;
}

.cart-empty svg { opacity: 0.4; }
.cart-empty p { font-size: 14px; text-align: center; }

/* ── FOOTER ─────────────────────────────────────────────── */
.footer {
  background: var(--pb-darkest);
  color: var(--pb-muted);
  margin-top: auto;
  position: relative;
}

.footer__bg-strip {
  display: none;
}

.footer__bg-strip svg { width: 100%; height: auto; display: block; }

.footer__main {
  padding: 40px 40px 24px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  position: relative;
  isolation: isolate;
}

.footer__main::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url(/images/footer-bg.svg);
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
}

.footer__brand-logo {
  height: 42px;
  width: auto;
  margin-bottom: 14px;
  opacity: 0.9;
}

.footer__brand p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--pb-pale);
  max-width: 240px;
}

.footer__col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pb-white);
  margin-bottom: 14px;
}

.footer__col ul { display: flex; flex-direction: column; gap: 8px; }

.footer__col ul li a {
  font-size: 13px;
  color: var(--pb-pale);
  transition: color var(--transition), padding-left var(--transition);
}

.footer__col ul li a:hover {
  color: var(--pb-white);
  padding-left: 4px;
}

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.footer__bottom p { color: var(--pb-pale); }

.footer__socials {
  display: flex;
  gap: 10px;
}

.footer__social-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pb-pale);
  transition: background var(--transition), color var(--transition);
}

.footer__social-btn:hover {
  background: var(--pb-accent);
  color: white;
}

/* ── UTILITY ─────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--pb-accent);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-panel);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .footer__main { grid-template-columns: 1.2fr 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

  .sidebar {
    position: fixed;
    top: calc(var(--topbar-h) + var(--navbar-h));
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-panel);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar__overlay { display: block; }

  .navbar__hamburger { display: flex; }
  .navbar__logo-rect { display: none; }
  .navbar__logo-sq { display: block; height: 40px; }
}

@media (max-width: 768px) {
  :root {
    --navbar-h: 64px;
    --topbar-h: 40px;
  }

  .topbar__greeting { display: none; }

  .navbar { padding: 0 12px; gap: 10px; }

  .navbar__search-cat { display: none; }

  .main-content { padding: 14px 12px 32px; }

  .hero-carousel { height: 220px; }

  .carousel__slide { font-size: 1.4rem; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .footer__main { grid-template-columns: 1fr 1fr; gap: 24px; padding: 28px 20px 20px; }
  .footer__brand { grid-column: 1 / -1; }
  .footer__bottom { flex-direction: column; gap: 12px; padding: 14px 20px; text-align: center; }

  .cart-panel { width: 100%; }

  .topbar__coins { display: none; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .product-card__name { font-size: 12.5px; }

  .section-header h2 { font-size: 1.05rem; }

  .navbar__btn:not(.navbar__btn--cart) .btn-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
