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

:root {
  --navy: #0d1b2a;
  --navy-light: #162540;
  --gold: #c9a055;
  --gold-light: #e8c97a;
  --bg: #f4f6f8;
  --white: #ffffff;
  --text: #1a1a2e;
  --muted: #64748b;
  --border: #e2e8f0;
  --rx-color: #1d4ed8;
  --otc-color: #0891b2;
  --vit-color: #16a34a;
  --danger: #dc2626;
  --success: #16a34a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── NAVBAR ── */
.shop-nav {
  background: var(--navy);
  position: sticky; top: 0; z-index: 200;
  padding: 0 32px;
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.nav-brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.nav-brand-text h1 { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 700; color: var(--white); letter-spacing: 1px; }
.nav-brand-text p { font-size: 10px; color: var(--gold); letter-spacing: 3px; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 14px; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--gold); }
.nav-cart-btn {
  position: relative; background: var(--gold); color: var(--navy);
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background 0.2s;
}
.nav-cart-btn:hover { background: var(--gold-light); }
.cart-badge {
  background: var(--danger); color: white;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.cart-badge.hidden { display: none; }

/* ── PAGE HEADER ── */
.page-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 60px 32px 48px;
  text-align: center; color: var(--white);
}
.page-header .category-badge {
  display: inline-block; padding: 6px 18px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 16px;
}
.badge-rx { background: rgba(29,78,216,0.2); color: #93c5fd; border: 1px solid rgba(29,78,216,0.5); font-weight: 800; letter-spacing: 2px; }
.badge-otc { background: rgba(8,145,178,0.2); color: #67e8f9; border: 1px solid rgba(8,145,178,0.5); font-weight: 800; letter-spacing: 2px; }
.badge-vit { background: rgba(201,160,85,0.2); color: #c9a055; border: 1px solid rgba(201,160,85,0.5); font-weight: 800; letter-spacing: 2px; }
.page-header h2 { font-family: 'Cormorant Garamond', serif; font-size: 42px; font-weight: 700; margin-bottom: 10px; }
.page-header p { font-size: 16px; color: rgba(255,255,255,0.65); max-width: 560px; margin: 0 auto 28px; }
.header-notice {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(201,160,85,0.2); border: 1px solid rgba(201,160,85,0.5);
  border-radius: 8px; padding: 10px 20px; font-size: 13px; color: var(--gold);
  font-weight: 700; letter-spacing: 0.5px;
}

/* ── CONTROLS BAR ── */
.controls-bar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 20px 32px; display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap; justify-content: space-between;
}
.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; padding: 11px 16px 11px 44px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--bg); transition: border-color 0.2s;
}
.search-input:focus { outline: none; border-color: var(--gold); background: var(--white); }
.filter-select {
  padding: 11px 36px 11px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--bg); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.filter-select:focus { outline: none; border-color: var(--gold); }
.results-count { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ── PRODUCTS GRID ── */
.products-section { padding: 32px; max-width: 1400px; margin: 0 auto; }
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--white); border-radius: 16px;
  border: 1px solid var(--border); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.1); }
.product-img {
  height: 280px; display: flex; align-items: center; justify-content: center;
  padding: 10px; overflow: hidden; transition: background 0.3s; cursor: pointer;
}
.product-img.rx-bg { background: linear-gradient(135deg, #dbeafe, #eff6ff); }
.product-img.otc-bg { background: linear-gradient(135deg, #cffafe, #ecfeff); }
.product-img.vit-bg { background: #ffffff; }
.product-img svg { width: 72px; height: 72px; opacity: 0.85; }
.product-img img { max-width: 100%; max-height: 258px; object-fit: contain; border-radius: 8px; display: block; transition: transform 0.3s; }
.product-img:hover img { transform: scale(1.05); }
.product-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-tag {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.tag-rx { background: #dbeafe; color: var(--rx-color); }
.tag-otc { background: #cffafe; color: var(--otc-color); }
.tag-vit { background: #dcfce7; color: var(--vit-color); }
.product-name { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.4; flex: 1; }
.product-price { font-size: 20px; font-weight: 700; color: var(--navy); }
.product-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.btn-add {
  width: 100%; padding: 11px; border: none; border-radius: 10px;
  background: var(--navy); color: var(--white);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.2s, transform 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-add:hover { background: var(--navy-light); }
.btn-add:active { transform: scale(0.97); }
.btn-add.added { background: var(--success); }
.no-results { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--muted); }
.no-results svg { margin-bottom: 16px; opacity: 0.4; }
.no-results p { font-size: 16px; }

/* ── CART DRAWER ── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer {
  position: fixed; top: 0; right: -480px; width: 100%; max-width: 460px;
  height: 100vh; background: var(--white); z-index: 400;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
}
.cart-drawer.open { right: 0; }
.cart-header {
  background: var(--navy); color: var(--white);
  padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
}
.cart-header h3 { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 700; }
.cart-close { background: rgba(255,255,255,0.1); border: none; color: white; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.cart-close:hover { background: rgba(255,255,255,0.2); }
.cart-items { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); padding: 40px; text-align: center; }
.cart-empty svg { opacity: 0.3; margin-bottom: 16px; }
.cart-empty p { font-size: 15px; }
.cart-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; background: var(--bg); border-radius: 12px;
  border: 1px solid var(--border);
}
.cart-item-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cart-item-icon.rx-bg { background: #dbeafe; }
.cart-item-icon.otc-bg { background: #cffafe; }
.cart-item-icon.vit-bg { background: #dcfce7; }
.cart-item-icon svg { width: 26px; height: 26px; }
.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.cart-item-info p { font-size: 14px; font-weight: 700; color: var(--navy); }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 28px; height: 28px; border: 1.5px solid var(--border); border-radius: 7px; background: var(--white); cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; transition: border-color 0.2s; }
.qty-btn:hover { border-color: var(--gold); }
.qty-num { font-size: 15px; font-weight: 600; min-width: 24px; text-align: center; }
.cart-remove { background: none; border: none; cursor: pointer; color: #ef4444; font-size: 18px; padding: 4px; opacity: 0.6; transition: opacity 0.2s; }
.cart-remove:hover { opacity: 1; }
.cart-footer { border-top: 1px solid var(--border); padding: 20px 24px; background: var(--white); }
.cart-subtotal { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.btn-checkout {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--gold); color: var(--navy);
  font-size: 16px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: background 0.2s;
}
.btn-checkout:hover { background: var(--gold-light); }
.btn-continue { width: 100%; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; background: none; color: var(--muted); font-size: 14px; font-family: inherit; cursor: pointer; margin-top: 10px; transition: border-color 0.2s; }
.btn-continue:hover { border-color: var(--navy); color: var(--text); }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy); color: white; padding: 14px 20px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.toast.show { transform: translateX(0); }
.toast svg { flex-shrink: 0; }

/* ── FOOTER ── */
.shop-footer { background: var(--navy); color: rgba(255,255,255,0.5); text-align: center; padding: 28px 24px; font-size: 13px; margin-top: 48px; }
.shop-footer a { color: var(--gold); text-decoration: none; }
.shop-footer .footer-social { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; }
.shop-footer .fb-btn { display: inline-flex; align-items: center; gap: 8px; background: #1877F2; color: white; text-decoration: none; padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; transition: background 0.2s; }
.shop-footer .fb-btn:hover { background: #1565d8; color: white; }

/* ── HAMBURGER BUTTON ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  color: white;
  margin-left: 8px;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .shop-nav {
    padding: 0 16px;
    position: relative;
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
  }
  .nav-hamburger { display: flex; }

  /* Mobile nav dropdown */
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy);
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 198;
    padding: 8px 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 15px;
    width: 100%;
  }
  .nav-links a:last-child { border-bottom: none; }

  .page-header { padding: 36px 16px 28px; }
  .page-header h2 { font-size: 28px; }
  .controls-bar { padding: 14px 16px; flex-direction: column; align-items: stretch; gap: 10px; }
  .search-wrap { max-width: 100%; }
  .filter-select { width: 100%; }
  .products-section { padding: 16px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-img { height: 160px; }
  .product-body { padding: 12px; gap: 6px; }
  .product-name { font-size: 12px; }
  .product-price { font-size: 16px; }
  .btn-add { padding: 9px; font-size: 13px; }
  .cart-drawer { max-width: 100%; }
}

@media (max-width: 380px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .product-img { height: 150px; }
  .page-header h2 { font-size: 24px; }
}

/* ── PRODUCT DETAIL MODAL ──────────────────────────────────────────────────────*/
.pm-overlay {
  position: fixed; inset: 0;
  background: rgba(13,27,42,0.72); backdrop-filter: blur(5px);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.pm-overlay.open { opacity: 1; pointer-events: all; }
.pm-panel {
  background: var(--white); border-radius: 20px;
  max-width: 880px; width: 100%; max-height: 88vh;
  display: flex; position: relative; overflow: hidden;
  transform: scale(0.94) translateY(24px);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 32px 100px rgba(0,0,0,0.4);
}
.pm-overlay.open .pm-panel { transform: scale(1) translateY(0); }
.pm-close {
  position: absolute; top: 14px; right: 14px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.95); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: transform 0.25s, box-shadow 0.25s;
}
.pm-close:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
.pm-img-side {
  width: 44%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px; min-height: 460px;
}
.pm-img-side.rx-bg  { background: linear-gradient(145deg,#dbeafe,#eff6ff); }
.pm-img-side.otc-bg { background: linear-gradient(145deg,#cffafe,#ecfeff); }
.pm-img-side.vit-bg { background: linear-gradient(145deg,#dcfce7,#f0fdf4); }
.pm-img-frame { width: 100%; display: flex; align-items: center; justify-content: center; }
.pm-img-frame img {
  max-width: 100%; max-height: 380px;
  object-fit: contain; border-radius: 12px;
  filter: drop-shadow(0 12px 32px rgba(0,0,0,0.14));
  transition: transform 0.3s;
}
.pm-img-frame img:hover { transform: scale(1.04); }
.pm-img-frame svg { width: 110px; height: 110px; opacity: 0.55; }
.pm-info-side {
  flex: 1; padding: 44px 40px 36px;
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
}
.pm-tag { align-self: flex-start; font-size: 11px; margin-bottom: -4px; }
.pm-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1.25;
}
.pm-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.pm-price { font-size: 38px; font-weight: 700; color: var(--navy); letter-spacing: -1px; }
.pm-unit  { font-size: 15px; color: var(--muted); }
.pm-note {
  font-size: 13px; color: var(--muted);
  background: #fafbfc; padding: 12px 16px; border-radius: 10px;
  border-left: 3px solid var(--gold); line-height: 1.5; margin-top: 4px;
}
.pm-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.pm-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.pm-btn-cart {
  width: 100%; padding: 15px; background: var(--navy); color: var(--white);
  border: none; border-radius: 12px; font-size: 16px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background 0.2s, transform 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.pm-btn-cart:hover { background: var(--navy-light); }
.pm-btn-cart:active { transform: scale(0.98); }
.pm-btn-buynow {
  width: 100%; padding: 15px; background: #f59e0b; color: #1a1a2e;
  border: none; border-radius: 12px; font-size: 16px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: background 0.2s, transform 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.pm-btn-buynow:hover { background: #d97706; }
.pm-btn-buynow:active { transform: scale(0.98); }
.pm-pay-icons {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: -4px; flex-wrap: wrap;
}
@media (max-width: 660px) {
  .pm-overlay { padding: 0; align-items: flex-end; }
  .pm-panel {
    max-width: 100%; width: 100%;
    border-radius: 24px 24px 0 0; flex-direction: column;
    max-height: 94vh;
  }
  .pm-img-side { width: 100%; min-height: 200px; padding: 24px; }
  .pm-img-frame img { max-height: 160px; }
  .pm-img-frame svg { width: 80px; height: 80px; }
  .pm-info-side { padding: 24px 24px 36px; gap: 14px; }
  .pm-name { font-size: 22px; }
  .pm-price { font-size: 30px; }
}
