/* AndroidGuard - Custom Styles */
:root {
  --ag-primary: #6366f1;
  --ag-secondary: #8b5cf6;
  --ag-accent: #06b6d4;
  --ag-dark: #0f172a;
  --ag-dark-card: #1e293b;
  --ag-dark-border: #334155;
  --ag-success: #10b981;
  --ag-warning: #f59e0b;
  --ag-danger: #ef4444;
}

* { box-sizing: border-box; }

body { 
  background: #0f172a; 
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Navigation active state */
.nav-item.active {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #a5b4fc !important;
  border-left: 2px solid #6366f1;
}

/* Cards */
.stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { border-color: rgba(99, 102, 241, 0.3); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.stat-card:hover::before { opacity: 1; }

/* Device cards */
.device-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.device-card:hover { border-color: rgba(99, 102, 241, 0.4); background: #253047; }
.device-card.selected { border-color: #6366f1; background: rgba(99,102,241,0.1); }

/* Online indicator */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.2); animation: pulse-green 2s infinite; }
.status-dot.offline { background: #6b7280; }
.status-dot.warning { background: #f59e0b; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0.1); }
}

/* Battery indicator */
.battery-bar {
  width: 100%;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}
.battery-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.battery-fill.high { background: linear-gradient(90deg, #10b981, #34d399); }
.battery-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.battery-fill.low { background: linear-gradient(90deg, #ef4444, #f87171); }
.battery-fill.charging { background: linear-gradient(90deg, #6366f1, #8b5cf6); }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.5s ease;
}

/* Tabs */
.tab-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: #94a3b8;
  border: none;
  background: transparent;
}
.tab-btn:hover { color: #e2e8f0; background: rgba(255,255,255,0.05); }
.tab-btn.active { color: #a5b4fc; background: rgba(99,102,241,0.15); }

/* Badges */
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-info { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-gray { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* Tables */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th {
  background: rgba(255,255,255,0.03);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #334155;
}
.data-table td {
  padding: 12px 14px;
  font-size: 14px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tr:last-child td { border-bottom: none; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Form inputs */
.form-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: #475569; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #94a3b8; margin-bottom: 6px; }

/* Buttons */
.btn { 
  padding: 8px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 500; cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
  border: none;
}
.btn-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-secondary { background: rgba(255,255,255,0.06); color: #94a3b8; border: 1px solid #334155; }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.btn-success:hover { background: rgba(16,185,129,0.25); }

/* App icon placeholder */
.app-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* Alert severity */
.alert-critical { border-left: 3px solid #ef4444; }
.alert-warning { border-left: 3px solid #f59e0b; }
.alert-info { border-left: 3px solid #6366f1; }

/* Chart container */
.chart-container { position: relative; height: 200px; }

/* Fade animation */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #253047 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Screenshot viewer */
.screenshot-viewer {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* Map placeholder */
.map-placeholder {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid #334155;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #475569;
}

/* Sidebar collapsed */
#sidebar.collapsed { width: 64px; }
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-text,
#sidebar.collapsed .user-text { display: none; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { position: fixed; z-index: 40; height: 100%; transform: translateX(-100%); transition: transform 0.3s; }
  #sidebar.mobile-open { transform: translateX(0); }
}

/* Permission toggle */
.permission-toggle {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.toggle-switch {
  position: relative; width: 44px; height: 24px;
  background: #334155; border-radius: 12px;
  cursor: pointer; transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: #6366f1; }
.toggle-switch::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* Timeline */
.timeline-item { position: relative; padding-left: 24px; padding-bottom: 16px; }
.timeline-item::before {
  content: '';
  position: absolute; left: 6px; top: 8px; bottom: 0;
  width: 1px; background: #334155;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute; left: 0; top: 6px;
  width: 13px; height: 13px;
  border-radius: 50%; border: 2px solid #334155;
  background: #1e293b;
}

/* Tooltip */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #0f172a; color: #cbd5e1;
  font-size: 12px; padding: 4px 8px;
  border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s;
  border: 1px solid #334155;
}
.tooltip:hover::after { opacity: 1; }

/* Pulse recording indicator */
.recording-indicator {
  display: flex; align-items: center; gap-6px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: #f87171;
}
.recording-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
