/* Object Classifier - Full Screen HUD Theme */

:root {
  --color-primary: #4a9eff;
  --color-primary-light: #6bb0ff;
  --color-primary-dark: #357abd;
  --bg-dark: #0a0a0a;
  --bg-panel: rgba(17, 17, 17, 0.8);
  --border-primary: rgba(74, 158, 255, 0.3);
  --color-success: #00ff88;
  --color-error: #ff4757;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a0a0a 0%, #0d1117 50%, #0a0a0a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  padding: 3rem;
  max-width: 420px;
  width: 90%;
}

/* Scanner Animation */
.loading-icon {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
}

.scanner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: scanner-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.scanner-ring::before,
.scanner-ring::after {
  content: '';
  position: absolute;
  border: 3px solid transparent;
  border-radius: 50%;
}

.scanner-ring::before {
  inset: 8px;
  border-top-color: var(--color-primary-light);
  animation: scanner-spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

.scanner-ring::after {
  inset: 20px;
  border-top-color: rgba(74, 158, 255, 0.5);
  animation: scanner-spin 2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.scanner-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 30px var(--color-primary), 0 0 60px rgba(74, 158, 255, 0.5);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes scanner-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 30px var(--color-primary), 0 0 60px rgba(74, 158, 255, 0.5);
  }
  50% { 
    transform: scale(1.15);
    box-shadow: 0 0 50px var(--color-primary), 0 0 100px rgba(74, 158, 255, 0.7);
  }
}

.loading-title {
  font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--color-primary);
  margin: 0 0 2rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px rgba(74, 158, 255, 0.5);
}

/* Loading Steps */
.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
  text-align: left;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(74, 158, 255, 0.05);
  border: 1px solid rgba(74, 158, 255, 0.15);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.loading-step.active {
  background: rgba(74, 158, 255, 0.1);
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(74, 158, 255, 0.2);
}

.loading-step.completed {
  background: rgba(0, 255, 136, 0.08);
  border-color: rgba(0, 255, 136, 0.4);
}

.loading-step.error {
  background: rgba(255, 71, 87, 0.1);
  border-color: rgba(255, 71, 87, 0.5);
}

.step-icon {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.step-icon.pending {
  color: rgba(255, 255, 255, 0.3);
}

.step-icon.loading {
  color: var(--color-primary);
  animation: icon-spin 1s linear infinite;
}

.step-icon.done {
  color: var(--color-success);
}

.step-icon.error {
  color: var(--color-error);
}

@keyframes icon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.step-text {
  font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.02em;
}

.loading-step.completed .step-text {
  color: var(--color-success);
}

.loading-step.error .step-text {
  color: var(--color-error);
}

/* Progress Bar */
.loading-progress {
  margin-top: 1rem;
}

.progress-bar {
  height: 4px;
  background: rgba(74, 158, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success));
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--color-primary);
}

.progress-text {
  font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.05em;
}

/* Main Content Transition */
#mainContent {
  transition: opacity 0.5s ease;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: #e0e0e0;
  font-family: 'Roboto', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 1800px;
  padding: 1rem;
  gap: 1rem;
}

.detection-header {
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.7);
  border-bottom: 1px solid var(--color-primary);
  box-shadow: 0 0 5px rgba(74, 158, 255, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.detection-header h1 {
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(74, 158, 255, 0.4);
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  margin: 0 0 0.5rem 0;
}

.detection-header .subtitle {
  color: rgba(74, 158, 255, 0.7);
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  letter-spacing: 0.1em;
  margin: 0;
}

.detection-container {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1rem;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}

.controls-panel,
.results-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(74, 158, 255, 0.15);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.video-container {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
  min-height: 0;
}

#canvas {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#canvas canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.status-message {
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid;
}

.status-message.info {
  background: rgba(0, 100, 200, 0.2);
  border-color: rgba(0, 150, 255, 0.5);
  color: #88ccff;
}

.status-message.success {
  background: rgba(0, 150, 0, 0.2);
  border-color: rgba(0, 255, 0, 0.5);
  color: #88ff88;
}

.status-message.warning {
  background: rgba(200, 150, 0, 0.2);
  border-color: rgba(255, 200, 0, 0.5);
  color: #ffcc88;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(74, 158, 255, 0.8);
}

.control-group select,
.control-group input[type="range"] {
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.control-group select {
  cursor: pointer;
}

.control-group select:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 5px rgba(74, 158, 255, 0.3);
}

.control-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(0, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--neon-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--neon-cyan-glow);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--neon-cyan);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px var(--neon-cyan-glow);
}

#confidenceValue,
#maxObjectsValue {
  color: var(--color-primary);
  font-weight: 600;
  font-family: monospace;
}

button.secondary {
  padding: 0.75rem 1.5rem;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

button.secondary:hover {
  background: rgba(74, 158, 255, 0.1);
  box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
  transform: translateY(-2px);
}

button.secondary:active {
  transform: translateY(0);
}

.results-panel h3 {
  margin: 0 0 1rem 0;
  color: var(--color-primary);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detections-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.detection-item {
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  border: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.detection-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(74, 158, 255, 0.3);
}

.detection-label {
  font-weight: 600;
  color: #e0e0e0;
  font-size: 0.95rem;
}

.detection-confidence {
  font-family: monospace;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.detection-coords {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  font-family: monospace;
  margin-top: 0.25rem;
}

details {
  margin-top: 1rem;
}

details summary {
  cursor: pointer;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  user-select: none;
  font-weight: 500;
  color: rgba(74, 158, 255, 0.8);
  border: 1px solid var(--border-primary);
  transition: all 0.2s ease;
}

details summary:hover {
  background: rgba(74, 158, 255, 0.05);
  border-color: var(--color-primary);
}

details[open] summary {
  border-bottom: 1px solid var(--border-cyan);
  border-radius: 6px 6px 0 0;
}

#output {
  width: 100%;
  min-height: 200px;
  font-family: monospace;
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-primary);
  border-radius: 0 0 6px 6px;
  padding: 1rem;
  margin-top: 0;
  resize: vertical;
  color: #e0e0e0;
  box-sizing: border-box;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
  .detection-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
}

  .controls-panel { order: 1; }
  .video-container { order: 2; min-height: 50vh; }
  .results-panel { order: 3; }
}

@media (max-width: 768px) {
  .main-content {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .detection-header {
    padding: 0.75rem;
  }
  
  .controls-panel,
  .results-panel {
    padding: 0.75rem;
  }
  
  .video-container {
    min-height: 40vh;
  }
}
