:root{
  --blue:#2563eb;
  --dark:#1f2937;
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family: Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* ================= HEADER ================= */

.topbar{
  background: linear-gradient(to right, var(--dark), var(--blue));
  color:#fff;
  padding:16px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}

.brand h1{
  margin:0;
  font-size:18px;
}

.tagline{
  margin:2px 0 0;
  font-size:12px;
  opacity:.9;
}

.logo{
  font-size:26px;
}

.cart-btn{
  background:#fff;
  color:var(--blue);
  border:0;
  padding:10px 14px;
  border-radius:8px;
  font-weight:700;
  cursor:pointer;
  display:flex;
  gap:8px;
  align-items:center;
}

.badge{
  background:var(--blue);
  color:#fff;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
}

.back-link{
  color:#e5e7eb;
  font-size:13px;
  text-decoration:none;
  font-weight:600;
}

.back-link:hover{
  text-decoration:underline;
}

/* ================= LAYOUT ================= */

.container{
  max-width:1050px;
  margin:0 auto;
  padding:20px;
}

.hero{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
  margin-bottom:16px;
}

.hero h2{
  margin:0 0 6px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap:16px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.thumb{
  height:140px;
  border-radius:10px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:40px;
}

.card h3{
  margin:0;
  font-size:16px;
}

.card p{
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}

.price-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:6px;
}

.price{
  font-weight:800;
}

.btn{
  background:var(--blue);
  color:#fff;
  border:0;
  padding:10px 12px;
  border-radius:8px;
  cursor:pointer;
  font-weight:700;
}

/* ================= CART OVERLAY ================= */

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

.cart-overlay.show{
  display:block;
}

/* ================= CART DRAWER ================= */

.cart-drawer{
  position:fixed;
  top:0;
  right:-100%;
  width:100%;
  max-width:420px;
  height:100dvh; /* iPhone safe */
  background:#fff;
  border-left:1px solid var(--border);
  transition:right .3s ease;
  display:flex;
  flex-direction:column;
  z-index:9999;
}

.cart-drawer.open{
  right:0;
}

/* ================= CART CONTENT ================= */

.cart-header{
  padding:14px;
  border-bottom:1px solid var(--border);
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.close-btn{
  background:transparent;
  border:0;
  font-size:22px;
  cursor:pointer;
}

.cart-items{
  flex:1;
  overflow-y:auto;
  -webkit-overflow-scrolling: touch;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.cart-item{
  display:flex;
  gap:10px;
  align-items:flex-start;
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px;
}

.cart-item .mini{
  width:48px;
  height:48px;
  border-radius:10px;
  background:#eff6ff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
}

.cart-item h4{
  margin:0;
  font-size:14px;
}

.cart-item small{
  color:var(--muted);
}

.qty-row{
  margin-top:6px;
  display:flex;
  gap:8px;
  align-items:center;
}

.qty-btn{
  width:28px;
  height:28px;
  border:1px solid var(--border);
  background:#fff;
  border-radius:6px;
  cursor:pointer;
  font-weight:800;
}

.cart-footer{
  border-top:1px solid var(--border);
  padding:14px;
  background:#fff;
  position:sticky;
  bottom:0;
}

.total-row{
  display:flex;
  justify-content:space-between;
  margin-bottom:10px;
}

.primary{
  width:100%;
  background:var(--blue);
  border:0;
  color:#fff;
  padding:12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:800;
}

.note{
  margin:10px 0 0;
  font-size:12px;
  color:var(--muted);
  text-align:center;
}

/* ================= MODAL ================= */

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:10000;
}

.modal-backdrop.show{
  display:flex;
}

.modal{
  background:#fff;
  border-radius:12px;
  width:560px;
  max-width:95%;
  padding:16px;
}

.summary{
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px;
  margin:10px 0 14px;
  font-size:14px;
  line-height:1.5;
}

/* ================= MOBILE ================= */

@media (max-width:768px){

  .cart-drawer{
    width:100vw;
    max-width:100vw;
  }

  .close-btn{
    font-size:26px;
    padding:10px;
  }

  .primary{
    font-size:16px;
    padding:14px;
  }
}
