/* Geographic Map Dashboard Styles */

/* Language Toggle Styles - Standardized */
.language-toggle {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 60px;
  justify-content: center;
  margin: 0 0.75rem;
}

.language-toggle:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.language-toggle:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2);
}

.language-toggle i {
  font-size: 0.875rem;
  opacity: 0.8;
}

.language-toggle span {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.map-dashboard {
  display: flex;
  height: calc(100vh - 70px);
  margin-top: 70px;
  background: var(--bg-primary);
}

/* Map Sidebar */
.map-sidebar {
  width: 350px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-header h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Statistics Panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stat-icon.online {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.stat-icon.warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}

.stat-icon.success {
  background: rgba(30, 64, 175, 0.2);
  color: var(--primary-color);
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Controls Panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  z-index: 2;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-section h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.filter-section select {
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.filter-section select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.status-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-checkbox:hover {
  color: var(--text-primary);
}

.filter-checkbox input {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  position: relative;
  transition: var(--transition);
}

.checkmark.online {
  border-color: var(--success-color);
}

.checkmark.warning {
  border-color: var(--warning-color);
}

.checkmark.offline {
  border-color: var(--danger-color);
}

.filter-checkbox input:checked + .checkmark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.filter-checkbox input:checked + .checkmark.online::after {
  background: var(--success-color);
}

.filter-checkbox input:checked + .checkmark.warning::after {
  background: var(--warning-color);
}

.filter-checkbox input:checked + .checkmark.offline::after {
  background: var(--danger-color);
}

/* Legend Panel */
.legend-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-panel h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
}

.legend-marker.online {
  background: var(--success-color);
  border-color: var(--success-color);
}

.legend-marker.warning {
  background: var(--warning-color);
  border-color: var(--warning-color);
}

.legend-marker.offline {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

.legend-marker.alert {
  background: var(--accent-color);
  border-color: var(--accent-color);
  animation: pulse 2s infinite;
}

/* Alerts Panel */
.alerts-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alerts-panel h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  border-left: 4px solid;
}

.alert-item.high {
  border-left-color: var(--danger-color);
}

.alert-item.medium {
  border-left-color: var(--warning-color);
}

.alert-item.low {
  border-left-color: var(--primary-color);
}

.alert-icon {
  width: 30px;
  height: 30px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.alert-item.high .alert-icon {
  background: rgba(220, 38, 38, 0.2);
  color: var(--danger-color);
}

.alert-item.medium .alert-icon {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}

.alert-item.low .alert-icon {
  background: rgba(30, 64, 175, 0.2);
  color: var(--primary-color);
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.alert-location {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.alert-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
  background: var(--bg-primary);
}

#peru-map {
  width: 100%;
  height: 100%;
}

/* Map Controls */
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.map-control-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.map-control-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

/* Map Loading */
.map-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.map-loading p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Video Modal */
.video-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 3000;
  backdrop-filter: blur(5px);
}

.video-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  width: 90vw;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.camera-info h3 {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.camera-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.modal-controls {
  display: flex;
  gap: 0.5rem;
}

.modal-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-btn:hover {
  background: var(--primary-color);
  color: white;
}

.modal-btn.recording {
  background: var(--danger-color);
  color: white;
  animation: pulse 1s infinite;
}

.modal-body {
  flex: 1;
  position: relative;
  background: #000;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Video Fallback Styles */
.video-fallback {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.fallback-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.fallback-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: white;
}

.fallback-content h3 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.fallback-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.fallback-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.fallback-actions .btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fallback-actions .btn.primary {
  background: var(--primary-color);
  color: white;
}

.fallback-actions .btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.fallback-actions .btn.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.fallback-actions .btn.secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.fallback-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: left;
}

.fallback-info p {
  margin: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.fallback-info strong {
  color: var(--text-primary);
}

.status-online {
  color: var(--success-color);
  font-weight: 600;
}

/* AI Analytics Overlay */
.ai-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 300px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  backdrop-filter: blur(10px);
  z-index: 100;
}

.ai-panel h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-panel h4 i {
  color: var(--primary-color);
}

.ai-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ai-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.ai-label {
  color: var(--text-secondary);
}

.ai-value {
  color: var(--text-primary);
  font-weight: 600;
}

.ai-confidence {
  color: var(--success-color);
  font-weight: 500;
}

.ai-alerts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  border-left: 3px solid;
}

.ai-alert.low {
  background: rgba(30, 64, 175, 0.1);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.ai-alert.medium {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--warning-color);
  color: var(--warning-color);
}

.ai-alert.high {
  background: rgba(220, 38, 38, 0.1);
  border-left-color: var(--danger-color);
  color: var(--danger-color);
}

.timestamp {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .map-sidebar {
    width: 300px;
  }
  
  .ai-overlay {
    width: 250px;
  }
}

@media (max-width: 768px) {
  .map-dashboard {
    flex-direction: column;
  }
  
  .map-sidebar {
    width: 100%;
    height: 200px;
    overflow-x: auto;
    padding: 1rem;
  }
  
  .stats-panel {
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .controls-panel,
  .legend-panel,
  .alerts-panel {
    display: none;
  }
  
  .modal-content {
    width: 95vw;
    height: 90vh;
  }
  
  .ai-overlay {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
  }
}
