:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --card: #ffffff;
  --text: #171717;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #6c5ce7;
  --accent-hover: #5849c7;
  --accent2: #eeeaff;
  --green: #10b981;
  --danger: #ef4444;
  --shadow: 0 12px 35px rgba(22, 18, 41, 0.06);
}

[data-theme="dark"] {
  --bg: #0f1014;
  --surface: #181a20;
  --card: #20232b;
  --text: #f5f5f7;
  --muted: #9ca3af;
  --line: #2f333f;
  --accent: #a78bfa;
  --accent-hover: #8b5cf6;
  --accent2: #2d2445;
  --green: #34d399;
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  transition: background 0.25s, color 0.25s;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: all 0.2s ease;
}

.wrap {
  max-width: 1180px;
  margin: auto;
  padding: 0 24px;
}

/* NAVBAR */
.topbar {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  z-index: 20;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 20px;
}

.brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand span {
  color: var(--accent);
}

.ps-symbols {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 6px;
}

.links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.links button, .textbtn {
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 0;
}

.links button.active, .links button:hover, .textbtn:hover {
  color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* BUTTONS */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.soft {
  background: var(--accent2);
  border-color: transparent;
  color: var(--accent);
}

.btn.full-btn {
  width: 100%;
}

.iconbtn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.iconbtn:hover {
  border-color: var(--accent);
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.mobilemenu {
  display: none;
}

/* PAGES & TYPOGRAPHY */
.page {
  display: none;
  padding: 38px 0 80px;
  min-height: calc(100vh - 150px);
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.accent-text {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

h1 {
  font-size: clamp(40px, 5.5vw, 68px);
  line-height: 1.05;
  letter-spacing: -2.5px;
  margin: 14px 0 18px;
}

h2 {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 4px 0 8px;
}

h3 {
  margin: 0 0 8px;
}

/* HERO */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 42px;
  align-items: center;
  padding: 25px 0 55px;
}

.hero-actions {
  margin-top: 24px;
}

.trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
  font-weight: 600;
}

.heroimg {
  background: linear-gradient(135deg, var(--accent2), var(--surface));
  border-radius: 26px;
  height: 380px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
}

.heroimg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-float-card {
  position: absolute;
  bottom: 18px;
  left: 18px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* SECTIONS & GRIDS */
.section {
  margin: 40px 0;
}

.sectionhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  gap: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tile {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tile .symbol {
  font-size: 30px;
  margin-bottom: 14px;
}

/* PRODUCT CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
}

.productimg {
  height: 185px;
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.productimg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .productimg img {
  transform: scale(1.04);
}

.card-wish {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  display: grid;
  place-items: center;
}

.card-wish.wished {
  color: var(--danger);
  border-color: var(--danger);
}

.cardbody {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.price {
  font-size: 18px;
  font-weight: 800;
  margin: 8px 0 14px;
}

.tag {
  display: inline-block;
  border-radius: 99px;
  padding: 4px 10px;
  background: var(--accent2);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  width: max-content;
}

.tag.green {
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* FILTERS & FORMS */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.search, .filter-select, .field input, .field select, .field textarea {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  outline: none;
}

.search {
  flex: 1;
  min-width: 220px;
}

.search:focus, .filter-select:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
}

.field input, .field select, .field textarea {
  width: 100%;
}

/* DETAIL & PANELS */
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detail {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 36px;
}

.detail-main-img {
  height: 400px;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.thumb-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.thumb-btn {
  width: 72px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
}

.thumb-btn.active {
  border-color: var(--accent);
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-title {
  margin-top: 12px;
}

.detail-price {
  font-size: 26px;
  color: var(--accent);
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.spec-panel {
  margin: 18px 0;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.notice {
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--accent2);
  color: var(--accent);
  font-size: 14px;
}

.notice code {
  background: var(--card);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 800;
}

/* SYMPTOM CHIPS */
.symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ACCOUNT SIDEBAR */
.sidebarlayout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 24px;
}

.side {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  height: max-content;
  background: var(--card);
}

.side button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 10px;
  font-weight: 600;
}

.side button:hover, .side button.active {
  background: var(--accent2);
  color: var(--accent);
}

/* CART DRAWER */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--line);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.cart-drawer.open {
  right: 0;
}

.drawer-head {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-foot {
  padding: 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.cart-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.cart-item img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.promo-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.promo-row input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
}

/* SUCCESS & TOAST */
.success-box {
  max-width: 540px;
  margin: 50px auto;
  text-align: center;
  padding: 40px 24px;
}

.success-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
  font-size: 32px;
  font-weight: 800;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 13px;
  z-index: 60;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--muted);
  font-size: 13px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .links { display: none; }
  .links.mobile-open {
    display: flex;
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 16px 24px;
    align-items: flex-start;
  }
  .mobilemenu { display: inline-flex; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero, .detail, .two, .sidebarlayout { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .heroimg, .detail-main-img { height: 280px; }
}

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .actions .login { display: none; }
}