/* Core design tokens (variables) and theme system */
:root{
  --accent: #0b7fab;
  --accent-2: #ff7a59;
  --bg: #f7f9fb;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #0f1724;
  --shadow: rgba(14,30,37,0.04);
  --max-w: 1100px;
  --radius: 12px;
  --ui-radius: 10px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Warm theme overrides */
:root[data-theme="warm"], body[data-theme="warm"] {
  --accent: #c94f3f;
  --accent-2: #ffb36b;
  --bg: #fff7f3;
  --muted: #7a6350;
  --text: #2b1f18;
  --shadow: rgba(43,31,24,0.04);
}

/* Dark theme overrides */
:root[data-theme="dark"], body[data-theme="dark"] {
  --accent: #6ee7b7;
  --accent-2: #34d399;
  --bg: #0b1221;
  --card: #0f1724;
  --muted: #94a3b8;
  --text: #e6eef8;
  --shadow: rgba(0,0,0,0.6);
}

/* Base layout */
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:var(--bg);color:var(--text)}
a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
.wrap{max-width:var(--max-w);margin:20px auto;padding:0 16px}

/* header */
header{display:flex;align-items:center;justify-content:space-between;gap:16px}
.brand{display:flex;align-items:center;gap:12px}
.logo{
  width:56px;
  height:56px;
  border-radius:12px;
  background:#fff;
  border:1px solid rgba(0,0,0,0.06);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 6px 18px var(--shadow);
  overflow:hidden;
}

.logo-img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:6px;
  display:block;
}
.title{font-size:18px;font-weight:700}
.small-txt{font-size:12px;color:var(--muted)}
.nav{display:flex;gap:12px;align-items:center}
.nav-link{padding:8px 12px;border-radius:8px;font-weight:600;color:var(--muted)}
.nav-link:hover{background:rgba(0,0,0,0.03);color:var(--accent)}

.actions{display:flex;gap:8px;align-items:center}
.search{position:relative}
.search input{padding:8px 36px 8px 12px;border-radius:var(--ui-radius);border:1px solid rgba(0,0,0,0.06);background:var(--card);color:var(--text)}
.icon{position:absolute;right:8px;top:50%;transform:translateY(-50%);opacity:.6;color:var(--muted)}

button.btn{padding:8px 12px;border-radius:10px;border:0;background:var(--accent);color:white;font-weight:700;cursor:pointer;box-shadow:0 6px 14px var(--shadow)}
button.ghost{background:transparent;border:1px solid rgba(0,0,0,0.06);color:var(--muted);cursor:pointer}

/* theme selector */
.theme-select{padding:6px;border-radius:8px;border:1px solid rgba(0,0,0,0.06);background:var(--card);color:var(--text)}

/* hero */
.hero{display:grid;grid-template-columns:1fr;gap:18px;align-items:center;background:linear-gradient(180deg,rgba(11,127,171,0.06),transparent);padding:18px;border-radius:var(--radius)}
.hero h1{margin:0;font-size:26px}
.hero p{margin:6px 0 0;color:var(--muted)}
.featured-box{background:linear-gradient(180deg,#fff,#f6fbfd);padding:12px;border-radius:12px}

/* categories */
.categories{display:flex;gap:10px;overflow:auto;padding:8px 0}
.cat{min-width:130px;background:var(--card);padding:12px;border-radius:12px;box-shadow:0 1px 2px var(--shadow);text-align:center}
.cat small{display:block;color:var(--muted);margin-top:6px}

/* grouped categories / products */
.prod-header{display:flex;justify-content:space-between;align-items:center;margin-top:18px}
#productGrid{margin-top:12px;display:flex;flex-direction:column;gap:16px}
.category-section{background:var(--card);padding:12px;border-radius:12px;box-shadow:0 6px 18px var(--shadow)}
.category-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.products-row{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}

/* product card */
.card{background:transparent;padding:0;border-radius:8px;display:flex;gap:12px;align-items:center}
.card-inner{background:var(--card);padding:12px;border-radius:12px;display:flex;gap:12px;align-items:center;width:100%;box-shadow:0 4px 10px var(--shadow)}
.card .img{width:80px;height:80px;border-radius:8px;background:linear-gradient(135deg,rgba(0,0,0,0.02),rgba(0,0,0,0.01));display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--muted);font-size:18px}
.card .meta{flex:1}
.card h3{margin:0;font-size:16px}
.price{font-weight:800;margin-top:6px}
.card .cta{display:flex;flex-direction:column;gap:8px}

/* cart & modal */
.cart-btn{position:relative}
.badge{position:absolute;top:-6px;right:-6px;background:var(--accent-2);color:white;border-radius:999px;padding:4px 7px;font-size:12px}

.modal{position:fixed;left:0;right:0;top:0;bottom:0;display:none;align-items:center;justify-content:center;background:rgba(2,6,23,0.4);z-index:60}
.modal .panel{width:95%;max-width:700px;background:var(--card);padding:16px;border-radius:12px;box-shadow:0 12px 30px rgba(2,6,23,0.25)}
.modal-head{display:flex;justify-content:space-between;align-items:center}

/* billing panel (compact, large controls) */
.billing-panel{
  position:fixed;
  right:18px;
  top:80px;
  width:360px;
  max-height:75vh;
  overflow:auto;
  background:var(--card);
  border-radius:12px;
  box-shadow:0 18px 40px rgba(2,6,23,0.25);
  padding:12px;
  z-index:200;
  display:none;
}
.billing-panel[aria-hidden="false"]{display:block}

.billing-header{display:flex;justify-content:space-between;align-items:center;gap:8px}
.billing-actions{display:flex;gap:8px;align-items:center}

.billing-items{margin-top:12px;display:flex;flex-direction:column;gap:8px}
.billing-row{display:flex;align-items:center;gap:8px;padding:8px;border-radius:10px;background:linear-gradient(180deg,rgba(0,0,0,0.01),transparent)}
.billing-row .label{flex:1}
.qty-controls{display:flex;align-items:center;gap:6px}
.qty-btn{width:36px;height:36px;border-radius:8px;border:0;background:var(--accent);color:white;font-weight:800;font-size:18px;cursor:pointer}
.qty-display{min-width:36px;text-align:center;font-weight:700}

/* billing summary */
.billing-summary{margin-top:12px;padding-top:12px;border-top:1px dashed rgba(0,0,0,0.06)}
.billing-summary .row{margin-top:6px}

/* responsive adjustments for small screens */
@media (max-width:700px){
  .billing-panel{right:10px;left:10px;width:auto;top:70px;max-height:65vh}
}

/* print styles: hide UI chrome, show receipt cleanly */
@media print {
  body * { visibility: hidden; }
  .printable-receipt, .printable-receipt * { visibility: visible; }
  .printable-receipt { position: absolute; left:0; top:0; width:100%; background: white; color: black; padding: 18px; }
}

.imgbox{
  width:70px;
  height:70px;
  border-radius:10px;
  overflow:hidden;
  background:#f3f4f6;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.imgbox img{
  width:100%;
  height:100%;
  object-fit:cover;
}


/* helpers */
.muted{color:var(--muted)}
.center{display:flex;align-items:center;justify-content:center}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* responsive product grid */
@media (min-width:700px){
  .hero{grid-template-columns:1fr}
  .products-row{grid-template-columns:repeat(3,1fr)}
}
@media (min-width:1000px){
  .products-row{grid-template-columns:repeat(4,1fr)}
}
