/* ============================================================
   AWWZEN DESIGN SYSTEM v2 — ONE design system, four area skins.
   Mobile-first, responsive, polished. Respects area-* skins.
   ============================================================ */
:root {
  --aww-primary: #2b59ff;
  --aww-primary-dark: #1d3fc4;
  --aww-secondary: #00b386;
  --aww-accent: #ff7a00;
  --aww-bg: #f5f6f8;
  --aww-surface: #ffffff;
  --aww-surface-2: #eef0f4;
  --aww-border: #e2e5ec;
  --aww-text: #1a1d29;
  --aww-muted: #6b7280;
  --aww-success: #1aa179;
  --aww-warning: #d98a00;
  --aww-error: #d83a3a;
  --aww-info: #2b59ff;

  --aww-radius-sm: 8px;
  --aww-radius: 12px;
  --aww-radius-lg: 18px;
  --aww-shadow: 0 1px 3px rgba(20,30,60,.08), 0 1px 2px rgba(20,30,60,.06);
  --aww-shadow-md: 0 6px 20px rgba(20,30,60,.12);

  --aww-fs-xs: .75rem;
  --aww-fs-sm: .875rem;
  --aww-fs-base: 1rem;
  --aww-fs-lg: 1.125rem;
  --aww-fs-2xl: 1.5rem;
  --aww-fs-3xl: 2rem;
  --aww-fs-4xl: 2.6rem;

  --aww-max: 1200px;
  --aww-header-h: 60px;
  --aww-tap: 44px; /* minimum touch target */
}

/* ---------- Dark mode (toggle in header; #5 audit) ---------- */
[data-theme="dark"] {
  --aww-bg: #0f1117;
  --aww-surface: #171a23;
  --aww-surface-2: #1f2330;
  --aww-border: #2a2f3d;
  --aww-text: #e8eaf0;
  --aww-muted: #9aa3b2;
  --aww-shadow: 0 1px 3px rgba(0,0,0,.4);
  --aww-shadow-md: 0 6px 20px rgba(0,0,0,.5);
}
[data-theme="dark"] body { background: var(--aww-bg); color: var(--aww-text); }

/* ---------- Sticky mobile add-to-cart bar (P1 audit #3) ---------- */
.sticky-cart-bar{
  position:fixed;left:0;right:0;bottom:0;z-index:80;
  display:none;gap:8px;padding:10px 12px;
  background:var(--aww-surface);border-top:1px solid var(--aww-border);
  box-shadow:var(--aww-shadow-md);align-items:center;
}
.sticky-cart-bar .scb-price{font-weight:800;color:var(--aww-secondary);font-size:1.05rem}
.sticky-cart-bar .btn{flex:1;justify-content:center}
@media(max-width:768px){
  .sticky-cart-bar{display:flex}
  .pdp,.product-page{padding-bottom:72px} /* avoid overlap */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: var(--aww-bg);
  color: var(--aww-text);
  font-size: var(--aww-fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--aww-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.container { max-width: var(--aww-max); margin: 0 auto; padding: 0 16px; }
.text-muted { color: var(--aww-muted); }
.mt-4 { margin-top: 16px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--aww-surface);
  border-bottom: 1px solid var(--aww-border);
  position: sticky; top: 0; z-index: 50;
  height: var(--aww-header-h);
  display: flex; align-items: center;
  box-shadow: 0 1px 0 rgba(20,30,60,.04);
}
.site-header .container { display: flex; align-items: center; gap: 12px; width: 100%; }
.brand { font-weight: 800; font-size: 1.5rem; color: var(--aww-primary); letter-spacing: -.5px; white-space: nowrap; }
.brand span { color: var(--aww-secondary); }
.header-search { flex: 1; min-width: 0; }
.search-bar { display: flex; }
.search-bar input {
  flex: 1; min-width: 0; border: 1px solid var(--aww-border); border-right: none;
  border-radius: var(--aww-radius-sm) 0 0 var(--aww-radius-sm); padding: 10px 12px; font-size: 15px;
}
.search-bar button {
  background: var(--aww-primary); color: #fff; border: none;
  padding: 0 16px; border-radius: 0 var(--aww-radius-sm) var(--aww-radius-sm) 0;
  font-weight: 600; cursor: pointer;
}
.header-nav { display: flex; gap: 14px; align-items: center; }
.header-nav a { color: var(--aww-text); font-weight: 500; white-space: nowrap; }
.header-nav .btn { white-space: nowrap; }
/* hamburger (mobile) */
.nav-toggle {
  display: none; background: none; border: 1px solid var(--aww-border);
  border-radius: 8px; width: 40px; height: 40px; cursor: pointer; font-size: 20px; color: var(--aww-text);
}
.mobile-menu { display: none; flex-direction: column; gap: 4px; padding: 10px 16px; background: var(--aww-surface); border-bottom: 1px solid var(--aww-border); }
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 12px 8px; border-radius: 8px; color: var(--aww-text); font-weight: 600; }
.mobile-menu a:hover { background: var(--aww-surface-2); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--aww-radius-sm);
  font-weight: 600; border: 1px solid transparent; cursor: pointer; font-size: var(--aww-fs-base);
  min-height: var(--aww-tap); transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--aww-primary); color: #fff; }
.btn-primary:hover { background: var(--aww-primary-dark); text-decoration: none; }
.btn-secondary { background: var(--aww-surface); color: var(--aww-text); border-color: var(--aww-border); }
.btn-secondary:hover { background: var(--aww-surface-2); text-decoration: none; }
.btn-accent { background: var(--aww-accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); text-decoration: none; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 14px 26px; font-size: var(--aww-fs-lg); }
.btn-sm { padding: 7px 12px; font-size: var(--aww-fs-sm); min-height: 36px; }

/* ---------- Cards / grid ---------- */
.card { background: var(--aww-surface); border: 1px solid var(--aww-border); border-radius: var(--aww-radius); box-shadow: var(--aww-shadow); overflow: hidden; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- Product card ---------- */
.product-card { background: var(--aww-surface); border: 1px solid var(--aww-border); border-radius: var(--aww-radius); overflow: hidden; transition: box-shadow .2s, transform .2s; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--aww-shadow-md); transform: translateY(-2px); }
.product-card .thumb { aspect-ratio: 1/1; background: linear-gradient(135deg,#f3f5fa,#e9edf5); display: flex; align-items: center; justify-content: center; color: var(--aww-muted); font-size: var(--aww-fs-sm); }
.product-card .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .title { font-weight: 600; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.product-card .meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 800; color: var(--aww-secondary); font-size: var(--aww-fs-lg); }
.price .old { color: var(--aww-muted); font-weight: 500; text-decoration: line-through; font-size: var(--aww-fs-sm); margin-left: 6px; }
.rating { color: #f5a623; font-size: var(--aww-fs-sm); white-space: nowrap; }
.rating .count { color: var(--aww-muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: var(--aww-fs-xs); font-weight: 700; }
.badge-verified, .badge-success { background: #e6f7f1; color: var(--aww-success); }
.badge-warning { background: #fff4e0; color: var(--aww-warning); }
.badge-firstparty { background: #eaf0ff; color: var(--aww-primary); }

/* ---------- Sections ---------- */
.section { padding: 28px 0; }
.section-title { font-size: var(--aww-fs-2xl); margin: 0 0 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.hero { text-align: center; padding: 64px 20px; background: linear-gradient(135deg,#eef2ff,#e6f7f1); border-radius: var(--aww-radius-lg); }
.hero h1 { font-size: clamp(2rem, 6vw, var(--aww-fs-4xl)); margin: 0 0 12px; letter-spacing: -.5px; }
.hero p { color: var(--aww-muted); font-size: var(--aww-fs-lg); margin: 0 0 24px; max-width: 640px; margin-inline: auto; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: var(--aww-fs-sm); }
.input { width: 100%; padding: 11px 13px; border: 1px solid var(--aww-border); border-radius: var(--aww-radius-sm); font-size: 15px; background: var(--aww-surface); }
.input:focus { outline: 2px solid var(--aww-primary); outline-offset: -1px; border-color: var(--aww-primary); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--aww-muted) 50%), linear-gradient(135deg, var(--aww-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }

/* Image upload (seller product form) */
.img-upload { display: flex; flex-direction: column; gap: 10px; }
.img-preview { width: 140px; height: 140px; border: 2px dashed var(--aww-border); border-radius: var(--aww-radius); background: var(--aww-surface); display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--aww-muted); overflow: hidden; }
.img-upload input[type="file"] { max-width: 320px; font-size: 14px; }
.form-actions { display: flex; gap: 12px; margin-top: 18px; }

/* Categories — horizontal chips */
.cat-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chip { display: inline-flex; align-items: center; padding: 9px 16px; border: 1px solid var(--aww-border); border-radius: 999px; background: var(--aww-surface); color: var(--aww-text); text-decoration: none; font-size: 14px; font-weight: 600; transition: background .15s, border-color .15s, transform .15s; }
.chip:hover { border-color: var(--aww-primary); color: var(--aww-primary); transform: translateY(-1px); }
.chip-more { cursor: pointer; background: var(--aww-primary); color: #fff; border-color: var(--aww-primary); }
.chip-more:hover { color: #fff; filter: brightness(1.05); }
.cat-more { display: none; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cat-more.open { display: flex; }

/* ---------- States ---------- */
.empty-state, .error-state { text-align: center; padding: 48px 16px; color: var(--aww-muted); }
.alert { padding: 12px 14px; border-radius: var(--aww-radius-sm); margin-bottom: 12px; font-weight: 500; }
.alert-error { background: #fdeaea; color: var(--aww-error); border: 1px solid #f6c9c9; }
.alert-success { background: #e6f7f1; color: var(--aww-success); border: 1px solid #bfe6d6; }
.alert-info { background: #eaf0ff; color: var(--aww-primary); border: 1px solid #c9d8ff; }

/* ---------- Footer ---------- */
.site-footer { background: var(--aww-surface); border-top: 1px solid var(--aww-border); margin-top: 48px; padding: 32px 0 24px; color: var(--aww-muted); font-size: var(--aww-fs-sm); }
.site-footer a { color: var(--aww-muted); }
.footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.footer-cols h4 { font-size: var(--aww-fs-sm); color: var(--aww-text); margin-bottom: 10px; }
.footer-cols a { display: block; padding: 4px 0; }

/* ---------- AREA SKINS ---------- */
body.area-sell { --aww-accent: #7b2bff; }
body.area-seller { --aww-bg: #f3f4f8; }
body.area-admin { --aww-bg: #eef0f4; }

/* ---------- Seller Central & Admin layouts (responsive) ---------- */
.sc-layout, .ad-layout { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - var(--aww-header-h)); }
.sc-sidebar, .ad-sidebar { background: #11152b; color: #cfd4e8; padding: 18px 0; }
.sc-sidebar a, .ad-sidebar a { color: #cfd4e8; display: block; padding: 11px 20px; font-weight: 500; border-left: 3px solid transparent; }
.sc-sidebar a:hover, .sc-sidebar a.active, .ad-sidebar a:hover, .ad-sidebar a.active { background: #1d2547; color: #fff; text-decoration: none; border-left-color: var(--aww-primary); }
.sidebar-brand { padding: 0 20px 14px; font-weight: 800; color: #fff; font-size: 1.1rem; }
.sc-main, .ad-main { padding: 24px; overflow-x: auto; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.stat { background: var(--aww-surface); border: 1px solid var(--aww-border); border-radius: var(--aww-radius); padding: 18px; }
.stat .n { font-size: var(--aww-fs-3xl); font-weight: 800; line-height: 1; }
.stat .l { color: var(--aww-muted); font-size: var(--aww-fs-sm); margin-top: 6px; }
.stat-accent { border-top: 3px solid var(--aww-primary); }
.stat-success { border-top: 3px solid var(--aww-success); }
.stat-warning { border-top: 3px solid var(--aww-warning); }

/* tables */
.table { width: 100%; border-collapse: collapse; background: var(--aww-surface); border-radius: var(--aww-radius); overflow: hidden; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--aww-border); font-size: var(--aww-fs-sm); }
.table th { background: var(--aww-surface-2); font-weight: 700; }
.table tr:last-child td { border-bottom: none; }

/* =================== RESPONSIVE =================== */
@media (max-width: 1100px) {
  .grid-cols-5, .grid-cols-4 { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .header-nav { display: none; }
  .header-search { order: 3; flex-basis: 100%; }
  .site-header .container { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
  /* when search wraps, keep brand + toggle on first row */
  .brand { order: 1; }
  .nav-toggle { order: 2; margin-left: auto; }
  .grid-cols-3, .grid-cols-5, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  /* Sidebars collapse to top bar on mobile */
  .sc-layout, .ad-layout { grid-template-columns: 1fr; }
  .sc-sidebar, .ad-sidebar { padding: 8px 0; }
  .sc-sidebar a, .ad-sidebar a { display: inline-block; padding: 8px 14px; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar-brand { display: none; }
}
@media (max-width: 560px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-5 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 16px; }
  .btn-row .btn { width: 100%; }
  .section { padding: 20px 0; }
  .sc-main, .ad-main { padding: 16px; }
  .card-body { padding: 14px; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  /* product card image a bit smaller on tiny screens handled by aspect-ratio */
}

/* =================== DARK MODE (gap #11) =================== */
:root {
  --aww-bg-dark: #0f1115;
  --aww-surface-dark: #171a21;
  --aww-surface-2-dark: #1f2430;
  --aww-border-dark: #2a3140;
  --aww-text-dark: #e7eaf0;
  --aww-muted-dark: #9aa3b2;
  --aww-shadow-dark: 0 1px 3px rgba(0,0,0,.4);
}
html[data-theme="dark"] {
  --aww-bg: var(--aww-bg-dark);
  --aww-surface: var(--aww-surface-dark);
  --aww-surface-2: var(--aww-surface-2-dark);
  --aww-border: var(--aww-border-dark);
  --aww-text: var(--aww-text-dark);
  --aww-muted: var(--aww-muted-dark);
  --aww-shadow: var(--aww-shadow-dark);
}
html[data-theme="dark"] body { background: var(--aww-bg); color: var(--aww-text); }
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .site-footer,
html[data-theme="dark"] .card,
html[data-theme="dark"] .product-card,
html[data-theme="dark"] .input,
html[data-theme="dark"] .table,
html[data-theme="dark"] .mobile-menu { background: var(--aww-surface); }
html[data-theme="dark"] .hero { background: linear-gradient(135deg,#1a2030,#16241f); }
html[data-theme="dark"] .product-card .thumb { background: linear-gradient(135deg,#222838,#1b2030); }

/* theme toggle button (in header, beside language) */
.theme-toggle {
  background: none; border: 1px solid var(--aww-border); border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; font-size: 18px; color: var(--aww-text);
  display: inline-flex; align-items: center; justify-content: center;
}
