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

:root {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.12);
  --primary-glow: rgba(16, 185, 129, 0.35);
  --accent: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.12);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.85);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-glass: rgba(226, 232, 240, 0.8);
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 10px 25px var(--primary-glow);
}

/* Telegram Dark Mode qo'llab-quvvatlash */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #0b0f19;
    --bg-card: #131b2e;
    --bg-card-glass: rgba(19, 27, 46, 0.88);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --border-glass: rgba(30, 41, 59, 0.8);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 90px;
  overflow-x: hidden;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 14px 18px;
  transition: all 0.3s ease;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:active {
  transform: scale(0.92);
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Search Bar */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.clear-search {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  font-size: 1.1rem;
}

/* Banner / Hero */
.hero-banner {
  margin: 14px 16px 8px 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #059669 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(4, 120, 87, 0.25);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.banner-content h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.banner-content p {
  font-size: 0.78rem;
  opacity: 0.9;
  line-height: 1.35;
}

.banner-badge {
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Categories Carousel */
.categories-wrapper {
  padding: 12px 16px 8px 16px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.categories-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 6px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.category-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* Products Grid */
.products-container {
  padding: 12px 16px;
}

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

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

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  position: relative;
}

.product-card:active {
  transform: scale(0.98);
}

.product-image-wrap {
  width: 100%;
  height: 135px;
  position: relative;
  background: #f1f5f9;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.stock-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stock-tag.in-stock {
  background: rgba(16, 185, 129, 0.9);
  color: white;
}

.stock-tag.low-stock {
  background: rgba(245, 158, 11, 0.92);
  color: white;
}

.stock-tag.out-stock {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.unit-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.7);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-category {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}

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

.product-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

.product-price small {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.add-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.add-btn:active {
  background: var(--primary);
  color: white;
  transform: scale(0.9);
}

.add-btn.disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

/* Floating Bottom Bar */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg-card-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-glass);
  padding: 10px 18px 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
}

.bottom-cart-info {
  display: flex;
  flex-direction: column;
}

.bottom-cart-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bottom-cart-total {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.bottom-cart-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s ease;
}

.bottom-cart-btn:active {
  transform: scale(0.96);
}

/* Modal Bottom Sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: var(--bg-card);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 10px auto 4px auto;
}

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

.sheet-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.close-btn {
  background: var(--border);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-content {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(85vh - 130px);
}

.sheet-footer {
  padding: 14px 20px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* Variant & Weight Selectors in Modal */
.variants-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.variants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.variant-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-main);
}

.variant-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.variant-card.out-of-stock {
  opacity: 0.5;
  pointer-events: none;
  border-style: dashed;
}

.variant-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.variant-stock {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.variant-stock.low {
  color: var(--warning);
  font-weight: 700;
}

.variant-price {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

/* Weight Mode Toggle (Kg vs So'm) */
.weight-toggle-container {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.weight-tab {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.weight-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.weight-preset-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.preset-chip {
  padding: 7px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.custom-weight-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.input-box {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 700;
  outline: none;
}

.input-box:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}

.calculation-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stepper (- 1 +) */
.quantity-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.step-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.step-btn:active {
  transform: scale(0.9);
  background: var(--primary-light);
  color: var(--primary);
}

.step-count {
  font-size: 1.25rem;
  font-weight: 800;
  min-width: 40px;
  text-align: center;
}

/* Primary Action Button */
.btn-primary-block {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s ease;
}

.btn-primary-block:active {
  transform: scale(0.98);
}

.btn-primary-block:disabled {
  background: var(--border);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Cart Items inside Cart Drawer */
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-img {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f1f5f9;
}

.cart-item-info {
  flex: 1;
}

.cart-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.cart-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-step-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mini-step-qty {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* Form inputs for Checkout */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Payment Method Cards */
.payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.payment-card {
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  background: var(--bg-main);
  transition: all 0.2s ease;
}

.payment-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.payment-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.payment-title {
  font-size: 0.85rem;
  font-weight: 700;
}

.payment-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Success Screen */
.success-box {
  text-align: center;
  padding: 30px 10px;
}

.success-icon-wrap {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 0 20px var(--primary-glow);
  animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.success-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 24px;
}

.success-details {
  background: var(--bg-main);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
}

.detail-row.bold {
  font-weight: 800;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}
