:root {
  --bg-canvas: #090b0e;
  --bg-header: rgba(14, 18, 26, 0.85);
  --bg-card: #141822;
  --bg-card-hover: #191f2c;
  --bg-elevated: #1e2433;
  --bg-input: #11141c;
  
  --border-subtle: #252c3c;
  --border-focus: #f5c518;
  
  --brand-primary: #f5c518;
  --brand-primary-dark: #cca107;
  --brand-glow: rgba(245, 197, 24, 0.18);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-primary: #0f172a;
  
  --status-success: #10b981;
  --status-danger: #ef4444;
  
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-full: 9999px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.7);
}

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

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 110px;
  min-height: 100vh;
  user-select: none;
}

/* ---------------- Toast Notifications ---------------- */
.toast-container {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #1a202c;
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  animation: toastSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-size: 13px;
  font-weight: 500;
}

.toast-msg.toast-success {
  border-color: var(--status-success);
}
.toast-msg.toast-success svg {
  stroke: var(--status-success);
  flex-shrink: 0;
}

.toast-msg.toast-error {
  border-color: var(--status-danger);
}
.toast-msg.toast-error svg {
  stroke: var(--status-danger);
  flex-shrink: 0;
}

@keyframes toastSlideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Header ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--brand-primary);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--status-success);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 6px var(--status-success);
}

/* Search Bar */
.search-bar {
  padding: 6px 16px 8px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 36px 10px 38px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.search-clear-btn.visible {
  display: flex;
}

/* Categories Nav */
.categories-nav {
  display: flex;
  gap: 8px;
  padding: 6px 16px 12px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

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

.category-tab {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-tab svg {
  stroke: var(--text-secondary);
}

.category-tab:active {
  transform: scale(0.96);
}

.category-tab.active {
  background-color: var(--brand-primary);
  color: var(--text-on-primary);
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.category-tab.active svg {
  stroke: var(--text-on-primary);
}

/* ---------------- Catalog ---------------- */
.catalog-container {
  padding: 8px 16px 20px;
}

.category-block {
  margin-top: 18px;
}

.category-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.category-block-header svg {
  stroke: var(--brand-primary);
}

.category-block-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

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

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

.product-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}

.product-card:hover {
  border-color: rgba(245, 197, 24, 0.3);
}

.product-card-img-wrap {
  width: 100%;
  height: 120px;
  background-color: #0c0e14;
  position: relative;
  overflow: hidden;
}

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

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

.product-card-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: var(--brand-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 197, 24, 0.2);
}

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

.product-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 4px;
}

.product-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

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

.product-card-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* Button & Stepper */
.btn-add-product {
  background-color: rgba(245, 197, 24, 0.12);
  color: var(--brand-primary);
  border: 1px solid rgba(245, 197, 24, 0.35);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-add-product:active {
  background-color: var(--brand-primary);
  color: var(--text-on-primary);
  transform: scale(0.94);
}

.stepper {
  display: flex;
  align-items: center;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px 4px;
  gap: 6px;
}

.btn-stepper {
  background: none;
  border: none;
  color: var(--brand-primary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.btn-stepper:active {
  background-color: rgba(245, 197, 24, 0.15);
}

.stepper-count {
  font-size: 13px;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
  color: var(--text-primary);
}

/* ---------------- Floating Cart Bar ---------------- */
.cart-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 500;
  transform: translateY(140%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.cart-bar.visible {
  transform: translateY(0);
}

.cart-bar-content {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 28px rgba(245, 197, 24, 0.38);
}

.cart-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-badge-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: rgba(15, 23, 42, 0.12);
  border-radius: 50%;
}

.cart-badge-num {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #0f172a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-bar-pricing {
  display: flex;
  flex-direction: column;
}

.cart-items-count {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.cart-total-price {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.cart-bar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

/* ---------------- Checkout Bottom Sheet ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.checkout-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90vh;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-sheet);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  background-color: #333d52;
  border-radius: var(--radius-full);
  margin: 10px auto 6px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sheet-close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.sheet-close-btn:active {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.sheet-body {
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 9px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.segment-btn svg {
  stroke: var(--text-secondary);
}

.segment-btn.active {
  background-color: var(--brand-primary);
  color: var(--text-on-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.segment-btn.active svg {
  stroke: var(--text-on-primary);
}

/* Sheet Sections */
.sheet-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.clear-cart-link {
  background: none;
  border: none;
  color: var(--status-danger);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Cart Item Rows */
.cart-items-wrapper {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 12px;
}

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

.cart-row:last-child {
  border-bottom: none;
}

.cart-row-details {
  display: flex;
  flex-direction: column;
}

.cart-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.cart-row-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-primary);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 12px 10px 36px;
  outline: none;
  transition: all 0.2s;
}

.input-field:not(:has(.input-icon)) .form-control {
  padding-left: 12px;
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

.btn-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: rgba(245, 197, 24, 0.08);
  border: 1px dashed var(--brand-primary);
  color: var(--brand-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-location:active {
  background-color: rgba(245, 197, 24, 0.16);
}

/* Payment Selection Grid */
.payment-selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.payment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.payment-card-icon {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-card-meta {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.payment-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.payment-card-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.payment-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.payment-card.active {
  border-color: var(--brand-primary);
  background-color: rgba(245, 197, 24, 0.06);
}

.payment-card.active .payment-card-icon {
  color: var(--brand-primary);
}

.payment-card.active .payment-radio {
  border-color: var(--brand-primary);
}

.payment-card.active .payment-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--brand-primary);
}

/* Financial Receipt Breakdown */
.receipt-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.receipt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.receipt-val {
  font-weight: 600;
  color: var(--text-primary);
}

.receipt-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

.receipt-row.receipt-total {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.receipt-total-val {
  color: var(--brand-primary);
  font-size: 16px;
}

/* Footer & CTA */
.sheet-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
}

.btn-confirm-order {
  width: 100%;
  background-color: var(--brand-primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-lg);
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px var(--brand-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-confirm-order:active {
  transform: scale(0.98);
  background-color: var(--brand-primary-dark);
}

.btn-confirm-order:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
