/* ============================================
   Driver Route Optimizer - Apple Design System
   Inspired by iOS/macOS aesthetic principles
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  width: 100%;
}

:root {
  /* Apple Blue - System Primary */
  --primary-color: #007AFF;
  --primary-hover: #0051D5;
  --primary-light: rgba(0, 122, 255, 0.1);

  /* Apple System Colors */
  --success-color: #34C759;
  --success-light: rgba(52, 199, 89, 0.1);
  --warning-color: #FF9500;
  --warning-light: rgba(255, 149, 0, 0.1);
  --danger-color: #FF3B30;
  --danger-light: rgba(255, 59, 48, 0.1);

  /* Backgrounds - Apple Style */
  --bg-primary: #F5F5F7;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #FAFAFA;
  --bg-elevated: #FFFFFF;

  /* Glass Morphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);

  /* Typography - San Francisco inspired */
  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --text-tertiary: #6E6E73;

  /* Borders */
  --border-light: rgba(0, 0, 0, 0.04);
  --border-medium: rgba(0, 0, 0, 0.08);
  --separator: rgba(60, 60, 67, 0.12);

  /* Apple Shadows - Subtle depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

  /* Radius - Apple's signature curves */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Transitions - Apple smooth */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.47059;
  /* Apple's magic ratio */
  letter-spacing: -0.022em;
  /* SF Pro tracking */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* ============================================
   Header - Apple Style Nav Bar
   ============================================ */

.header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-base);
}

.header:hover {
  background: rgba(255, 255, 255, 0.85);
}

.header h1 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.store-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition-base);
}

.store-logo:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.05);
}

.store-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-right {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.store-selector,
.language-selector {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 400;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  /* Apple HIG: Minimum 44x44pt touch target */
  min-height: 44px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2386868B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.store-selector {
  min-width: 200px;
}

.language-selector {
  min-width: 160px;
}

.store-selector:hover,
.language-selector:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.store-selector:focus,
.language-selector:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-light);
  transform: translateY(-1px);
}

/* ============================================
   Buttons - Apple iOS/macOS Style
   ============================================ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  /* Apple HIG: Minimum 44x44pt touch target */
  min-height: 44px;
  min-width: 44px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.95) 0%,
    rgba(0, 81, 213, 1) 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 4px 16px rgba(0, 122, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-weight: 500;
}

.btn-primary:hover {
  background: linear-gradient(135deg,
    rgba(0, 81, 213, 1) 0%,
    rgba(0, 64, 170, 1) 100%);
  box-shadow:
    0 6px 20px rgba(0, 122, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0) scale(1);
  box-shadow:
    0 2px 8px rgba(0, 122, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.btn-secondary:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-success {
  background: var(--success-color);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
}

.btn-success:hover {
  background: #30B350;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.35);
  transform: translateY(-1px);
}

.btn-icon {
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  font-size: 1.125rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
  transform: scale(1.05) translateY(-1px);
}

.btn-icon:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn:disabled::before {
  display: none;
}

/* ============================================
   Main Content
   ============================================ */

.main {
  flex: 1;
  padding: var(--space-xl) var(--space-lg);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn var(--transition-slow);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Stats Bar - Apple Widget Style
   ============================================ */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat {
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.stat-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--primary-color);
  margin-bottom: var(--space-xs);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* ============================================
   Loading / Empty / Error States - Apple Style
   ============================================ */

.loading-state,
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  animation: fadeIn var(--transition-slow);
}

.hidden {
  display: none !important;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary-color);
  border-radius: var(--radius-full);
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin-bottom: var(--space-lg);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-icon,
.error-icon {
  font-size: 5rem;
  margin-bottom: var(--space-lg);
  opacity: 0.8;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.empty-state h2,
.error-state h2 {
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.empty-state p,
.error-state p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-size: 1rem;
  max-width: 480px;
}

/* ============================================
   Section-Specific Empty States (Compact)
   ============================================ */

.section-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  background-color: var(--background-light);
  border-radius: var(--radius-lg);
  margin: var(--space-md) 0;
  min-height: 280px;
}

/* Desktop: center empty state in viewport */
@media (min-width: 768px) {
  .section-empty-state {
    min-height: 320px;
    padding: var(--space-2xl) var(--space-lg);
  }
}

.section-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.6;
  animation: pulse 2s ease-in-out infinite;
}

.section-empty-title {
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.section-empty-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 400px;
  line-height: 1.5;
}

/* ============================================
   Batches Container - Apple Cards Layout
   ============================================ */

.batches-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Batch Section Wrapper with Colored Background Areas */
.batch-section {
  margin-bottom: var(--space-xl);
  border-radius: var(--radius-xl);
  padding: var(--space-md);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.batch-section.ready-section {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.08) 0%,
    rgba(52, 199, 89, 0.04) 100%);
  border: 1px solid rgba(52, 199, 89, 0.15);
}

.batch-section.waiting-section {
  background: linear-gradient(135deg,
    rgba(255, 149, 0, 0.08) 0%,
    rgba(255, 149, 0, 0.04) 100%);
  border: 1px solid rgba(255, 149, 0, 0.15);
}

.batch-section.assigned-section {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.08) 0%,
    rgba(0, 122, 255, 0.04) 100%);
  border: 1px solid rgba(0, 122, 255, 0.15);
}

.batch-section.started-section {
  background: linear-gradient(135deg,
    rgba(16, 185, 129, 0.08) 0%,
    rgba(16, 185, 129, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.batch-section.invalid-section {
  background: linear-gradient(135deg,
    rgba(255, 59, 48, 0.08) 0%,
    rgba(255, 59, 48, 0.04) 100%);
  border: 1px solid rgba(255, 59, 48, 0.15);
}

.batch-section.pickup-section {
  background: linear-gradient(135deg,
    rgba(142, 142, 147, 0.08) 0%,
    rgba(142, 142, 147, 0.04) 100%);
  border: 1px solid rgba(142, 142, 147, 0.15);
}

.section-title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

/* ============================================
   Batch Card - iOS/macOS Card Style
   ============================================ */

.batch-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--radius-xl);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all var(--transition-base);
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.batch-card:hover {
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.5);
}

.batch-header {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.08) 0%,
    rgba(0, 122, 255, 0.04) 100%);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 122, 255, 0.1);
  position: relative;
}

.batch-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 20%,
    rgba(255, 255, 255, 0.6) 80%,
    transparent 100%);
  pointer-events: none;
}

.batch-title {
  display: flex;
  margin-bottom: 10px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
  gap: 15px;
}

.batch-time {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

.batch-body {
  padding: var(--space-xl);
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 100%);
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.order-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all var(--transition-base);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.order-item:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.6);
}

.order-sequence {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.95) 0%,
    rgba(0, 81, 213, 1) 100%);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  box-shadow:
    0 4px 12px rgba(0, 122, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transition: all var(--transition-base);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.order-item:hover .order-sequence {
  box-shadow:
    0 6px 16px rgba(0, 122, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transform: scale(1.04);
}

.order-details {
  flex: 1;
  min-width: 0;
}

.order-number {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
  letter-spacing: -0.015em;
}

a.shopify-order-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
a.shopify-order-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.order-customer {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.order-address {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
  line-height: 1.4;
}

.order-meta {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

.order-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Per-order action buttons */
.order-actions {
  display: flex;
  flex-direction: row;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-order-action {
  width: auto;
  height: auto;
  padding: 4px 8px;
  font-size: 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  color: var(--text-secondary);
}

.btn-order-action:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.btn-remove-from-batch:hover {
  color: #ff9500;
}

.btn-mark-completed:hover {
  color: #34c759;
}

.batch-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.05) 0%,
    rgba(0, 122, 255, 0.02) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(0, 122, 255, 0.12);
  gap: var(--space-lg);
  box-shadow:
    0 4px 16px rgba(0, 122, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.batch-stat {
  text-align: center;
  flex: 1;
  position: relative;
}

.batch-stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: calc(var(--space-lg) * -0.5);
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 60%;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(0, 122, 255, 0.15) 20%,
    rgba(0, 122, 255, 0.15) 80%,
    transparent 100%);
}

.batch-stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 122, 255, 0.1);
}

.batch-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

.batch-stat-sublabel {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin-top: 2px;
  opacity: 0.7;
}

.batch-time-breakdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.625rem;
  font-weight: 600;
}

.time-segment {
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.time-segment.deliveries {
  background: rgba(0, 122, 255, 0.1);
  color: var(--primary-color);
}

.time-segment.service {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.time-segment.return {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
}

.time-segment-separator {
  color: var(--text-tertiary);
  font-weight: 400;
}

.batch-time-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 0.5rem;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.batch-return-info {
  margin-top: 4px;
  font-size: 0.6rem;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 2px;
}

.batch-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.batch-status.ok {
  background: var(--success-light);
  color: var(--success-color);
}

.batch-status.warning {
  background: var(--warning-light);
  color: var(--warning-color);
}

.batch-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--separator);
}

/* ============================================
   Invalid Orders Batch - Warning Style
   ============================================ */

.invalid-batch {
  border: 2px solid #f44336 !important;
  background: linear-gradient(135deg,
    rgba(244, 67, 54, 0.05) 0%,
    rgba(244, 67, 54, 0.02) 100%) !important;
}

.invalid-batch .batch-header {
  background: linear-gradient(135deg,
    rgba(244, 67, 54, 0.15) 0%,
    rgba(244, 67, 54, 0.08) 100%) !important;
  border-bottom: 1px solid rgba(244, 67, 54, 0.2) !important;
}

.invalid-batch .batch-header::before {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(244, 67, 54, 0.3) 20%,
    rgba(244, 67, 54, 0.3) 80%,
    transparent 100%) !important;
}

.invalid-orders-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.invalid-order-item {
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.9);
  border-left: 4px solid #f44336;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.1);
  transition: all var(--transition-base);
}

.invalid-order-item:hover {
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.15);
  transform: translateX(4px);
}

.invalid-order-item .order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.invalid-order-item .order-number {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.invalid-badge {
  background: #f44336;
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.invalid-order-item .customer-info {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.invalid-reason {
  color: #d32f2f;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(244, 67, 54, 0.08);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.invalid-batch .btn-assign:disabled {
  background: #bdbdbd !important;
  cursor: not-allowed;
  opacity: 0.6;
  color: #757575 !important;
  border-color: #bdbdbd !important;
}

.invalid-batch .btn-assign:disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ============================================
   Modal - Apple Sheet/Panel Style
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn var(--transition-base);
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-light);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--separator);
  background: var(--bg-tertiary);
}

.modal-header h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--border-medium);
  color: var(--text-primary);
  transform: scale(1.05);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-body label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.driver-select {
  width: 100%;
  padding: 12px var(--space-md);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-base);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2386868B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

.driver-select:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.driver-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--separator);
  background: var(--bg-tertiary);
}

#assignBatchInfo {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

/* ============================================
   Footer - Apple Minimal Style
   ============================================ */

.footer {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--separator);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.version-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.btn-logout {
  background: none;
  border: none;
  font-size: 1.125rem;
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition-fast);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-logout:hover {
  opacity: 1;
  background: var(--bg-tertiary);
  transform: scale(1.1);
}

.btn-logout:active {
  transform: scale(0.95);
}

/* ============================================
   Direction Badge
   ============================================ */

.direction-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   Responsive
   ============================================ */

/* ============================================
   Map Modal - Apple Large Sheet Style
   ============================================ */

.modal-large {
  padding: var(--space-lg);
}

.modal-content-large {
  max-width: 1000px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-body-map {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: var(--space-lg) var(--space-xl);
}

#routeMap {
  flex: 1;
  min-height: 500px;
  border-radius: var(--radius-lg);
  z-index: 1;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.map-legend {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-lg) 0;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-marker {
  font-size: 1.5rem;
}

.legend-line {
  width: 36px;
  height: 4px;
  background: var(--primary-color);
  border-radius: var(--radius-full);
}

.map-route-info {
  display: flex;
  gap: var(--space-xl);
  align-items: center;
  font-size: 0.9375rem;
  flex: 1;
  font-weight: 500;
}

.map-route-info strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* Leaflet Custom Markers - Apple Style */
.custom-marker {
  background: var(--primary-color);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9375rem;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all var(--transition-base);
}

.custom-marker:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.custom-marker.store-marker {
  background: var(--success-color);
  width: 44px;
  height: 44px;
  font-size: 1.375rem;
}

/* Batch Card Button Group */
.batch-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--separator);
}

.btn-map {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.btn-map:hover {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ============================================
   Responsive - Apple Adaptive Design
   ============================================ */

@media (max-width: 768px) {
  :root {
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
  }

  body {
    overflow-x: hidden;
  }

  .header {
    flex-direction: column;
    gap: var(--space-md);
    padding: 12px 16px;
    width: 100%;
  }

  .header-left {
    width: 100%;
    justify-content: flex-start;
  }

  .store-logo {
    width: 40px;
    height: 40px;
    padding: 4px;
  }

  .header h1 {
    font-size: 1.125rem;
    width: 100%;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .store-selector,
  .language-selector {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    padding: 8px 28px 8px 12px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    padding: 6px;
    flex-shrink: 0;
  }

  .main {
    padding: 16px 12px;
    width: 100%;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat {
    padding: 16px 12px;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .section-subtitle {
    font-size: 0.875rem;
  }

  .batch-card {
    width: 100%;
  }

  .batch-header {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .batch-title {
    font-size: 1.0625rem;
  }

  .batch-time {
    font-size: 0.875rem;
  }

  .batch-body {
    padding: 16px;
  }

  .batch-stats {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .batch-stat {
    width: 100%;
    border-bottom: 1px solid var(--separator);
    padding-bottom: 8px;
  }

  .batch-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .batch-stat-value {
    font-size: 1.375rem;
  }

  .order-list {
    gap: 10px;
  }

  .order-item {
    padding: 12px;
    gap: 10px;
  }

  .order-sequence {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }

  .order-number {
    font-size: 0.9375rem;
  }

  .order-customer,
  .order-address {
    font-size: 0.8125rem;
  }

  .order-meta {
    font-size: 0.75rem;
    gap: 10px;
  }

  .pending-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pending-item {
    padding: 16px;
  }

  .footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.8125rem;
  }

  .btn-logout {
    margin-top: 4px;
  }

  .modal-content {
    width: 95%;
    max-width: calc(100vw - 20px);
    margin: 0 10px;
  }

  .modal-content-large {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .modal-large {
    padding: 0;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 1.125rem;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-body-map {
    padding: 12px 16px;
  }

  #routeMap {
    min-height: 300px;
  }

  .map-legend {
    gap: 10px;
    flex-direction: column;
    font-size: 0.875rem;
  }

  .map-route-info {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    font-size: 0.875rem;
  }

  .batch-footer {
    flex-direction: column;
    gap: 10px;
  }

  .batch-footer .btn {
    width: 100%;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.875rem;
  }
}

/* iPad and Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) {
  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
  }

  .pending-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large Desktop */
@media (min-width: 1440px) {
  .main {
    padding: var(--space-2xl) var(--space-xl);
  }

  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
  }

  .pending-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection Color - Apple Blue */
::selection {
  background: var(--primary-light);
  color: var(--primary-color);
}

::-moz-selection {
  background: var(--primary-light);
  color: var(--primary-color);
}

/* Scrollbar - Apple Style (Webkit only) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
  background-clip: content-box;
}

/* ============================================
   Pickup Orders - Store/Counter Style Cards
   ============================================ */

.pickup-container {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 2px dashed var(--separator);
  animation: fadeIn var(--transition-slow) 0.3s;
}

.pickup-title {
  color: #8E8E93;
  /* Apple Gray */
}

.pickup-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.pickup-item {
  /* Glassmorphism - Apple Style */
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all var(--transition-base);
  opacity: 0.9;
}

.pickup-item:hover {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.5);
  opacity: 1;
}

.pickup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xs);
}

.pickup-order-number {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.pickup-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.pickup-customer {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.pickup-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.6875rem;
  font-weight: 600;
  color: #8E8E93;
  background: rgba(142, 142, 147, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: var(--space-sm);
}

.pickup-items-preview {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Priority Badges - Overdue Order Indicators
   ============================================ */

.priority-badge,
.batch-priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  animation: priority-pulse 2s infinite;
}

.priority-badge.priority-1,
.batch-priority-badge.priority-1 {
  background: rgba(255, 59, 48, 0.15);
  color: #FF3B30;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

.priority-badge.priority-2,
.batch-priority-badge.priority-2 {
  background: rgba(255, 149, 0, 0.15);
  color: #FF9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
}

/* Priority card styling */
.batch-card.priority-level-1 {
  border: 2px solid rgba(255, 59, 48, 0.4);
  box-shadow: 0 0 20px rgba(255, 59, 48, 0.15);
}

.batch-card.priority-level-2 {
  border: 2px solid rgba(255, 149, 0, 0.4);
  box-shadow: 0 0 20px rgba(255, 149, 0, 0.15);
}

.order-item.priority-level-1 {
  background: rgba(255, 59, 48, 0.08);
  border-radius: var(--radius-md);
}

.order-item.priority-level-2 {
  background: rgba(255, 149, 0, 0.08);
  border-radius: var(--radius-md);
}

/* Subtle pulsing animation for urgent items */
@keyframes priority-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ============================================
   Time Window Delay Warning Badges
   (Flexible Overlap Feature)
   ============================================ */

.delay-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: help;
  transition: all var(--transition-fast);
  margin-left: 4px;
}

/* Warning level: 1-15 min gap (yellow/amber) */
.delay-warning-badge.warning {
  background: rgba(255, 204, 0, 0.15);
  color: #CC9900;
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.delay-warning-badge.warning:hover {
  background: rgba(255, 204, 0, 0.25);
  border-color: rgba(255, 204, 0, 0.5);
  transform: scale(1.02);
}

/* Caution level: 16-30 min gap (orange) */
.delay-warning-badge.caution {
  background: rgba(255, 149, 0, 0.15);
  color: #FF9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
  animation: caution-pulse 2s infinite;
}

.delay-warning-badge.caution:hover {
  background: rgba(255, 149, 0, 0.25);
  border-color: rgba(255, 149, 0, 0.5);
  transform: scale(1.02);
}

@keyframes caution-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

/* Batch card styling when has stretched windows */
.batch-card.has-stretched-windows {
  border-left: 4px solid #FF9500;
}

/* Order-level wait time badge (individual order warning) */
.order-wait-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.2) 100%);
  color: #E65100;
  border: 1.5px solid rgba(255, 152, 0, 0.4);
  margin-left: 6px;
  cursor: help;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 4px rgba(255, 152, 0, 0.1);
  text-transform: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: fit-content;
}

.order-wait-badge:hover {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.3) 0%, rgba(255, 152, 0, 0.3) 100%);
  border-color: rgba(255, 152, 0, 0.6);
  transform: scale(1.08);
  box-shadow: 0 4px 8px rgba(255, 152, 0, 0.2);
}

/* Subtle pulse animation to draw attention */
@keyframes wait-badge-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.order-wait-badge {
  animation: wait-badge-pulse 3s ease-in-out infinite;
}

/* =============================================
   SMART CLUSTER MERGE BADGE (v2.5.0)
   Badge for orders merged from different clusters
   ============================================= */

/* Merged cluster badge - order level (light blue theme) */
.merged-cluster-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(14, 165, 233, 0.15) 100%);
  color: #0369a1;
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  margin-left: 6px;
  cursor: help;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 4px rgba(56, 189, 248, 0.1);
  text-transform: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: fit-content;
}

.merged-cluster-badge:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(14, 165, 233, 0.25) 100%);
  border-color: rgba(56, 189, 248, 0.6);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(56, 189, 248, 0.2);
}

/* Order item styling when merged */
.order-item.merged-from-cluster {
  position: relative;
  background: rgba(56, 189, 248, 0.08);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(56, 189, 248, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Shimmer yang bergerak */
.order-item.merged-from-cluster::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 4s infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% { 
    left: -100%;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% { 
    left: 100%;
    opacity: 0;
  }
}

.order-item.merged-from-cluster:hover {
  animation: subtleFloat 2s ease-in-out infinite;
}

@keyframes subtleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {

  .priority-badge.priority-1,
  .batch-priority-badge.priority-1 {
    background: rgba(255, 69, 58, 0.2);
    color: #FF6961;
    margin-left: 5px;
  }

  .priority-badge.priority-2,
  .batch-priority-badge.priority-2 {
    background: rgba(255, 159, 10, 0.2);
    color: #FFB340;
  }
}

/* ============================================
   Authentication Mode - Store Badge & Logout
   ============================================ */

.store-badge {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
  gap: 6px;
}

.store-badge span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
  background: #fff1f1;
  border-color: rgba(255, 59, 48, 0.3);
  color: var(--danger-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-logout:active {
  transform: translateY(0);
}

/* ============================================
   ISSUE #6: Waiting List Styles
   ============================================ */

.waiting-list-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #fffbeb;
  border-radius: 12px;
  border-left: 4px solid #f59e0b;
}

.waiting-header {
  margin-bottom: 1rem;
}

.waiting-header h3 {
  color: #92400e;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.waiting-subtitle {
  color: #78350f;
  margin: 0.5rem 0 0 0;
  font-size: 0.9rem;
}

.waiting-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.waiting-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #fbbf24;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.1);
  transition: all 0.2s ease;
}

.waiting-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
  transform: translateY(-2px);
}

.waiting-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.waiting-badge {
  background: #fef3c7;
  color: #92400e;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.waiting-card-body p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.waiting-card-body .customer-name {
  font-weight: 600;
  color: #1f2937;
}

.waiting-card-body .delivery-address {
  color: #6b7280;
  font-size: 0.85rem;
}

.waiting-card-body .delivery-time {
  color: #f59e0b;
  font-weight: 500;
}

.waiting-card-body .batch-info {
  color: #9ca3af;
  font-size: 0.8rem;
  font-style: italic;
}

.waiting-card-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #fef3c7;
}

.waiting-reason {
  color: #78350f;
  font-size: 0.8rem;
}

/* ============================================
   Tier Badges (LOCAL / NEARBY / EXTENDED)
   ============================================ */

.batch-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tier-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.tier-badge.tier-local {
  background: rgba(52, 199, 89, 0.15);
  color: #34C759;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.tier-badge.tier-nearby {
  background: rgba(255, 204, 0, 0.15);
  color: #CC9900;
  border: 1px solid rgba(255, 204, 0, 0.3);
}

.tier-badge.tier-extended {
  background: rgba(255, 59, 48, 0.15);
  color: #FF3B30;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

/* Clustering algorithm badge */
.algorithm-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  background: rgba(94, 92, 230, 0.15);
  color: #5E5CE6;
  border: 1px solid rgba(94, 92, 230, 0.3);
}

.algorithm-badge.algorithm-dbscan {
  background: rgba(48, 176, 199, 0.15);
  color: #30B0C7;
  border: 1px solid rgba(48, 176, 199, 0.3);
}

.algorithm-badge.algorithm-kmeans {
  background: rgba(175, 82, 222, 0.15);
  color: #AF52DE;
  border: 1px solid rgba(175, 82, 222, 0.3);
}

.algorithm-badge.algorithm-auto {
  background: rgba(94, 92, 230, 0.15);
  color: #5E5CE6;
  border: 1px solid rgba(94, 92, 230, 0.3);
}

.algorithm-badge.algorithm-legacy {
  background: rgba(142, 142, 147, 0.15);
  color: #8E8E93;
  border: 1px solid rgba(142, 142, 147, 0.3);
}

/* Tier-based card backgrounds (Subtle) */
.batch-card.tier-local {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.05) 0%, #ffffff 100%);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

.batch-card.tier-nearby {
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.05) 0%, #ffffff 100%);
  border: 1px solid rgba(255, 204, 0, 0.2);
}

.batch-card.tier-extended {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.05) 0%, #ffffff 100%);
  border: 1px solid rgba(255, 59, 48, 0.2);
}

/* Status extended style */
.batch-status.extended {
  color: #FF3B30;
  background: rgba(255, 59, 48, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Issue #8: Overdue count badge */
.batch-overdue-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  background: rgba(255, 149, 0, 0.15);
  color: #FF9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
}

/* ============================================
   Issue #6: Ready vs Waiting List Sections
   ============================================ */

.batch-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
}

.batch-section-header:first-child {
  margin-top: 0;
}

.batch-section-header.ready {
  background: linear-gradient(135deg, #34C759 0%, #30B350 100%);
  color: white;
}

.batch-section-header.waiting {
  background: linear-gradient(135deg, #FF9500 0%, #FF8000 100%);
  color: white;
}

.batch-section-header .section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.batch-section-header .section-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.batch-section-header .section-icon {
  font-size: 1.1rem;
}

.batch-section-header .section-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.driver-count,
.waiting-count,
.batch-count {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

/* Batches grid */
.batches-grid {
  display: grid;
  gap: 1rem;
}

.batches-grid.waiting .batch-card {
  opacity: 0.9;
  border-style: dashed;
}

/* No batches message */
.no-batches-message {
  padding: 2rem;
  text-align: center;
  color: #666;
  background: #f8f8f8;
  border-radius: 8px;
  font-style: italic;
}
/* ============================================
   Batch State Sections - Glassmorphism Style
   ============================================ */

.preparing-container,
.assigned-container,
.delivered-container {
  margin-bottom: var(--space-2xl);
}

/* Section Headers - Floating Glass Style */
.batch-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
  margin-bottom: var(--space-md);
  transition: all var(--transition-base);
}

.batch-section-header:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
  transform: translateY(-2px);
}

.batch-section-header.preparing {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.15) 0%,
    rgba(52, 199, 89, 0.08) 100%);
  border: 1px solid rgba(52, 199, 89, 0.25);
  box-shadow:
    0 8px 32px rgba(52, 199, 89, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.preparing:hover {
  box-shadow:
    0 12px 40px rgba(52, 199, 89, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header.available {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.15) 0%,
    rgba(52, 199, 89, 0.08) 100%);
  border: 1px solid rgba(52, 199, 89, 0.25);
  box-shadow:
    0 8px 32px rgba(52, 199, 89, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.available:hover {
  box-shadow:
    0 12px 40px rgba(52, 199, 89, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header.assigned {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.15) 0%,
    rgba(0, 122, 255, 0.08) 100%);
  border: 1px solid rgba(0, 122, 255, 0.25);
  box-shadow:
    0 8px 32px rgba(0, 122, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.assigned:hover {
  box-shadow:
    0 12px 40px rgba(0, 122, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header.ready {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.15) 0%,
    rgba(52, 199, 89, 0.08) 100%);
  border: 1px solid rgba(52, 199, 89, 0.25);
  box-shadow:
    0 8px 32px rgba(52, 199, 89, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.ready:hover {
  box-shadow:
    0 12px 40px rgba(52, 199, 89, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header.waiting {
  background: linear-gradient(135deg,
    rgba(255, 149, 0, 0.15) 0%,
    rgba(255, 149, 0, 0.08) 100%);
  border: 1px solid rgba(255, 149, 0, 0.25);
  box-shadow:
    0 8px 32px rgba(255, 149, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.waiting:hover {
  box-shadow:
    0 12px 40px rgba(255, 149, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header.delivered {
  background: linear-gradient(135deg,
    rgba(134, 134, 139, 0.1) 0%,
    rgba(134, 134, 139, 0.05) 100%);
  border: 1px solid rgba(134, 134, 139, 0.2);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.batch-section-header.delivered:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.invalid {
  background: linear-gradient(135deg,
    rgba(255, 59, 48, 0.1) 0%,
    rgba(255, 59, 48, 0.05) 100%);
  border: 1px solid rgba(255, 59, 48, 0.2);
  box-shadow:
    0 6px 24px rgba(255, 59, 48, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.batch-section-header.invalid:hover {
  box-shadow:
    0 8px 32px rgba(255, 59, 48, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.pickup {
  background: linear-gradient(135deg,
    rgba(142, 142, 147, 0.12) 0%,
    rgba(142, 142, 147, 0.06) 100%);
  border: 1px solid rgba(142, 142, 147, 0.2);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.batch-section-header.pickup:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.started {
  background: linear-gradient(135deg,
    rgba(16, 185, 129, 0.15) 0%,
    rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow:
    0 8px 32px rgba(16, 185, 129, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-section-header.started:hover {
  box-shadow:
    0 12px 40px rgba(16, 185, 129, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-section-header .section-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.batch-section-header .section-icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.batch-section-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}

.batch-section-header .section-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.preparing-count,
.assigned-count,
.delivered-count {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Batch Card States - Clean Glass Cards */
.batch-card.preparing {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(52, 199, 89, 0.2);
  box-shadow:
    0 8px 24px rgba(52, 199, 89, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: pulse-preparing 3s ease-in-out infinite;
}

@keyframes pulse-preparing {
  0%, 100% {
    box-shadow:
      0 8px 24px rgba(52, 199, 89, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
  50% {
    box-shadow:
      0 12px 32px rgba(52, 199, 89, 0.14),
      0 0 0 1px rgba(52, 199, 89, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }
}

.batch-card.assigned {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(0, 122, 255, 0.2);
  box-shadow:
    0 8px 24px rgba(0, 122, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.batch-card.delivered {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: saturate(150%) blur(15px);
  -webkit-backdrop-filter: saturate(150%) blur(15px);
  border: 1px solid rgba(134, 134, 139, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  opacity: 0.85;
}

/* Status Badges */
.batch-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-fast);
}

.batch-status-badge:hover {
  transform: scale(1.02);
}

.batch-status-badge.preparing {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.9) 0%,
    rgba(48, 179, 80, 0.95) 100%);
  color: white;
  box-shadow:
    0 4px 12px rgba(52, 199, 89, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.batch-status-badge.assigned {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.9) 0%,
    rgba(0, 81, 213, 0.95) 100%);
  color: white;
  box-shadow:
    0 4px 12px rgba(0, 122, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.batch-status-badge.delivered {
  background: linear-gradient(135deg,
    rgba(142, 142, 147, 0.8) 0%,
    rgba(118, 118, 128, 0.85) 100%);
  color: white;
  box-shadow:
    0 3px 10px rgba(142, 142, 147, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.batch-status-badge.available {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.9) 0%,
    rgba(48, 179, 80, 0.95) 100%);
  color: white;
  box-shadow:
    0 4px 12px rgba(52, 199, 89, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Order-level Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-fast);
  margin-left: 6px;
}

.status-badge.available {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.85) 0%,
    rgba(48, 179, 80, 0.9) 100%);
  color: white;
  border-color: rgba(52, 199, 89, 0.4);
}

.status-badge.assigned {
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.85) 0%,
    rgba(0, 81, 213, 0.9) 100%);
  color: white;
  border-color: rgba(0, 122, 255, 0.4);
}

.status-badge:hover {
  transform: scale(1.05);
}

/* Order-level Driver Info */
.order-driver {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 500;
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(0, 122, 255, 0.08);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
}

.order-driver:hover {
  background: rgba(0, 122, 255, 0.12);
}

/* Driver Info Display */
.batch-driver-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 122, 255, 0.06);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  border: 1px solid rgba(0, 122, 255, 0.12);
  transition: all var(--transition-base);
}

.batch-driver-info:hover {
  border-color: rgba(0, 122, 255, 0.18);
  box-shadow:
    0 4px 12px rgba(0, 122, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.batch-driver-info .driver-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    var(--primary-color) 0%,
    var(--primary-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Timestamp Display */
.batch-timestamp {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Button Variants for Different States */
.batch-card.preparing .batch-footer .btn-start {
  display: none; /* Hide START button for preparing batches */
}

.batch-card.assigned .batch-footer .btn-assign,
.batch-card.delivered .batch-footer .btn-assign {
  display: none; /* Hide ASSIGN button */
}

.batch-card.delivered .batch-footer {
  display: none; /* Hide all buttons for delivered */
}

/* Cancel Button - Glassmorphism Danger */
.btn-cancel {
  background: linear-gradient(135deg,
    rgba(255, 59, 48, 0.1) 0%,
    rgba(255, 59, 48, 0.05) 100%);
  backdrop-filter: blur(10px);
  color: var(--danger-color);
  border: 1px solid rgba(255, 59, 48, 0.3);
  font-weight: 500;
}

.btn-cancel:hover {
  background: linear-gradient(135deg,
    rgba(255, 59, 48, 0.9) 0%,
    rgba(214, 50, 40, 0.95) 100%);
  color: white;
  border-color: var(--danger-color);
  box-shadow:
    0 4px 16px rgba(255, 59, 48, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* START BATCH Button - Glassmorphism Success */
.btn-success {
  background: linear-gradient(135deg,
    rgba(52, 199, 89, 0.95) 0%,
    rgba(48, 179, 80, 1) 100%);
  color: white;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 4px 16px rgba(52, 199, 89, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg,
    rgba(48, 179, 80, 1) 0%,
    rgba(46, 170, 77, 1) 100%);
  box-shadow:
    0 6px 20px rgba(52, 199, 89, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-start {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================
   Partial Assignment Styling
   ============================================ */

/* Partial Assignment Styling */
.batch-card.partial-assignment {
  border-left: 4px solid #f59e0b; /* Orange border for partial state */
}

.batch-assigned-driver {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background-color: #fef3c7; /* Light yellow background */
  border-radius: 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.batch-assigned-driver strong {
  color: #92400e; /* Dark yellow text */
}

.assignment-note {
  font-size: 0.85rem;
  color: #78716c;
  margin-left: auto;
}

.batch-status-badge.partial {
  background-color: #fbbf24;
  color: #78350f;
}

/* Make assigned orders in partial batches visually distinct */
.batch-card.partial-assignment .order-item .status-badge.assigned {
  background-color: #34d399; /* Green for assigned in partial batch */
  color: #065f46;
}

/* ============================================
   v2.6.0 - Batch Started & Order Overview
   ============================================ */

/* Navigation Links */
.nav-link {
  text-decoration: none;
  font-size: 0.875rem;
}

.nav-link.active {
  background: var(--primary-color) !important;
  color: white !important;
  border-color: var(--primary-color) !important;
}

/* Batch Started Button */
.btn-batch-started {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-batch-started:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.btn-batch-started:active {
  transform: translateY(0);
}

/* Batch Disappearing Animation */
.batch-disappearing {
  animation: batchDisappear 400ms ease-out forwards;
}

@keyframes batchDisappear {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
}

/* Undo Toast Container */
.undo-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
}

.undo-toast {
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toastSlideUp 300ms ease-out;
  pointer-events: all;
  position: relative;
  overflow: hidden;
  min-width: 320px;
}

.undo-toast-hiding {
  animation: toastSlideDown 300ms ease-in forwards;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastSlideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.undo-toast-message {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.undo-toast-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.undo-toast-btn:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.5);
}

.undo-toast-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #f59e0b;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastTimer 10s linear forwards;
}

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============================================
   Order Overview Page Styles
   ============================================ */

/* Started batch card styling - consistent with assigned/ready cards */
.batch-status-badge.started {
  background: linear-gradient(135deg,
    rgba(16, 185, 129, 0.9) 0%,
    rgba(5, 150, 105, 0.95) 100%);
  color: white;
  box-shadow:
    0 4px 12px rgba(16, 185, 129, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-clear-all-started {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--separator);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: auto;
}

.btn-clear-all-started:hover {
  background: var(--danger-light);
  color: var(--danger-color);
  border-color: var(--danger-color);
}


/* ====================================================================
   RFC-007 — Batch card badges + aggregate row
   Centralised badge styling. Every badge is `icon + label` (RULES §3.3).
   The `angry` variant is the only pulsing badge.
   Reduced-motion media query disables the pulse for accessibility.
   ==================================================================== */

.batch-aggregate-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 6px;
}

.order-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  background: #eef1f4;
  color: #2c3e50;
  white-space: nowrap;
}

.badge__icon { font-size: 12px; line-height: 1; }
.badge__label { letter-spacing: 0.02em; }

.badge--vip            { background: #fff7d6; border-color: #f0c419; color: #6b4f00; }
.badge--new            { background: #e8f6ed; border-color: #34a853; color: #1f5e30; }
.badge--cis            { background: #ecf3ff; border-color: #4285f4; color: #1a3e8a; }
.badge--eta            { background: #f3eaff; border-color: #8e44ad; color: #4a256e; }
.badge--mustOnTime     { background: #fff0f0; border-color: #d93025; color: #8a1c14; }
.badge--onCall         { background: #e3f7fa; border-color: #16a3b8; color: #0c5e6c; }
.badge--calledMultiple { background: #fbe9e7; border-color: #d35400; color: #6e2c00; }
.badge--calledLate     { background: #fde8e8; border-color: #c0392b; color: #6e1f17; }
.badge--angry          { background: #fde8e8; border-color: #c0392b; color: #6e1f17; }

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

.badge--pulsing { animation: badge-pulse 1.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .badge--pulsing { animation: none; }
}

/* RFC-007 §3.5 — Shared toast (used by RFC-008 muted-device fallback) */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #2c3e50;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  max-width: 320px;
  pointer-events: auto;
}
.toast--info    { background: #2c3e50; }
.toast--warn    { background: #b7791f; }
.toast--alert   { background: #c0392b; }
.toast--success { background: #2f855a; }
.driver-return-toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 10000;
  background: #2c3e50;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  max-width: 320px;
}
