/* ========================================
   KuljettajaWeb - Modern Design System
   ======================================== */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables - Design Tokens */
:root {
  /* Primary Colors - Deep Blue/Purple Theme */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;

  /* Accent Colors - Cyan/Teal */
  --accent-400: #22d3ee;
  --accent-500: #06b6d4;
  --accent-600: #0891b2;

  /* Success Colors */
  --success-400: #4ade80;
  --success-500: #22c55e;
  --success-600: #16a34a;

  /* Warning Colors */
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;
  --warning-600: #d97706;

  /* Error Colors */
  --error-400: #f87171;
  --error-500: #ef4444;
  --error-600: #dc2626;

  /* Neutral Colors - Dark Theme */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;

  /* Background Gradients */
  --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --bg-card: linear-gradient(145deg, rgba(45, 51, 84, 0.8) 0%, rgba(30, 35, 60, 0.9) 100%);
  --bg-card-hover: linear-gradient(145deg, rgba(55, 61, 94, 0.9) 0%, rgba(40, 45, 70, 0.95) 100%);

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(6, 182, 212, 0.3);

  /* Transitions */
  --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);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--neutral-100);
  background: var(--bg-gradient);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-4);
  color: var(--neutral-300);
}

a {
  color: var(--accent-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-500);
  text-decoration: underline;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Auth Pages (Login/Register) */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}

.auth-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(2%, 2%) rotate(1deg); }
  50% { transform: translate(0, 4%) rotate(0deg); }
  75% { transform: translate(-2%, 2%) rotate(-1deg); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  box-shadow: var(--glass-shadow);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card h2 {
  text-align: center;
  color: var(--neutral-50);
  margin-bottom: var(--space-2);
  font-size: var(--font-size-2xl);
}

.auth-card .subtitle {
  text-align: center;
  color: var(--neutral-400);
  margin-bottom: var(--space-8);
  font-size: var(--font-size-sm);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-logo svg {
  width: 64px;
  height: 64px;
  fill: var(--primary-500);
}

/* Form Styles */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--neutral-200);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--neutral-100);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all var(--transition-base);
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
  color: var(--neutral-500);
}

.form-control.is-invalid {
  border-color: var(--error-500);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--error-400);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-error::before {
  content: '⚠';
  font-size: var(--font-size-xs);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
  font-weight: 500;
  font-family: var(--font-family);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  color: var(--neutral-200);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  color: white;
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--success-400) 0%, var(--success-500) 100%);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
  transform: translateY(-2px);
}

.btn-danger {
  color: white;
  background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--error-400) 0%, var(--error-500) 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
  transform: translateY(-2px);
}

.btn-warning {
  color: var(--neutral-900);
  background: linear-gradient(135deg, var(--warning-400) 0%, var(--warning-500) 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

/* Side Navigation */
.sidenav {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(15, 12, 41, 0.98) 0%, rgba(48, 43, 99, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-x: hidden;
  transition: width var(--transition-slow);
  padding-top: var(--space-16);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
}

.sidenav.open {
  width: 280px;
}

.sidenav a {
  padding: var(--space-4) var(--space-6);
  text-decoration: none;
  font-size: var(--font-size-lg);
  color: var(--neutral-300);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all var(--transition-base);
  border-left: 3px solid transparent;
  margin: var(--space-1) 0;
}

.sidenav a:hover {
  color: var(--neutral-50);
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--primary-500);
  text-decoration: none;
}

.sidenav a.active {
  color: var(--primary-400);
  background: rgba(99, 102, 241, 0.1);
  border-left-color: var(--primary-500);
}

.sidenav .closebtn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: 2rem;
  padding: var(--space-2);
  border: none;
  border-left: none;
  margin: 0;
}

.sidenav .nav-divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--space-4) var(--space-6);
}

.sidenav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.sidenav-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Menu Toggle Button */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--neutral-100);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  margin: var(--space-4);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.menu-toggle .hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle .hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: var(--space-6);
  padding-top: var(--space-4);
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--neutral-50);
  margin: 0;
}

.card-body {
  color: var(--neutral-200);
}

/* List/Grid of Items */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

.item-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--primary-500);
}

.item-card-content {
  padding: var(--space-5);
}

.item-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
}

.item-card-row:not(:last-child) {
  border-bottom: 1px solid var(--glass-border);
}

.item-card-label {
  font-size: var(--font-size-sm);
  color: var(--neutral-400);
}

.item-card-value {
  font-weight: 500;
  color: var(--neutral-100);
}

.item-card-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
}

/* Top Action Buttons Bar */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Order/Info Box */
.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 600px;
  margin: 0 auto;
}

.info-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.info-box:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.info-box-label {
  font-size: var(--font-size-sm);
  color: var(--neutral-400);
  font-weight: 500;
}

.info-box-value {
  font-size: var(--font-size-base);
  color: var(--neutral-100);
  font-weight: 500;
  text-align: right;
}

.info-box-value a {
  color: var(--accent-400);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.info-box-value a:hover {
  color: var(--accent-500);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.data-table th {
  background: rgba(99, 102, 241, 0.2);
  font-weight: 600;
  color: var(--neutral-100);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Order Form Styles */
.order-form-container {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
}

.order-form-header {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  padding: var(--space-6);
  text-align: center;
}

.order-form-header h2 {
  color: white;
  margin: 0;
  font-size: var(--font-size-xl);
}

.order-form-body {
  padding: var(--space-6);
}

/* Radio/Checkbox Groups */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.option-item {
  flex: 1;
  min-width: 80px;
}

.option-input {
  display: none;
}

.option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 500;
  color: var(--neutral-300);
}

.option-label:hover {
  border-color: var(--primary-400);
  color: var(--neutral-100);
}

.option-input:checked + .option-label {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary-500);
  color: var(--primary-400);
}

/* Map Container */
.map-container {
  width: 100%;
  height: 250px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-4);
  border: 1px solid var(--glass-border);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success-400);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-400);
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error-400);
}

.badge-info {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-400);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--neutral-400);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--neutral-300);
  margin-bottom: var(--space-2);
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error-400);
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success-400);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning-400);
}

.alert-info {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-400);
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-card {
    padding: var(--space-6);
    margin: var(--space-4);
  }

  .sidenav.open {
    width: 100%;
  }

  .item-grid {
    grid-template-columns: 1fr;
  }

  .action-bar {
    padding: var(--space-3);
  }

  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
  }

  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
}

@media (max-width: 480px) {
  .info-box {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .info-box-value {
    text-align: left;
  }

  .option-group {
    flex-direction: column;
  }

  .option-item {
    width: 100%;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

.w-full { width: 100%; }

.hidden { display: none; }
.visible { visibility: visible; }

/* ---------------------------------------------------------------- map theme
 *
 * OpenStreetMap publishes light tiles only. Dark is produced by filtering them
 * rather than by depending on a second vendor — CARTO's dark tiles now stamp
 * "API KEY REQUIRED" across every image while still answering 200.
 *
 * The filter is on the tile pane, never the map: on the map it would invert the
 * markers, the popups and the attribution too, which is how a dark mode ends up
 * with white text on a white bubble.
 *
 * invert + hue-rotate is the standard recipe — invert alone turns water orange,
 * and rotating the hue half a turn puts it back to blue.
 */
.leaflet-pane.map-dark {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.92);
}

.map-theme-toggle a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}


/* ------------------------------------------------------------------ pager
 *
 * Lived in admin.css until the driver board needed it too. Both the admin
 * tables and the open-order board page their results, so the styles belong
 * where every page can reach them.
 */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.pager-num,
.pager-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px is the smallest thing a thumb hits reliably, and this product is
       used almost entirely on a phone. */
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--neutral-300);
    text-decoration: none;
    font-size: var(--font-size-sm);
}

.pager-num:hover,
.pager-step:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-400);
}

.pager-num.is-current {
    background: var(--primary-600, #4f46e5);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.pager-step.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pager-gap {
    color: var(--neutral-500);
    padding: 0 var(--space-1);
}

@media (max-width: 900px) {
    /* Numbers are a luxury on a narrow screen; previous/next is what gets
       tapped, so they take the width and the numbers wrap under them. */
    .pager-step {
        flex: 1 1 40%;
    }
}

.table-count {
    flex: 0 0 auto;
    font-size: var(--font-size-sm);
    color: var(--neutral-400);
    white-space: nowrap;
}

/* A field the form does not insist on, said in the label rather than left to
   be discovered by submitting without it. */
.form-optional {
  font-weight: 400;
  color: var(--neutral-500);
  font-size: var(--font-size-xs);
}

/* ---------------------------------------------------------- pickup time

   "Heti" or a chosen moment. Two big targets rather than a select, because
   this is tapped on a phone -- often by a dispatcher with a customer on the
   line. */

.pickup-when {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.pickup-when-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    cursor: pointer;
    font-weight: 600;
}

.pickup-when-opt input { accent-color: var(--primary-500); width: 18px; height: 18px; }

/* :has, so the whole tile lights up rather than just the dot. Where it is not
   supported the control still works -- the radio itself is visible. */
.pickup-when-opt:has(input:checked) {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, .14);
}

.pickup-when-time { margin-bottom: var(--space-2); }
.pickup-when-time[hidden] { display: none; }

.pickup-quick { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.pickup-quick[hidden] { display: none; }

/* -------------------------------------------------- advance bookings

   Future work, kept visually distinct from the open board above it. A driver
   must never mistake a job they cannot start for nineteen hours for one they
   can take now -- that is the entire reason these are separate lists. */

.board-section { margin: var(--space-6) 0 var(--space-2); }

.board-section-title {
    margin: 0;
    font-size: var(--font-size-lg);
    color: var(--neutral-100);
}

.board-section-help {
    margin: var(--space-1) 0 0;
    color: var(--neutral-400);
    font-size: var(--font-size-sm);
}

.upcoming-card { border-left: 3px solid var(--primary-500); }

/* A claimed booking is the driver's own promise, so it reads as settled
   rather than as something still on offer. */
.upcoming-card--mine { border-left-color: var(--success-500, #22c55e); }

.upcoming-when {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--glass-border);
}

/* The relative phrase is the headline: "21 h päästä" answers the driver's
   actual question, where a timestamp is a subtraction to do in the dark. */
.upcoming-when-rel {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary-400);
}

.upcoming-card--mine .upcoming-when-rel { color: var(--success-400, #4ade80); }

.upcoming-when-abs {
    color: var(--neutral-400);
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
}

/* =========================================================================
   The board's notice about work that is not takeable yet.

   Advance bookings used to be rendered here as cards. On a phone that put
   nineteen hours of future work above the job waiting two streets away, so
   they moved to their own page and left this line behind. It is a pointer,
   not a summary: the counts say whether opening it is worth a tap.
   ========================================================================= */
.board-notice {
    margin-bottom: var(--space-4);
}

.board-notice-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--primary-500);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
}

.board-notice-link:hover { border-color: var(--primary-500); }

.board-notice-icon { font-size: 1.4rem; }

.board-notice-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.board-notice-counts {
    font-size: var(--font-size-sm);
    color: var(--neutral-400);
}

/* "2 uutta" — set by driver-notify.js, which knows what this browser has
   already been shown. Hidden until it has an answer. */
.board-notice-new {
    background: var(--primary-500);
    color: #fff;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 700;
    padding: 2px var(--space-2);
    border-radius: 999px;
    white-space: nowrap;
}

.board-notice-go {
    color: var(--primary-400);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

/* =========================================================================
   A booking that has come due, on the board among the immediate work.

   It is takeable now and belongs here — but it showed `tildone`, the moment
   it was typed in, so last night's 07:15 pickup read as an order nobody had
   touched in ten hours. The pickup time is the fact that matters.
   ========================================================================= */
.item-card.is-preorder { border-left: 3px solid var(--warning-500, #f59e0b); }

.preorder-flag {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    font-weight: 700;
    color: var(--warning-400, #fbbf24);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--glass-border);
}

.preorder-flag-rel {
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--neutral-400);
}

/* =========================================================================
   The assignment banner.

   An order handed to a driver — by a dispatcher, or by their own reservation
   coming due — used to arrive silently: the ride simply appeared on their
   list. It now says so out loud, and **does not take the screen over**. The
   offer ring's popup is modal because it has sixty seconds and needs an
   answer; this one is already theirs, so it can wait for them to look.
   ========================================================================= */
/* Two things can be true at once — a ride handed to you and a booking of
   yours cancelled — and both used to be pinned to the same bottom corner,
   drawn one on top of the other. They stack. */
.notify-stack {
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    bottom: var(--space-3);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.notify-stack .notify-banner { pointer-events: auto; }

.notify-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card, #1f2937);
    border: 1px solid var(--success-500, #22c55e);
    border-left: 4px solid var(--success-500, #22c55e);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    animation: notifyIn 0.25s ease;
}

.notify-banner--warn { border-color: var(--warning-500, #f59e0b); border-left-color: var(--warning-500, #f59e0b); }

@keyframes notifyIn {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.notify-banner-icon { font-size: 1.6rem; }

.notify-banner-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notify-banner-title { font-weight: 700; }

.notify-banner-text {
    font-size: var(--font-size-sm);
    color: var(--neutral-300, #d1d5db);
    overflow: hidden;
    text-overflow: ellipsis;
}

.notify-banner-close {
    background: none;
    border: none;
    color: var(--neutral-400);
    font-size: 1.4rem;
    line-height: 1;
    padding: var(--space-2);
    cursor: pointer;
}

/* ============================================================================
   Driver board — sort control and the distance line.

   Added with the oldest/nearest ordering. Kept here rather than in a per-page
   file because the board is rendered by func/vital/listarray.php into
   index.php, which already loads only main.css.
   ============================================================================ */

.board-sort {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.board-sort__label {
    color: var(--neutral-400);
    font-size: var(--font-size-sm);
    margin-right: var(--space-1);
}

.board-sort__opt {
    padding: .35rem .8rem;
    border: 1px solid var(--glass-border, rgba(148, 163, 184, .25));
    border-radius: 999px;
    font-size: var(--font-size-sm);
    text-decoration: none;
    color: inherit;
    /* A thumb target, not a mouse target. */
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
}

.board-sort__opt:hover { border-color: var(--primary-400); }

.board-sort__opt.is-on {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: #fff;
    font-weight: 600;
}

/* Offered but unavailable: the driver's position is stale, so sorting by it
   would order the board by where they were an hour ago. */
.board-sort__opt.is-off {
    opacity: .45;
    cursor: not-allowed;
}

.board-sort__hint {
    color: var(--neutral-500, #6b7280);
    font-size: .78em;
}

/* Road ETA rows start hidden until the routing answer arrives. */
.dispatch-detail[hidden], .item-card-row[hidden] { display: none; }

/* Consent checkbox on the sign-up form. */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    line-height: 1.4;
}
.checkbox-label input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
