/* WiFi Vision AR - Clean Professional UI */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  /* Primary Palette - More subtle, professional */
  --primary: #0ea5e9;
  --primary-dim: rgba(14, 165, 233, 0.15);
  --secondary: #8b5cf6;
  --secondary-dim: rgba(139, 92, 246, 0.15);

  /* Signal Colors - Softer tones */
  --signal-excellent: #22c55e;
  --signal-good: #84cc16;
  --signal-medium: #f59e0b;
  --signal-poor: #f97316;
  --signal-bad: #ef4444;

  /* Backgrounds */
  --bg-dark: rgba(15, 23, 42, 0.95);
  --bg-card: rgba(30, 41, 59, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.05);

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Effects - Subtle */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --border-subtle: 1px solid rgba(255, 255, 255, 0.1);

  /* Typography */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: #0f172a;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Main Container */
.main-container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  padding: 16px 0 8px;
  width: 100%;
  max-width: 500px;
}

.hero-icon {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(14, 165, 233, 0.3));
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.hero-tagline {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0;
}

/* ===== CAMERA / AR SECTION ===== */
.ar-section {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  background: #0a0f1a;
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

#camera-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* ===== AR OVERLAY ===== */
#ar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ===== SIGNAL BOXES (AR Markers) ===== */
#signal-boxes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.signal-box {
  position: absolute;
  min-width: 64px;
  padding: 8px 10px;
  background: var(--bg-dark);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  /* Smooth transitions for position changes */
  transition:
    left 0.1s ease-out,
    top 0.1s ease-out,
    transform 0.1s ease-out,
    opacity 0.2s ease;
}

.signal-box > div:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.box-dist {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}

.signal-box > div:last-child {
  font-weight: 600;
  font-size: 11px;
}

/* ===== GUIDE ARROW (Agent Navigation) ===== */
/* ===== GUIDE ARROW (Agent Navigation) ===== */
.guide-arrow {
  position: absolute;
  bottom: 25%;
  left: 50%;
  /* Transform is handled in JS for rotation */
  font-size: 80px;
  color: var(--primary);
  opacity: 0.9;
  z-index: 15;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.guide-text {
  position: absolute;
  top: calc(50% + 60px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 16px;
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* Hide when empty */
.guide-text:empty {
  display: none;
}

/* ===== HUD STATS DISPLAY ===== */
.stats-display {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--bg-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: var(--border-subtle);
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.stats-display::before {
  content: "NETWORK";
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 6px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-key {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* ===== CONTROL PANEL (Buttons) ===== */
.control-panel {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  pointer-events: auto;
  z-index: 30;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: #0284c7;
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--bg-card);
  color: var(--signal-bad);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ===== MAP SECTION ===== */
.map-section {
  width: 100%;
  max-width: 500px;
  height: 250px;
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  flex-shrink: 0;
}

#map {
  height: 100%;
  width: 100%;
  border-radius: var(--radius-lg);
}

/* Leaflet - Clean styling */
.leaflet-container {
  background: #f8fafc !important;
  font-family: var(--font-body) !important;
  border-radius: var(--radius-lg);
}

/* Hide attribution for cleaner look */
.leaflet-control-attribution {
  display: none;
}

/* Map Controls */
.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.filter-select {
  background: white !important;
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #000000 !important; /* Force Black */
  box-shadow: var(--shadow-sm);
  outline: none;
  min-width: 120px;
  -webkit-appearance: none; /* Fix for iOS */
  appearance: none;
}

.filter-select option {
  background: white !important;
  color: #000000 !important;
}

.location-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 500;
  font-size: 11px;
}

.location-info span {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.location-info b {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== PROVIDER CARD ===== */
.provider-card {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.provider-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  display: block;
  margin-bottom: 4px;
}

#current-provider {
  margin: 0;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

/* ===== ANIMATIONS - Clean & Simple ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

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

.loader {
  position: relative;
  width: 48px;
  height: 48px;
}

.loader-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-ring:nth-child(2) {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  border-top-color: var(--secondary);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

.loader-ring:nth-child(3) {
  display: none;
}

.loader-text {
  display: none;
}

.loader-status {
  margin-top: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .ar-section {
    height: 45vh;
    min-height: 250px;
  }

  .stats-display {
    top: 12px;
    left: 12px;
    padding: 10px 14px;
  }

  .control-panel {
    bottom: 16px;
    gap: 10px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 12px;
  }

  .signal-box {
    min-width: 56px;
    padding: 6px 8px;
    font-size: 10px;
  }
}

/* ===== UTILITY CLASSES ===== */
.glass-panel {
  background: var(--bg-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
}
