/* ─── OHT Control System — Loading Screen ─── */
/* Displayed while Flutter engine downloads and initializes */

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

body {
  background: #07111F;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #E7EEF8;
  overflow: hidden;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #07111F 0%, #0B1A30 50%, #07111F 100%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Logo area */
.loading-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
  position: relative;
}

.loading-logo-ring {
  width: 80px;
  height: 80px;
  border: 3px solid #1A3A5C;
  border-top-color: #67B7FF;
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.loading-logo-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #67B7FF;
  letter-spacing: 1px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Title */
.loading-title {
  font-size: 22px;
  font-weight: 700;
  color: #E7EEF8;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.loading-subtitle {
  font-size: 13px;
  color: #7F94AA;
  margin-bottom: 32px;
}

/* Progress bar container */
.loading-progress-container {
  width: min(400px, 80vw);
  position: relative;
}

.loading-progress-track {
  width: 100%;
  height: 6px;
  background: #172235;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #1E3350;
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #07539D, #67B7FF);
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(103, 183, 255, 0.3);
}

/* Indeterminate mode */
.loading-progress-bar.indeterminate {
  width: 30% !important;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(440%); }
}

/* Status text */
.loading-status {
  margin-top: 14px;
  font-size: 12px;
  color: #7F94AA;
  text-align: center;
  min-height: 18px;
  transition: opacity 0.2s;
}

.loading-percent {
  position: absolute;
  right: 0;
  top: -22px;
  font-size: 12px;
  color: #67B7FF;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Version info */
.loading-version {
  position: fixed;
  bottom: 20px;
  font-size: 11px;
  color: #33465F;
  letter-spacing: 0.3px;
}

/* Error state */
.loading-error {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.loading-error.visible {
  display: flex;
}

.loading-error-text {
  color: #F87171;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
  max-width: 350px;
}

.loading-retry-btn {
  background: #07539D;
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.loading-retry-btn:hover {
  background: #1A6DB8;
}

/* Offline banner */
.loading-offline-banner {
  display: none;
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #3D2A0A;
  color: #F59E0B;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #5C400F;
  z-index: 100000;
}

.loading-offline-banner.visible {
  display: block;
}

/* Update banner (shown when app is running) */
#update-banner {
  display: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #102F4D;
  border: 1px solid #2D8FE8;
  border-radius: 8px;
  padding: 14px 20px;
  color: #E7EEF8;
  font-size: 13px;
  z-index: 100001;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  max-width: 320px;
}

#update-banner.visible {
  display: block;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

#update-banner .update-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #67B7FF;
}

#update-banner .update-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#update-banner .update-btn {
  padding: 6px 16px;
  border-radius: 4px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

#update-banner .update-btn-primary {
  background: #07539D;
  color: #fff;
}

#update-banner .update-btn-secondary {
  background: transparent;
  color: #7F94AA;
  border: 1px solid #33465F;
}
