/* CSS Variables for Dark Mode */
:root {
  --text-color: #ffffff;
  --border-color: #ffffff;
  --background-color: #000000;
  --card-background: #000000;
  --nav-background: rgb(4 4 8 / 40%);
  --nav-text: #ffffff;
}

/* Light Mode CSS Variables */
.light-mode {
  --text-color: #000000;
  --border-color: #000000;
  --background-color: #ffffff;
  --card-background: #ffffff;
  --nav-background: #ffffff;
  --nav-text: #000000;
}

/* Body Styling */
body {
  font-family: Arial, sans-serif;
  text-align: center;
  padding: 20px;
  background: url('/pictures/ea_bg_dark_mode.png') no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh; /* Allow content to exceed viewport */
  overflow-y: auto; /* Enable vertical scrolling when needed */
  color: var(--text-color);
  transition: all 0.3s ease;
}

/* Light Mode Body Styling */
body.light-mode {
  background: url('/pictures/ea_bg_light_mode.png') no-repeat center center fixed;
  background-size: cover;
}

/* Transition effects for pages */
.fade-out, .fade-in {
  opacity: 0;
  transition: opacity 1.5s ease; /* Smooth fade effect */
}

/* Fully visible state */
.fade-in {
  opacity: 1;
}

/* Optional: Prevent scrolling during transitions */
body.transitioning {
  overflow: hidden;
}

h1 {
  color: var(--text-color);
}

h2 {
  color: var(--text-color);
  margin: 1%; /* Reduce margin to save space */
}

h3 {
  color: var(--text-color);
}

h4 {
  color: var(--text-color);
}

p {
  color: var(--text-color);
}

pb {
  color: var(--text-color);
}

label {
  color: var(--text-color);
}

/* Readability for preformatted and code blocks on dark background */
pre, code {
  color: var(--text-color);
}

/* Button Containers */
.button-container {
  margin-top: 20px;
}

button {
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid var(--border-color);
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  
  color: var(--text-color);
  padding: 20px 20px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.3s, background 0.3s; /* Smooth hover effect */
}

button:hover {
  transform: translateY(-5px); /* Slight lift on hover */
  background: rgba(28, 30, 45, 0.8);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.btn-primary {
  display: flex;
  background: navy;
  color: white;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.btn-secondary {
  display: flex;
  background: linear-gradient(145deg, #007bff, #0056b3);
  color: white;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

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

/* Modal styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

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

.modal-content {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
}

#loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  display: none; /* Hidden by default */
}

#loading-spinner.active {
  display: block;
}

/* Point cloud viewer */
.viewer-container {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

/* Point cloud controls */
.point-cloud-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.point-cloud-controls button,
.point-cloud-controls select {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  font-size: 14px;
}

.point-cloud-controls button:hover {
  background-color: #f0f0f0;
}

.point-cloud-controls select {
  width: 100%;
}

/* Responsive styles */
@media (max-width: 768px) {
  
  .viewer-container {
    height: 400px;
  }
}

/* App layout utilities used by pages */
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 6px;
  
  background: var(--nav-background);
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border-bottom: 1px solid var(--border-color) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  
  /* Fixed positioning */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
.nav-logo {
  display: flex;
  align-items: center;
}
.nav-logo img {
  height: 40px;
  width: auto;
}
/* Alerts carousel */
.alerts-carousel-container {
  display: none; /* Hidden by default, shown via JS */
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 16px;
  overflow: hidden;
}
.alerts-carousel-label {
  font-size: 12px;
  color: rgba(230, 230, 230, 0.7);
  margin-bottom: 4px;
  font-weight: 500;
}
.alerts-carousel-wrapper {
  width: 100%;
  overflow: hidden;
}
.alerts-carousel {
  display: flex;
  align-items: center;
  will-change: transform;
}
.alert-carousel-item:hover {
  opacity: 0.8;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.4) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid var(--border-color) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  
  transition: all 0.2s ease;
}
.nav a:hover {
  background: rgba(28, 30, 45, 0.1) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
}
.nav a.active {
  background: rgba(79, 195, 247, 0.8) !important;
  color: #0d111a !important;
  border-color: #4fc3f7 !important;
  box-shadow: 0 4px 16px rgba(79, 195, 247, 0.3) !important;
}

.page {
  padding: 12px 16px;
  text-align: left;
  padding-top: 50px; /* Add top padding to account for fixed nav and status bar with moderate separation */
}

.grid {
  display: grid;
  gap: 12px;
}

.card {
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid var(--border-color) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  
  color: var(--text-color) !important;
  border-radius: 20px !important;
  padding: 12px !important;
}

/* Status bar simple styling fallback */
.status-bar { 
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;

  /* Fixed positioning below nav bar */
  position: fixed;
  top: 90px; /* Nav bar height + gap */
  left: 43px;
  right: 43px;
  z-index: 999; /* Below nav bar but above content */

  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid var(--border-color) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  
  color: var(--text-color) !important;
  border-radius: 20px !important; /* All four corners rounded */

  
}
.status-items-container {
  display: flex;
  align-items: center;
  gap: 16px;
}
.status-item { display:flex; flex-direction:column; gap:4px; color:#e6eef6; min-width:120px; }
.status-label { font-size:12px; opacity:0.85; }
.status-value { font-size:18px; font-weight:600; }

/* Alerts Section */
.alerts-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
  margin: 0 20px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(255, 152, 0, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid rgba(255, 152, 0, 0.3) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.15) !important;
  
  color: var(--text-color) !important;
  border-radius: 12px !important;
  padding: 8px 12px;
  min-width: 200px;
  max-width: 300px;
  transition: all 0.2s ease;
}

.alert-item:hover {
  background: rgba(255, 152, 0, 0.2) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25) !important;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.alert-text {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-time {
  font-size: 11px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Sample alert specific styling */
.sample-alert {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Weather and Time Section - common styles fallback */
.weather-time-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.weather-item {
  display: flex;
  align-items: center;
  gap: 8px;
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.4) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  /* border: 1px solid rgba(255, 255, 255, 0.3) !important; */
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  
  color: var(--text-color) !important;
  border-radius: 16px !important;
  /* padding: 8px 12px; */
  min-width: 80px;
}

.weather-icon {
  font-size: 20px;
  line-height: 1;
}

.weather-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weather-temp {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
}

.weather-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1;
  text-transform: capitalize;
}

.time-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.4) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  /* border: 1px solid rgba(255, 255, 255, 0.3) !important; */
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  
  color: var(--text-color) !important;
  border-radius: 16px !important;
  padding: 8px 12px;
  min-width: 80px;
}

.time-display {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  font-family: 'Courier New', monospace;
}

.date-display {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th, .table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  color: #ffffff;
}
.table th {
  color: #dddddd;
  font-weight: 600;
}

.kpi {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.kpi .item {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 140px;
  color: #ffffff;
}

/* Modern tabs (equal width within parent, with active highlight) */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tab-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text-color);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
  width: 100%;
}
.tab-btn.active {
  background: rgba(46, 204, 113, 0.2);
  border-color: #2ecc71;
  box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.3);
}

/* Status report container */
.status-report {
  background: rgba(13,17,26,0.9);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-color);
}
.status-report pre {
  margin: 0;
  white-space: pre-wrap;
}

.dropdown-toggle {
  /* iOS-style semi-transparent gradient - match destinations-sidebar */
  background: rgba(28, 30, 45, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  
  /* Subtle border - match destinations-sidebar */
  border: 1px solid var(--border-color) !important;
  
  /* Soft shadow for depth - match destinations-sidebar */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  
  color: var(--text-color) !important;
  border-radius: 20px !important;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
    align-items: center;
    gap: 8px;
  min-width: 120px;
  }

.dropdown-toggle:hover {
  background: rgba(28, 30, 45, 0.8) !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
  }

.dropdown-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.dropdown-toggle.active .dropdown-icon {
  transform: rotate(45deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  min-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  overflow: hidden;
  }

.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-color);
    font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

/* Small screens: allow wrapping and scrolling */
@media (max-width: 768px) {
  body { padding: 12px; }
  .alerts-carousel-container {
    display: none !important;
  }
  .page { 
    padding: 10px; 
    padding-top: 160px; /* Adjust for mobile nav height and status bar separation */
  }
  .table th, .table td { padding: 6px 8px; font-size: 14px; }
  .kpi { gap: 10px; }
  
  /* Status bar mobile responsive styles */
  .status-bar { 
    flex-wrap: wrap; 
    gap: 8px; 
    padding: 6px 8px; 
    justify-content: flex-start;
    top: 120px; /* Adjust for mobile nav height and separation */
    left: 12px; /* Match mobile body padding */
    right: 12px;
  }
  
  .alerts-section {
    margin: 0 8px;
    gap: 8px;
    order: 1;
    width: 100%;
    justify-content: center;
  }
  
  .alert-item {
    min-width: 150px;
    max-width: 250px;
    padding: 6px 10px;
  }
  
  .alert-text {
    font-size: 12px;
  }
  
  .alert-time {
    font-size: 10px;
  }
  
  .status-item { 
    min-width: 80px; 
    flex: 1 1 auto; 
    text-align: center; 
  }
  .status-label { 
    font-size: 10px; 
  }
  .status-value { 
    font-size: 14px; 
  }
}

/* Landscape mode fixes for tablets and mobile devices */
@media (max-width: 1024px) and (orientation: landscape) {
  .nav {
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 20px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .nav-logo {
    order: 0;
    flex-shrink: 0;
  }
  .nav-links {
    order: 0;
    flex-shrink: 0;
    gap: 6px;
  }
  .nav-links a {
    padding: 3px 5px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  /* Status bar landscape fixes */
  .status-bar {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .status-item {
    flex-shrink: 0;
    min-width: 100px;
  }
}

/* Very small mobile screens */
@media (max-width: 480px) {
  .nav {
    padding: 8px 15px;
  }
  .nav-links {
    gap: 4px;
    justify-content: center;
  }
  .nav-links a {
    padding: 3px 4px;
    font-size: 12px;
  }
  .page { 
    padding: 8px; 
    padding-top: 50px; /* Adjust for very small mobile nav height and status bar separation */
  }
  
  /* Status bar positioning for very small screens */
  .status-bar {
    left: 8px; /* Match very small mobile page padding */
    right: 8px;
  }

  .alerts-section {
    margin: 0 4px;
    gap: 6px;
    order: 1;
  }
  
  .alert-item {
    min-width: 120px;
    max-width: 200px;
    padding: 4px 8px;
  }
  
  .alert-text {
    font-size: 11px;
  }
  
  .alert-time {
    font-size: 9px;
  }
  
  .status-item { 
    min-width: 60px; 
    flex: 1 1 auto;
    order: 1;
  }
  .status-label { 
    font-size: 9px; 
  }
  .status-value { 
    font-size: 12px; 
  }
}

/* Shared status/battery visuals (used in Fleet and Robot Detail) */
.status-indicator { display:inline-block; width:10px; height:10px; border-radius:50%; }
.status-online { background-color:#2ecc71; }
.status-offline { background-color:#e74c3c; }

/* Mission status indicators */
.status-indicator.status-available { background-color:#2ecc71; }
.status-indicator.status-ready { background-color:#2ecc71; }
.status-indicator.status-mission { background-color:#3498db; }
.status-indicator.status-paused { background-color:#f1c40f; }
.status-indicator.status-rally { background-color:#f1c40f; }
.status-indicator.status-abort { background-color:#e74c3c; }
.status-indicator.status-aborted { background-color:#e74c3c; }
.battery-display { display:flex; align-items:center; gap:0.5rem; color:#ffffff; }
.battery-bar { height:20px; width:50px; background-color:#2b2f3a; border-radius:4px; overflow:hidden; position:relative; display:flex; align-items:center; justify-content:center; }
.battery-fill { height:100%; background-color:#2ecc71; /* Default green - will be overridden by JavaScript */ position:absolute; top:0; left:0; }
.battery-percentage { position:relative; z-index:1; font-size:11px; font-weight:bold; color:#000000; text-shadow:1px 1px 2px rgba(255,255,255,0.7); }

/* --------------------------- robot markers --------------------------- */

/* normal markers */
.marker-content {
  width: 50px; /* Adjust based on your icon size */
  height: 70px; /* Adjust based on your icon size */
}

.marker-image {
  transform-origin: center;
  width: 100%; /* Ensure the image fills the container */
  height: 100%;
  position: absolute;
  top: 50%;
  left: 0%;
  right: 50%;
  bottom: 0%;
  transform-origin: center;
  z-index: 10000000;
}

/* robot markers */
.robot-marker-content {
  width: 35px; /* Adjust based on your icon size */
  height: 50px; /* Adjust based on your icon size */
}

.robot-marker-image {
  transform-origin: center;
  width: 100%; /* Ensure the image fills the container */
  height: 100%;
  position: absolute;
  top: 50%;
  left: 0%;
  right: 50%;
  bottom: 0%;
  transform-origin: center;
  z-index: 10000000;
}