/* ==========================================================================
   Jeronimo Loads Status Portal - Theme & Component Styles (Light + Dark)
   ========================================================================== */

:root {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8fafc;
  --bg-elevated: #f1f5f9;
  --bg-header: rgba(255, 255, 255, 0.88);
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 4px 14px rgba(15, 23, 42, 0.09), 0 2px 6px rgba(15, 23, 42, 0.05);

  /* License plate colors (authentic EU white plate in light, crisp dark-adapted in dark) */
  --plate-bg: #ffffff;
  --plate-text: #0f172a;
  --plate-border: #334155;
}

html.dark {
  --bg-page: #020617;
  --bg-surface: #0f172a;
  --bg-surface-alt: #131c31;
  --bg-elevated: #1e293b;
  --bg-header: rgba(15, 23, 42, 0.88);
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);

  --plate-bg: #f8fafc;
  --plate-text: #0f172a;
  --plate-border: #475569;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Surfaces */
.portal-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.portal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  border-radius: 1rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.2s ease;
}

.portal-card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.portal-subbox {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
}

.portal-input {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 0.625rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.portal-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

html.dark input[type="date"] {
  color-scheme: dark;
}
html:not(.dark) input[type="date"] {
  color-scheme: light;
}

/* Status Color Badges (high contrast in both Light and Dark mode) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

/* TO_LOAD - Blue */
.status-to-load {
  background-color: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.28);
}
html.dark .status-to-load {
  background-color: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.38);
}

/* LOADING - Orange/Amber */
.status-loading {
  background-color: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}
html.dark .status-loading {
  background-color: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border-color: rgba(249, 115, 22, 0.4);
}

/* READY - Emerald */
.status-ready {
  background-color: rgba(5, 150, 105, 0.12);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.3);
}
html.dark .status-ready {
  background-color: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.38);
}

/* DELAYED - Rose/Red */
.status-delayed {
  background-color: rgba(225, 29, 72, 0.12);
  color: #be123c;
  border: 1px solid rgba(225, 29, 72, 0.3);
}
html.dark .status-delayed {
  background-color: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
}

/* OTHER - Violet */
.status-other {
  background-color: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border: 1px solid rgba(124, 58, 237, 0.28);
}
html.dark .status-other {
  background-color: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.38);
}

/* Left accent border on Load Card based on status */
.card-accent-TO_LOAD { border-left: 4px solid #3b82f6; }
.card-accent-LOADING { border-left: 4px solid #f97316; }
.card-accent-READY, .card-accent-TO_DEPART { border-left: 4px solid #10b981; }
.card-accent-DELAYED { border-left: 4px solid #f43f5e; }
.card-accent-OTHER { border-left: 4px solid #8b5cf6; }

/* Authentic EU Polish License Plate Badge */
.eu-plate {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--plate-border);
  border-radius: 0.375rem;
  overflow: hidden;
  background-color: var(--plate-bg);
  color: var(--plate-text);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 0.8125rem;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}
.eu-plate:hover {
  transform: translateY(-1px);
  border-color: #f97316;
}
.eu-plate-band {
  background: linear-gradient(180deg, #003399 0%, #002673 100%);
  color: #ffffff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.2rem 0.28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  user-select: none;
}
.eu-plate-stars {
  color: #ffcc00;
  font-size: 0.45rem;
  line-height: 1;
  margin-bottom: 1px;
}
.eu-plate-num {
  padding: 0.32rem 0.5rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* Trailer plate variant subtle blue-slate band */
.eu-plate-trailer .eu-plate-band {
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
}

/* Dock Gate Badge */
.gate-sign {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
html.dark .gate-sign {
  background-color: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.42);
}

.gate-sign-empty {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.26rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
}

/* Quick Plate Chip */
.plate-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.plate-chip:hover {
  border-color: #f97316;
  color: var(--text-primary);
}
.plate-chip.active-chip {
  background-color: #ea580c;
  color: #ffffff;
  border-color: #ea580c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

/* Progress Stepper */
.stepper-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}
.stepper-node {
  border-radius: 0.6rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  transition: all 0.15s ease;
}
.stepper-node.step-done {
  border-color: rgba(16, 185, 129, 0.38);
  background-color: rgba(16, 185, 129, 0.08);
}
.stepper-node.step-current-blue {
  border-color: rgba(59, 130, 246, 0.55);
  background-color: rgba(59, 130, 246, 0.12);
}
.stepper-node.step-current-orange {
  border-color: rgba(249, 115, 22, 0.6);
  background-color: rgba(249, 115, 22, 0.13);
}
.stepper-node.step-current-green {
  border-color: rgba(16, 185, 129, 0.6);
  background-color: rgba(16, 185, 129, 0.14);
}
.stepper-node.step-current-red {
  border-color: rgba(244, 63, 94, 0.6);
  background-color: rgba(244, 63, 94, 0.14);
}

/* Spinner */
@keyframes spin360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-anim {
  animation: spin360 0.9s linear infinite;
}

@media (max-width: 640px) {
  .stepper-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
