/* ZeroMart Modern Design System - Appendix B Specification */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #ea580c;
  --warning-light: #fff7ed;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --dark: #0f172a;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: var(--font);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* Top Demo Role Switcher Bar */
.demo-bar {
  background: #0f172a;
  color: #94a3b8;
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #334155;
  z-index: 1000;
  position: sticky;
  top: 0;
}

.demo-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-badge {
  background: #2563eb;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.demo-roles {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.demo-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f1f5f9;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.demo-btn:hover, .demo-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

/* Main App Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 41px;
  z-index: 900;
}

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

.brand-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
}

.brand-tagline {
  background: var(--success-light);
  color: var(--success);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid #bbf7d0;
}

.location-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-btn-header {
  position: relative;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-count-pill {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
}

.user-session-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--gray-100);
  padding: 6px 12px;
  border-radius: 8px;
}

/* Layout Container */
.portal-container {
  display: flex;
  min-height: calc(100vh - 100px);
}

/* Sidebar Navigation */
.portal-sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid var(--gray-200);
  padding: 20px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray-400);
  font-weight: 700;
  padding: 8px 12px 4px 12px;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
}

/* Main Content Area */
.portal-content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1400px;
  overflow-y: auto;
}

/* Card Styles */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 12px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
}

/* KPI Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.kpi-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 600;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
}

.kpi-note {
  font-size: 11px;
  color: var(--gray-500);
  font-style: italic;
}

.kpi-card.highlight {
  border-left: 4px solid var(--primary);
}

.kpi-card.green {
  border-left: 4px solid var(--success);
}

.kpi-card.orange {
  border-left: 4px solid var(--warning);
}

/* Four Financial Buckets Grid */
.four-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.bucket-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.bucket-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.b1-tag { background: #dbeafe; color: #1e40af; }
.b2-tag { background: #dcfce7; color: #15803d; }
.b3-tag { background: #fef3c7; color: #b45309; }
.b4-tag { background: #ede9fe; color: #6b21a8; }

/* Discovery Store Cards */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.store-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.store-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.store-card-banner {
  height: 90px;
  background: linear-gradient(135deg, #1e293b, #334155);
  position: relative;
  padding: 12px;
}

.store-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.store-name-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.store-cat-badge {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.store-fulfilment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.badge-mode {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-b { background: #e0f2fe; color: #0369a1; }
.badge-c { background: #fef3c7; color: #b45309; }
.badge-d { background: #dcfce7; color: #15803d; }

.badge-zero {
  background: #fdf4ff;
  color: #a21caf;
  border: 1px solid #f0abfc;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Category Filter Chips */
.cat-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.cat-chip {
  background: white;
  border: 1px solid var(--gray-300);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #c2410c; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.st-pending { background: #fef3c7; color: #b45309; }
.st-paid { background: #e0f2fe; color: #0369a1; }
.st-accepted { background: #dbeafe; color: #1e40af; }
.st-preparing { background: #fef08a; color: #854d0e; }
.st-packed { background: #e0e7ff; color: #4338ca; }
.st-transit { background: #fed7aa; color: #9a3412; }
.st-delivered { background: #dcfce7; color: #15803d; }
.st-completed { background: #bbf7d0; color: #166534; }
.st-rejected { background: #fee2e2; color: #991b1b; }

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 12px;
  text-transform: uppercase;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
}

.data-table tr:hover td {
  background: var(--gray-50);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-400);
}

/* Form controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Stepper / Timeline */
.timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 16px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--gray-300);
}

.timeline-item {
  position: relative;
  margin-bottom: 18px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--gray-400);
}

.timeline-dot.active {
  border-color: var(--primary);
  background: var(--primary);
}

.timeline-dot.completed {
  border-color: var(--success);
  background: var(--success);
}

.timeline-content {
  font-size: 14px;
}

.timeline-time {
  font-size: 11px;
  color: var(--gray-400);
}

/* Zero-Knowledge OTP Display Card */
.zk-otp-card {
  background: #f8fafc;
  border: 2px dashed #3b82f6;
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin: 16px 0;
}

.zk-otp-digits {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--primary);
  margin: 8px 0;
  font-family: monospace;
}

.zk-tag {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideIn 0.2s ease-out;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Tweaks */
@media (max-width: 900px) {
  .portal-container {
    flex-direction: column;
  }
  .portal-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    padding: 10px;
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-title { display: none; }
  .nav-item { white-space: nowrap; padding: 6px 12px; }
  .portal-content { padding: 16px; }
}

