/* ============================================================
   LOCAL SHOP MARKETPLACE - Main CSS (Mobile First PWA)
   ============================================================ */

:root {
  --primary: #FF6B35;
  --primary-dark: #e55a25;
  --secondary: #2C3E50;
  --success: #27AE60;
  --danger: #E74C3C;
  --warning: #F39C12;
  --info: #2980B9;
  --light: #F8F9FA;
  --dark: #212529;
  --gray: #6C757D;
  --border: #DEE2E6;
  --white: #FFFFFF;
  --shadow: 0 2px 15px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Noto Sans', 'Noto Sans Devanagari', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: #F0F2F5;
  color: var(--dark);
  min-height: 100vh;
  padding-bottom: 70px; /* bottom nav space */
  -webkit-tap-highlight-color: transparent;
}

/* ---- TOP HEADER ---- */
.app-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(255,107,53,0.3);
}
.app-header .logo { font-size: 20px; font-weight: 700; }
.app-header .logo span { font-size: 12px; font-weight: 400; display: block; opacity: 0.9; }
.app-header .header-actions { display: flex; gap: 16px; align-items: center; }
.app-header .header-actions a { color: white; font-size: 20px; position: relative; }
.cart-badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--secondary); color: white;
  font-size: 10px; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ---- BOTTOM NAV (App-like) ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 8px 4px;
  color: var(--gray); text-decoration: none; font-size: 10px;
}
.bottom-nav a i { display: block; font-size: 20px; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--primary); }

/* ---- SEARCH BAR ---- */
.search-section { padding: 12px 16px; background: var(--primary); padding-top: 0; }
.search-box {
  display: flex; align-items: center;
  background: white; border-radius: 25px;
  padding: 8px 16px; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.search-box input {
  border: none; outline: none; flex: 1;
  font-size: 14px; font-family: var(--font);
}
.search-box i { color: var(--gray); font-size: 16px; }

/* ---- BANNER SLIDER ---- */
.banner-slider { overflow-x: auto; display: flex; gap: 12px; padding: 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.banner-slider::-webkit-scrollbar { display: none; }
.banner-item {
  min-width: 90vw; height: 160px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  scroll-snap-align: start; overflow: hidden; position: relative; flex-shrink: 0;
}
.banner-item img { width: 100%; height: 100%; object-fit: cover; }

/* ---- SECTION TITLE ---- */
.section-header { padding: 0 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 16px; font-weight: 700; }
.section-link { font-size: 13px; color: var(--primary); text-decoration: none; }

/* ---- CATEGORY CHIPS ---- */
.categories-scroll { overflow-x: auto; display: flex; gap: 10px; padding: 0 16px 16px; scrollbar-width: none; }
.categories-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 70px; padding: 10px 8px;
  background: white; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); text-decoration: none; color: var(--dark);
  flex-shrink: 0; transition: transform 0.2s;
}
.cat-chip:active { transform: scale(0.95); }
.cat-chip i { font-size: 22px; color: var(--primary); }
.cat-chip span { font-size: 11px; text-align: center; font-weight: 500; }

/* ---- SHOP CARDS ---- */
.shops-grid { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.shop-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  text-decoration: none; color: var(--dark);
  display: flex; transition: transform 0.2s;
}
.shop-card:active { transform: scale(0.98); }
.shop-card-img {
  width: 90px; height: 90px; object-fit: cover; flex-shrink: 0;
}
.shop-card-img-placeholder {
  width: 90px; height: 90px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; background: #FFF3EE;
}
.shop-card-body { padding: 10px 12px; flex: 1; }
.shop-card-name { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.shop-card-cat { font-size: 12px; color: var(--gray); margin-bottom: 6px; }
.shop-card-meta { display: flex; gap: 12px; font-size: 12px; }
.shop-card-meta span { display: flex; align-items: center; gap: 4px; }
.shop-card-meta .rating { color: #F39C12; }
.shop-card-meta .closed { color: var(--danger); }
.shop-card-meta .open { color: var(--success); }

/* ---- SHOP PAGE (Mini Website feel) ---- */
.shop-header {
  background: var(--primary);
  color: white; padding: 16px;
  position: sticky; top: 0; z-index: 100;
}
.shop-banner { width: 100%; height: 180px; object-fit: cover; }
.shop-info { padding: 16px; background: white; margin-bottom: 8px; }
.shop-name { font-size: 20px; font-weight: 700; }
.shop-address { font-size: 13px; color: var(--gray); margin-top: 4px; }
.shop-open-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 6px;
}
.shop-open-badge.open { background: #E8F8F0; color: var(--success); }
.shop-open-badge.closed { background: #FDE8E8; color: var(--danger); }

/* ---- PRODUCT CARDS ---- */
.products-section { padding: 0 16px; }
.product-category-title {
  font-size: 14px; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 16px 0 8px;
}
.product-card {
  background: white; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 12px;
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 10px;
}
.product-img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.product-img-placeholder {
  width: 70px; height: 70px; border-radius: 8px; flex-shrink: 0;
  background: #FFF3EE; display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.product-info { flex: 1; }
.product-name { font-size: 14px; font-weight: 600; }
.product-unit { font-size: 12px; color: var(--gray); }
.product-price { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.product-price .original { font-size: 12px; color: var(--gray); text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.product-price .out { font-size: 12px; color: var(--danger); font-weight: 500; }
.add-btn {
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.add-btn:active { background: var(--primary-dark); }
.qty-control {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.qty-control button {
  background: var(--primary); color: white; border: none;
  width: 28px; height: 28px; border-radius: 6px;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.qty-control span { font-size: 16px; font-weight: 700; min-width: 20px; text-align: center; }

/* ---- CART ---- */
.cart-summary {
  position: fixed; bottom: 70px; left: 16px; right: 16px;
  background: var(--secondary); color: white;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 99; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.cart-summary .cart-info .count { font-size: 12px; opacity: 0.8; }
.cart-summary .cart-info .price { font-size: 16px; font-weight: 700; }
.cart-summary .view-cart-btn {
  background: var(--primary); color: white; border: none;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer;
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--secondary); }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; font-family: var(--font);
  outline: none; transition: border 0.2s;
}
.form-control:focus { border-color: var(--primary); }
.btn-primary {
  background: var(--primary); color: white; border: none;
  padding: 14px; border-radius: var(--radius-sm); font-size: 16px;
  font-weight: 600; width: 100%; cursor: pointer; font-family: var(--font);
  transition: background 0.2s;
}
.btn-primary:active { background: var(--primary-dark); }

/* ---- CARDS GENERIC ---- */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.card-body { padding: 16px; }
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-warning { background: #FEF9E7; color: var(--warning); }
.badge-success { background: #E8F8F0; color: var(--success); }
.badge-danger { background: #FDEDEC; color: var(--danger); }
.badge-info { background: #EAF4FC; color: var(--info); }
.badge-primary { background: #FFF3EE; color: var(--primary); }
.badge-purple { background: #F5EEF8; color: #8E44AD; }

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-gray { color: var(--gray); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.p-3 { padding: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.page-padding { padding: 16px; }
.empty-state { text-align: center; padding: 60px 24px; color: var(--gray); }
.empty-state i { font-size: 60px; color: var(--border); margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ---- ORDER STATUS STEPS ---- */
.order-steps { display: flex; justify-content: space-between; padding: 16px 0; position: relative; }
.order-steps::before {
  content: ''; position: absolute; top: 24px; left: 10%; right: 10%;
  height: 2px; background: var(--border);
}
.step { flex: 1; text-align: center; position: relative; z-index: 1; }
.step-icon {
  width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--gray); font-size: 14px;
}
.step.done .step-icon { background: var(--success); color: white; }
.step.active .step-icon { background: var(--primary); color: white; }
.step-label { font-size: 10px; color: var(--gray); }
.step.done .step-label, .step.active .step-label { color: var(--dark); font-weight: 600; }

/* ---- DASHBOARD (Shop/Admin) ---- */
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); text-align: center;
}
.stat-card .stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--gray); margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }

/* ---- TOGGLE SWITCH ---- */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border); border-radius: 26px; transition: .3s;
}
.toggle-slider:before {
  position: absolute; content: "";
  height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .3s;
}
input:checked + .toggle-slider { background: var(--success); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ---- DESKTOP VIEW ---- */
@media (min-width: 768px) {
  body { max-width: 480px; margin: 0 auto; background: #E0E0E0; }
  .app-header { max-width: 480px; left: 50%; transform: translateX(-50%); width: 100%; }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .cart-summary { max-width: 448px; left: 50%; transform: translateX(-50%); }
}
