/* Emergency Command Center UI - Custom Design */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Inter', 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #000000;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(220, 38, 38, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(14, 165, 233, 0.03) 0%, transparent 50%),
    linear-gradient(180deg, transparent 0%, rgba(31, 41, 55, 0.02) 100%);
  color: #f8fafc;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  /* Enhanced mobile text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Safe area insets for iOS devices with notches */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Mobile typography optimizations */
@media (max-width: 768px) {
  body {
    font-size: 16px; /* Prevent zoom on iOS */
    line-height: 1.5; /* Better mobile reading */
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px; /* Maintain readable size */
    line-height: 1.4; /* Tighter for small screens */
  }
}

/* Tactical grid background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(220, 38, 38, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 38, 38, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0.3;
  z-index: -1;
}

/* Emergency Command Center Color Palette */
:root {
  --emergency-red: #dc2626;
  --emergency-red-glow: rgba(220, 38, 38, 0.4);
  --tactical-orange: #f59e0b;  
  --tactical-orange-glow: rgba(245, 158, 11, 0.4);
  --electric-blue: #0ea5e9;
  --electric-blue-glow: rgba(14, 165, 233, 0.4);
  --success-green: #10b981;
  --success-green-glow: rgba(16, 185, 129, 0.4);
  
  --steel-dark: #1f2937;
  --steel-medium: #374151;
  --steel-light: #4b5563;
  --tactical-bg: rgba(31, 41, 55, 0.8);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --glow-sm: 0 0 10px;
  --glow-md: 0 0 20px;
  --glow-lg: 0 0 30px;
}

/* Typography - Tactical Command Style */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

h1 { 
  font-size: 2.5rem; 
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

h2 { 
  font-size: 2rem;
  letter-spacing: 0.02em;
}

h3 { 
  font-size: 1.5rem;
  color: var(--emergency-red);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
}

h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Brand Logo - Exact Dispatchr Style */
.logo-text {
  color: #ffffff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
}

.logo-r {
  background: linear-gradient(45deg, #ff4444, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
  font-weight: 900;
}

.logo-main {
  color: #ffffff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
}

.logo-subtitle {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0.1em;
  margin-left: 0.75rem;
}

/* Gradient animation from main Dispatchr site */
@keyframes gradientShift {
  0% { background-position: 0% 50%; filter: hue-rotate(0deg); }
  25% { background-position: 100% 50%; filter: hue-rotate(90deg); }
  50% { background-position: 100% 100%; filter: hue-rotate(180deg); }
  75% { background-position: 0% 100%; filter: hue-rotate(270deg); }
  100% { background-position: 0% 50%; filter: hue-rotate(360deg); }
}

/* Data Typography */
.data-value {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.tactical-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* Command Center Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emergency-red) 0%, #b91c1c 100%);
  color: var(--text-primary);
  box-shadow: var(--glow-sm) var(--emergency-red-glow);
  border: 1px solid var(--emergency-red);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ef4444 0%, var(--emergency-red) 100%);
  transform: translateY(-2px);
  box-shadow: 
    var(--glow-md) var(--emergency-red-glow),
    0 8px 25px rgba(220, 38, 38, 0.2);
}

.btn-secondary {
  background: var(--steel-dark);
  color: var(--text-primary);
  border: 1px solid var(--steel-medium);
  box-shadow: var(--glow-sm) rgba(75, 85, 99, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--steel-medium);
  border-color: var(--steel-light);
  transform: translateY(-1px);
  box-shadow: var(--glow-md) rgba(75, 85, 99, 0.4);
}

.btn-large {
  padding: 1.25rem 2.5rem;
  font-size: 1rem;
  letter-spacing: 0.1em;
}

.full-width {
  width: 100%;
  margin-bottom: 0.75rem;
}

/* Tactical Header Buttons */
.header-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--tactical-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--steel-medium);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  position: relative;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.header-btn:hover {
  background: rgba(31, 41, 55, 0.9);
  border-color: var(--emergency-red);
  box-shadow: var(--glow-sm) var(--emergency-red-glow);
  transform: translateY(-1px);
}

.header-btn.active {
  background: rgba(220, 38, 38, 0.2);
  border-color: var(--emergency-red);
  box-shadow: var(--glow-md) var(--emergency-red-glow);
}

.btn-icon {
  font-size: 1rem;
  opacity: 0.8;
}

/* Form elements - Enhanced for mobile */
label { 
  display: block; 
  margin-bottom: 8px; 
  color: #aaa; 
  font-size: 0.9rem; 
  font-weight: 500; 
  line-height: 1.4;
}

select, input[type="text"], input[type="email"], input[type="password"] { 
  width: 100%; 
  padding: 12px; /* Larger padding for better touch targets */
  margin-bottom: 12px; 
  background-color: #2a2a2a; 
  color: white; 
  border: 1px solid #444; 
  border-radius: 6px; /* Slightly larger border radius */
  box-sizing: border-box; 
  font-family: inherit;
  font-size: 16px; /* Prevent zoom on iOS */
  min-height: 44px; /* Better touch target */
}

/* Mobile form improvements */
@media (max-width: 768px) {
  label {
    font-size: 1rem; /* Larger labels for mobile */
    margin-bottom: 10px;
  }
  
  select, input[type="text"], input[type="email"], input[type="password"] {
    padding: 14px; /* Even larger touch targets */
    font-size: 16px; /* Maintain to prevent zoom */
    min-height: 48px;
  }
}

select:focus, input:focus {
  outline: none;
  border-color: #61dafb;
  box-shadow: 0 0 0 2px rgba(97, 218, 251, 0.2);
}

/* Radio buttons and checkboxes */
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-option:hover {
  background: #222;
  border-color: #444;
}

.radio-option input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: #61dafb;
}

/* Loading states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid #61dafb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-content h2 {
  color: #61dafb;
  margin-bottom: 0.5rem;
}

.loading-content p {
  color: #888;
  font-size: 0.875rem;
}

/* Utility classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: #888;
}

.text-success {
  color: #3fb950;
}

.text-warning {
  color: #f39c12;
}

.text-danger {
  color: #dc3545;
}

/* Status indicators */
.status-online {
  color: #3fb950;
}

.status-offline {
  color: #dc3545;
}

.status-warning {
  color: #f39c12;
}

/* Command Center Animations */
/* Removed old pulse-glow animation - replaced with gradientShift */

@keyframes radar-sweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes tactical-fade-in {
  from { 
    opacity: 0; 
    transform: translateY(20px) scale(0.95);
    filter: blur(2px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes slide-in-left {
  from { 
    opacity: 0;
    transform: translateX(-30px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes number-count-up {
  from { 
    opacity: 0;
    transform: scale(0.8);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes status-pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.7;
    transform: scale(1.1);
  }
}

@keyframes border-glow {
  0%, 100% { 
    box-shadow: 0 0 0 1px var(--steel-medium);
  }
  50% { 
    box-shadow: 
      0 0 0 1px var(--emergency-red),
      var(--glow-sm) var(--emergency-red-glow);
  }
}

/* Animation Classes */
.animate-fade-in {
  animation: tactical-fade-in 0.5s ease-out;
}

.animate-slide-in {
  animation: slide-in-left 0.4s ease-out;
}

.animate-count-up {
  animation: number-count-up 0.8s ease-out;
}

.animate-pulse {
  animation: status-pulse 2s ease-in-out infinite;
}

.animate-border-glow {
  animation: border-glow 3s ease-in-out infinite;
}

/* Stagger animation delays for multiple elements */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1a1a;
}