:root {
  --primary: #fc8019; /* Swiggy signature warm orange */
  --primary-hover: #e26f0f;
  --primary-light: #fff3ea;
  --secondary: #138808; /* Traditional banana leaf green / pure veg */
  --secondary-light: #e8f5e9;
  --accent: #d97706; /* Turmeric amber */
  --dark: #1e293b;
  --dark-surface: #0f172a;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----------------- Top Navigation Bar ----------------- */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1350px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, #ff5200 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(252, 128, 25, 0.35);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-text h1 span {
  color: var(--primary);
}

.brand-tamil {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 700;
  background: var(--secondary-light);
  padding: 1px 6px;
  border-radius: 4px;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-role-switcher {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.role-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.role-btn:hover {
  color: var(--dark);
  background: rgba(255, 255, 255, 0.6);
}

.role-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ws-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #065f46;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.user-profile-btn:hover {
  border-color: var(--primary);
}

.auth-role-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-role-card:hover {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.auth-role-card.selected {
  border-color: var(--primary);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(252, 128, 25, 0.25);
}

.auth-box-container {
  max-width: 550px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

/* ----------------- Subheader / Location bar ----------------- */
.location-subbar {
  background: #fff8f2;
  border-bottom: 1px solid #fed7aa;
  padding: 0.5rem 1.5rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #9a3412;
}

.location-subbar strong {
  color: var(--dark);
}

/* ----------------- Main Layout ----------------- */
.main-content {
  flex: 1;
  max-width: 1350px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ----------------- Common UI Components ----------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(252, 128, 25, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: #0e6806;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-veg {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-nonveg {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.badge-hygiene {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ----------------- Role Gateway Landing Screen ----------------- */
.gateway-overlay {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: calc(100vh - 65px);
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gateway-hero {
  text-align: center;
  max-width: 750px;
  color: white;
  margin-bottom: 2.5rem;
}

.gateway-hero h2 {
  font-size: 2.3rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.gateway-hero h2 span {
  color: var(--primary);
}

.gateway-hero p {
  font-size: 1rem;
  color: #94a3b8;
  line-height: 1.5;
}

.gateway-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  width: 100%;
  margin-bottom: 2.5rem;
}

.gateway-role-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: white;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.gateway-role-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.gateway-card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}

.gateway-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.gateway-card-desc {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex: 1;
}

.gateway-card-actions {
  display: flex;
  gap: 10px;
}

.gateway-demo-bar {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  max-width: 1100px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: white;
}

.eta-alert-box {
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fallback-alert-box {
  background: #fffbeb;
  border: 2px dashed #f59e0b;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
}

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 5px solid var(--primary);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.88rem;
}

.toast-success {
  border-left-color: var(--secondary);
}

.toast-danger {
  border-left-color: var(--danger);
}

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

/* ----------------- Modal ----------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  padding: 2rem;
}

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

.modal-close:hover {
  background: #e2e8f0;
  color: var(--dark);
}

/* ----------------- Order & Ride History Styles ----------------- */
.portal-tabs-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
}

.portal-nav-tab {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-nav-tab:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.portal-nav-tab.active {
  background: #ea580c;
  color: white;
}

.portal-nav-tab.active-seller {
  background: #16a34a;
  color: white;
}

.portal-nav-tab.active-rider {
  background: #0284c7;
  color: white;
}

.history-card-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.06);
}

.history-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.history-status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-placed { background: #dbeafe; color: #1e40af; }
.status-accepted { background: #e0e7ff; color: #3730a3; }
.status-cooking { background: #fef3c7; color: #92400e; }
.status-ready { background: #ecfdf5; color: #065f46; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

