/* css/themes.css */
/* Advanced Theme Engine Styles */

/* Smooth Transition for Theme Changes */
body {
    transition: background-color 0.5s ease, color 0.5s ease;
}

.panel, .modal-content, .card, .nav-item, .sidebar, .topbar {
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}

/* Explicit Dark Theme Variables (Fallback/Override if needed) */
body.theme-dark {
    --bg: #030712; 
    --bg2: #0a0f1e; 
    --bg3: #0d1526;
    --panel: rgba(13,21,38,0.88);
    --border: rgba(0,255,200,0.12); 
    --border2: rgba(255,60,60,0.15);
    --teal: #00ffc8; 
    --teal2: #00d4a8;
    --text: #e0f0ff; 
    --text2: #7a9ab8;
}

/* Enhancing Light Theme Variables */
body.theme-light, body.light-mode {
    --bg: #f3f4f6; 
    --bg2: #ffffff; 
    --bg3: #e5e7eb;
    --panel: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 0, 0, 0.1); 
    --border2: rgba(255, 60, 60, 0.2);
    --text: #111827; 
    --text2: #4b5563;
    --teal: #008f70; /* Darker teal for contrast */
    --glow-teal: 0 0 15px rgba(0, 143, 112, 0.2);
}

/* Theme Toggle Button Style */
.theme-btn {
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.theme-btn:active {
    transform: scale(0.9);
}

/* Pulse animation when auto mode switches */
@keyframes themeSwitch {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
    100% { filter: brightness(1); }
}

.theme-transitioning {
    animation: themeSwitch 0.5s ease-out;
}

/* Sync Indicator */
.sync-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 255, 200, 0.1);
    border: 1px solid var(--teal);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--teal);
    animation: slideIn 0.3s ease;
    z-index: 9999;
}

.sync-indicator.fade-out {
    animation: fadeOut 0.5s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}


/* ══════════ PREMIUM RADAR MAP ══════════ */
.map-container {
  position: relative; width: 100%; height: 500px;
  background: radial-gradient(circle at center, rgba(0,255,200,0.08) 0%, rgba(3,7,18,0.98) 80%);
  border-radius: 20px; overflow: hidden;
  border: 1px solid rgba(0,255,200,0.15);
  box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}
.map-grid {
  position: absolute; inset: 0;
  background-image: 
    linear-gradient(rgba(0,255,200,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,200,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
}
.map-scan-line {
  position: absolute; top: 0; left: 0; width: 200%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,255,200,0.6), transparent);
  transform-origin: center;
  animation: radarScan 4s linear infinite;
  box-shadow: 0 0 15px rgba(0,255,200,0.5);
  top: 50%; left: -50%;
}
@keyframes radarScan { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Center HQ */
.map-globe {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0,255,200,0.25), rgba(0,30,60,0.9));
  border: 1px solid rgba(0,255,200,0.4);
  box-shadow: 0 0 50px rgba(0,255,200,0.2), inset 0 0 30px rgba(0,255,200,0.15);
  animation: globePulse 3s ease-in-out infinite;
}
@keyframes globePulse { 
  0%, 100% { box-shadow: 0 0 50px rgba(0,255,200,0.2), inset 0 0 30px rgba(0,255,200,0.15); } 
  50% { box-shadow: 0 0 80px rgba(0,255,200,0.35), inset 0 0 50px rgba(0,255,200,0.25); } 
}

/* Radar Rings */
.map-ring {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid rgba(0,255,200,0.15);
  animation: ringExpand 4s linear infinite;
  box-shadow: inset 0 0 20px rgba(0,255,200,0.02);
}
.map-ring:nth-child(1) { width: 220px; height: 220px; animation-delay: 0s; border: 1px dashed rgba(0,255,200,0.2); }
.map-ring:nth-child(2) { width: 340px; height: 340px; animation-delay: 1.3s; border-color: rgba(0,255,200,0.1); }
.map-ring:nth-child(3) { width: 480px; height: 480px; animation-delay: 2.6s; border-color: rgba(0,255,200,0.05); }
@keyframes ringExpand { 
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 1; } 
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0; } 
}

/* Map Nodes */
.cyber-map-node {
  position: absolute; cursor: pointer; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 10;
}
.cyber-node-dot {
  width: 14px; height: 14px; border-radius: 50%; position: relative;
}
.cyber-node-dot::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  animation: nodePulse 2s ease-in-out infinite;
}
@keyframes nodePulse { 0%, 100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(2.2); opacity: 0; } }

.cyber-node-dot.online { background: var(--teal); box-shadow: 0 0 15px var(--teal); }
.cyber-node-dot.online::after { background: rgba(0,255,200,0.4); }

.cyber-node-dot.warning { background: var(--gold); box-shadow: 0 0 15px var(--gold); }
.cyber-node-dot.warning::after { background: rgba(255,215,0,0.4); }

.cyber-node-dot.offline { background: var(--red); box-shadow: 0 0 15px var(--red); }
.cyber-node-dot.offline::after { background: rgba(255,60,60,0.4); }

/* Node Label */
.cyber-node-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text);
  white-space: nowrap; background: rgba(3,7,18,0.9); padding: 4px 10px;
  border-radius: 20px; border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(4px); box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  transition: 0.3s;
}
.cyber-map-node:hover .cyber-node-label { border-color: var(--teal); box-shadow: 0 0 12px rgba(0,255,200,0.3); color: var(--teal); }
.center-label { background: transparent; border: none; box-shadow: none; font-size: 12px; margin-top: 60px; letter-spacing: 2px; font-weight: bold; color: var(--teal); text-shadow: 0 0 10px rgba(0,255,200,0.5); }

/* SVG Lines */
.map-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* Data Packets */
.data-packet {
  position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--teal);
  box-shadow: 0 0 10px var(--teal); animation: packetFlow 2s linear infinite; z-index: 6;
}
@keyframes packetFlow {
  0% { opacity: 0; transform: translate(0,0); }
  10% { opacity: 1; } 
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}

/* LIVE Indicator */
.live-indicator {
  position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 8px;
  font-family: 'Orbitron', monospace; font-size: 11px; color: var(--teal); letter-spacing: 1px;
  background: rgba(0,255,200,0.08); padding: 8px 14px; border-radius: 20px; border: 1px solid rgba(0,255,200,0.25);
  box-shadow: 0 0 15px rgba(0,255,200,0.1);
  z-index: 20;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Map Stats Overlay */
.map-stats {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  display: flex; gap: 12px; justify-content: center; z-index: 20;
}
.map-stat {
  flex: 1; max-width: 180px; padding: 14px;
  background: rgba(5,10,20,0.85); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  text-align: center; transition: 0.3s;
}
.map-stat:hover { border-color: rgba(0,255,200,0.4); transform: translateY(-3px); box-shadow: 0 15px 40px rgba(0,255,200,0.1); }
.ms-v { font-family: 'Orbitron', monospace; font-size: 20px; font-weight: 700; color: var(--teal); margin-bottom: 3px; }
.ms-l { font-size: 10px; color: var(--text2); font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 1px; }

/* Mobile */
@media(max-width:700px) {
  .map-container { height: 400px; }
  .map-globe { width: 100px; height: 100px; }
  .map-ring:nth-child(1) { width: 160px; height: 160px; }
  .map-ring:nth-child(2) { width: 220px; height: 220px; }
  .map-ring:nth-child(3) { width: 280px; height: 280px; }
  .map-stats { flex-wrap: wrap; bottom: 8px; left: 8px; right: 8px; gap: 8px; }
  .map-stat { min-width: 45%; padding: 10px; }
  .ms-v { font-size: 16px; }
  .live-indicator { top: 8px; right: 8px; font-size: 9px; padding: 6px 10px; }
  .cyber-node-label { font-size: 9px; padding: 3px 6px; }
}

/* Animate in */
@keyframes fadeUp{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
.section.active>*{animation:fadeUp .4s ease both;}
.section.active>*:nth-child(1){animation-delay:.04s}
.section.active>*:nth-child(2){animation-delay:.08s}
.section.active>*:nth-child(3){animation-delay:.12s}
.section.active>*:nth-child(4){animation-delay:.16s}
.section.active>*:nth-child(5){animation-delay:.2s}

/* NODE DETAIL PANEL */
.node-detail-panel {
  position: fixed; top: 0; right: -420px;
  width: 400px; height: 100vh;
  background: rgba(3, 7, 18, 0.95);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--teal);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; padding: 24px;
  overflow-y: auto;
}
.node-detail-panel.active { right: 0; }
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  z-index: 999; display: none; backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.3s;
}
.panel-overlay.active { display: block; opacity: 1; }
.panel-close-btn {
  position: absolute; top: 20px; right: 20px;
  background: none; border: none; color: var(--text2);
  font-size: 28px; cursor: pointer; transition: color 0.2s;
}
.panel-close-btn:hover { color: var(--red); }
.panel-header { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; margin-top: 10px; }
.site-favicon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(0,255,200,0.05); border: 1px solid rgba(0,255,200,0.3);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.panel-title-section h3 { margin: 0 0 5px 0; font-family: 'Orbitron', sans-serif; color: var(--text); font-size: 18px; }
.panel-status-badge { font-size: 11px; padding: 3px 8px; border-radius: 12px; background: rgba(0,255,200,0.1); color: var(--teal); border: 1px solid var(--teal); display: inline-block;}
.panel-status-badge.offline { background: rgba(255,60,60,0.1); color: var(--red); border-color: var(--red); }
.panel-status-badge.warning { background: rgba(255,215,0,0.1); color: var(--gold); border-color: var(--gold); }
.panel-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 30px; }
.panel-stat-card {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px; padding: 15px; display: flex; align-items: center; gap: 12px;
  transition: transform 0.2s;
}
.panel-stat-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.1); }
.stat-icon { font-size: 20px; }
.stat-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.stat-value { font-size: 14px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--text); }
.panel-chart-section {
  background: rgba(255,255,255,0.02); border-radius: 12px; padding: 15px;
  margin-bottom: 30px; border: 1px solid rgba(255,255,255,0.05);
}
.panel-chart-section h4 { margin: 0 0 15px 0; font-size: 12px; color: var(--text2); font-weight: normal; }
.panel-actions { display: flex; gap: 10px; margin-bottom: 20px; }
.btn-panel-action {
  flex: 1; padding: 12px; border-radius: 8px; border: none; cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 500; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s;
}
.btn-panel-action.primary { background: rgba(0,255,200,0.1); color: var(--teal); border: 1px solid var(--teal); }
.btn-panel-action.primary:hover { background: rgba(0,255,200,0.2); box-shadow: 0 0 15px rgba(0,255,200,0.3); }
.btn-panel-action.secondary { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid rgba(255,255,255,0.1); }
.btn-panel-action.secondary:hover { background: rgba(255,255,255,0.1); }
.panel-last-checked { text-align: center; font-size: 11px; color: var(--text2); font-style: italic; }

@media (max-width: 768px) {
  .node-detail-panel { width: 100%; right: -100%; border-left: none; }
}
