/* =========================================================
   QuickMart - Modern Indian Quick-Commerce UI Design System
   PHP 8+ / PWA / Bootstrap 5 Enhanced
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  --qm-primary: #0c831f;
  --qm-primary-hover: #096317;
  --qm-primary-light: #e8f5e9;
  --qm-primary-gradient: linear-gradient(135deg, #0c831f 0%, #15803d 100%);
  --qm-secondary: #facc15;
  --qm-secondary-dark: #ca8a04;
  --qm-accent-red: #ef4444;
  --qm-accent-blue: #2563eb;
  --qm-bg-light: #f4f6f8;
  --qm-card-bg: #ffffff;
  --qm-text-main: #111827;
  --qm-text-muted: #64748b;
  --qm-text-sub: #94a3b8;
  --qm-border-color: #e2e8f0;
  --qm-radius-sm: 8px;
  --qm-radius-md: 14px;
  --qm-radius-lg: 20px;
  --qm-radius-full: 9999px;
  --qm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --qm-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --qm-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --qm-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bottom-bar-height: 65px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--qm-font-family);
  background-color: var(--qm-bg-light);
  color: var(--qm-text-main);
  line-height: 1.5;
  font-size: 14px;
  padding-bottom: calc(var(--bottom-bar-height) + 50px);
  -webkit-font-smoothing: antialiased;
}

/* App Container Wrapper (Constrained for Desktop & Fluid on Mobile) */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: #ffffff;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 992px) {
  .app-container {
    max-width: 760px;
  }
}

a {
  text-decoration: none;
  color: inherit;
}

/* ---------------------------------------------------------
   Top Header & Location Bar
   --------------------------------------------------------- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: #ffffff;
  border-bottom: 1px solid var(--qm-border-color);
  padding: 10px 16px;
  box-shadow: var(--qm-shadow-sm);
}

.location-pill {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--qm-radius-md);
  transition: background-color 0.2s;
}

.location-pill:hover {
  background-color: #f8fafc;
}

.delivery-badge {
  background: #000000;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--qm-radius-full);
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.delivery-badge span.bolt {
  color: var(--qm-secondary);
  font-size: 13px;
}

.location-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--qm-text-main);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.location-subtext {
  font-size: 11px;
  color: var(--qm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--qm-text-main);
  font-size: 18px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.icon-btn .badge-pill {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--qm-accent-red);
  color: white;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
}

/* Search Bar in Header */
.search-header-box {
  margin-top: 8px;
  position: relative;
}

.search-input-pill {
  width: 100%;
  height: 46px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--qm-radius-md);
  padding: 0 45px 0 42px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--qm-text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-input-pill:focus {
  background: #ffffff;
  border-color: var(--qm-primary);
  box-shadow: 0 0 0 3px rgba(12, 131, 31, 0.15);
}

.search-icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--qm-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-clear-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--qm-text-sub);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}

/* ---------------------------------------------------------
   Hero Banner Carousel
   --------------------------------------------------------- */
.hero-banner-card {
  border-radius: var(--qm-radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 155px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px;
  box-shadow: var(--qm-shadow-md);
  background-size: cover;
  background-position: center;
}

.hero-banner-badge {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--qm-radius-full);
  display: inline-block;
  margin-bottom: 8px;
  align-self: flex-start;
}

.hero-banner-title {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 4px;
}

.hero-banner-sub {
  font-size: 12px;
  opacity: 0.9;
  max-width: 80%;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------
   Category Grid & Pills
   --------------------------------------------------------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
}

@media (min-width: 576px) {
  .cat-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.cat-item:active {
  transform: scale(0.94);
}

.cat-img-box {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--qm-shadow-sm);
  position: relative;
}

.cat-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.cat-item:hover .cat-img-box img {
  transform: scale(1.08);
}

.cat-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--qm-text-main);
  line-height: 1.2;
  max-width: 74px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------
   Product Cards & Quick Add
   --------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--qm-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--qm-primary);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 576px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

.product-card {
  background: #ffffff;
  border: 1px solid #eef2f6;
  border-radius: var(--qm-radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: var(--qm-shadow-sm);
}

.product-card:hover {
  box-shadow: var(--qm-shadow-md);
  border-color: #cbd5e1;
}

.prod-badge-discount {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #0284c7;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--qm-radius-sm);
  z-index: 2;
}

.prod-badge-veg {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  border: 1.5px solid #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  z-index: 2;
  background: white;
}

.prod-badge-veg::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #16a34a;
  border-radius: 50%;
}

.prod-badge-nonveg {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  border: 1.5px solid #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  z-index: 2;
  background: white;
}

.prod-badge-nonveg::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #dc2626;
  border-radius: 50%;
}

.product-img-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  position: relative;
}

.product-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.product-card:hover .product-img-box img {
  transform: scale(1.04);
}

.prod-eta {
  font-size: 10px;
  font-weight: 800;
  color: #0f172a;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  align-self: flex-start;
  margin-bottom: 4px;
}

.prod-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--qm-text-main);
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
}

.prod-unit {
  font-size: 11px;
  color: var(--qm-text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

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

.prod-price-box {
  display: flex;
  flex-direction: column;
}

.prod-selling-price {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--qm-text-main);
}

.prod-mrp {
  font-size: 11px;
  color: var(--qm-text-sub);
  text-decoration: line-through;
  font-weight: 500;
}

/* Blinkit Style ADD & Counter Button */
.btn-add-cart {
  background: #ffffff;
  color: var(--qm-primary);
  border: 1.5px solid var(--qm-primary);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--qm-radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 68px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-add-cart:hover {
  background: var(--qm-primary-light);
}

.qty-counter-box {
  background: var(--qm-primary);
  color: #ffffff;
  border-radius: var(--qm-radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  min-width: 78px;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(12, 131, 31, 0.3);
}

.qty-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.qty-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.qty-val {
  font-size: 12.5px;
  font-weight: 800;
  color: #ffffff;
  min-width: 18px;
  text-align: center;
}

/* ---------------------------------------------------------
   Sticky Bottom Bar & Floating Cart Widget
   --------------------------------------------------------- */
.floating-cart-bar {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 568px;
  background: var(--qm-primary);
  color: #ffffff;
  border-radius: var(--qm-radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(12, 131, 31, 0.35);
  z-index: 1010;
  cursor: pointer;
  animation: slideUp 0.3s ease;
  transition: all 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.floating-cart-bar:hover {
  background: var(--qm-primary-hover);
}

.cart-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-bar-count {
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: var(--qm-radius-full);
  text-transform: uppercase;
}

.cart-bar-total {
  font-size: 15px;
  font-weight: 800;
}

.cart-bar-savings {
  font-size: 10.5px;
  color: var(--qm-secondary);
  font-weight: 700;
}

.cart-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: var(--bottom-bar-height);
  background: #ffffff;
  border-top: 1px solid var(--qm-border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

@media (min-width: 992px) {
  .bottom-nav {
    max-width: 760px;
  }
}

.nav-item-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--qm-text-muted);
  font-size: 10.5px;
  font-weight: 700;
  gap: 3px;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: color 0.15s;
  position: relative;
}

.nav-item-btn i {
  font-size: 20px;
  transition: transform 0.15s;
}

.nav-item-btn.active {
  color: var(--qm-primary);
}

.nav-item-btn.active i {
  transform: translateY(-2px);
}

.nav-item-btn .nav-cart-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--qm-primary);
  color: white;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

/* ---------------------------------------------------------
   Cart Page & Bill Details
   --------------------------------------------------------- */
.bill-card {
  background: #ffffff;
  border-radius: var(--qm-radius-md);
  padding: 16px;
  border: 1px solid var(--qm-border-color);
  margin-bottom: 16px;
}

.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--qm-text-muted);
}

.bill-row.total {
  border-top: 1px dashed var(--qm-border-color);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--qm-text-main);
}

.savings-ribbon {
  background: #dcfce7;
  color: #14532d;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--qm-radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

/* Coupon Box */
.coupon-input-group {
  display: flex;
  gap: 8px;
}

.coupon-input {
  flex: 1;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ---------------------------------------------------------
   Order Tracking & Steps
   --------------------------------------------------------- */
.order-tracker-box {
  background: #ffffff;
  border-radius: var(--qm-radius-lg);
  padding: 20px;
  border: 1px solid var(--qm-border-color);
  box-shadow: var(--qm-shadow-sm);
}

.step-tracker {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  margin: 20px 0;
}

.step-tracker::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e2e8f0;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px #e2e8f0;
}

.step-item.completed .step-dot {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 0 0 2px #16a34a;
}

.step-item.active .step-dot {
  background: var(--qm-primary);
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(12, 131, 31, 0.3);
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.step-content h6 {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.step-content p {
  font-size: 11.5px;
  color: var(--qm-text-muted);
}

/* Delivery OTP Card */
.otp-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border-radius: var(--qm-radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--qm-shadow-md);
  margin-bottom: 16px;
}

.otp-number {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--qm-secondary);
}

/* Delivery Map Container */
#tracking-map, #location-picker-map {
  width: 100%;
  height: 240px;
  border-radius: var(--qm-radius-md);
  overflow: hidden;
  border: 1px solid var(--qm-border-color);
  z-index: 1;
}

/* ---------------------------------------------------------
   Invoice Print Styling
   --------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    padding: 0 !important;
  }
  .app-container {
    max-width: 100% !important;
    box-shadow: none !important;
  }
  .top-header, .bottom-nav, .floating-cart-bar, .no-print {
    display: none !important;
  }
  .invoice-box {
    border: none !important;
    padding: 0 !important;
  }
}

/* ---------------------------------------------------------
   PWA Install Toast / Banner
   --------------------------------------------------------- */
.pwa-prompt-banner {
  background: #ffffff;
  border-radius: var(--qm-radius-md);
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  box-shadow: var(--qm-shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 16px;
}

/* Form Controls & Buttons */
.btn-primary-qm {
  background: var(--qm-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--qm-radius-md);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 800;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary-qm:hover {
  background: var(--qm-primary-hover);
  color: #ffffff;
}

.btn-outline-qm {
  background: #ffffff;
  color: var(--qm-primary);
  border: 1.5px solid var(--qm-primary);
  border-radius: var(--qm-radius-md);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-outline-qm:hover {
  background: var(--qm-primary-light);
  color: var(--qm-primary);
}

.form-control-qm {
  border: 1.5px solid var(--qm-border-color);
  border-radius: var(--qm-radius-md);
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--qm-text-main);
  outline: none;
  transition: all 0.2s;
  width: 100%;
}

.form-control-qm:focus {
  border-color: var(--qm-primary);
  box-shadow: 0 0 0 3px rgba(12, 131, 31, 0.12);
}
