body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: radial-gradient(circle at top left, #0c1f4c 0%, #020b28 45%, #02081f 100%);
  color: #e2e8f0;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 9;
  background: rgba(17, 24, 39, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(12px);
}

.logo { color: #93c5fd; text-decoration: none; font-weight: 700; }
.nav-links a { color: #cbd5e1; margin-left: 14px; text-decoration: none; }
.nav-links a.active { color: #60a5fa; font-weight: 700; border-bottom: 2px solid #60a5fa; padding-bottom: 2px; }

.container { max-width: 1080px; margin: 20px auto; padding: 0 16px 24px; }
.panel { display: none; }
.panel.show { display: block; }

.hero { text-align: center; margin-bottom: 20px; }
.hero h1 { color: #22d3ee; margin-bottom: 8px; }
.hero p { color: #c0d5ea; }

.about { text-align: center; margin-bottom: 18px; }
.about h2 { margin-bottom: 8px; }
.about-text { max-width: 860px; margin: 0 auto; color: #c9d6e3; line-height: 1.5; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; }
.tool-box,
#url-panel, #file-panel, #ip-panel, #email-panel,
.info-section {
  background: rgba(23, 35, 60, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(2, 8, 28, 0.28);
}

.tool-description { color: #9bb0c9; font-size: 14px; }
.center-box { margin-top: 16px; }

input, textarea, button {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(8, 15, 34, 0.86);
  color: #e2e8f0;
}
button {
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  border: none;
  color: #04111f;
  font-weight: 700;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }

pre, .result-box, .scan-result, #passwordResult {
  background: rgba(3, 10, 27, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
}

footer {
  text-align: center;
  padding: 14px 10px 20px;
  color: #9fb1c8;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  margin-top: 20px;
}
footer a { color: #7dd3fc; text-decoration: none; }

.nav-container { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.nav-logo { color: #93c5fd; text-decoration: none; font-weight: 700; }
.nav-menu { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; }
.nav-link { color: #cbd5e1; text-decoration: none; }
.nav-link.active { color: #60a5fa; font-weight: 700; }
.info-container { max-width: 980px; margin: 20px auto; padding: 0 16px; }
.about-card .contact-block {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 10px;
}

.theme-toggle {
  position: fixed;
  top: 120px;
  right: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  color: #04111f;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

#chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 1001;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

#chat-widget {
  position: fixed;
  right: 18px;
  bottom: 84px;
  width: min(380px, calc(100vw - 24px));
  max-height: 62vh;
  display: none;
  flex-direction: column;
  background: rgba(8, 15, 34, 0.92);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  overflow: hidden;
  z-index: 1002;
  backdrop-filter: blur(10px);
}
#chat-widget.open { display: flex; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #d7e0ee;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  color: #071222;
  font-weight: 700;
}
.chat-header button { width: auto; margin: 0; padding: 4px 9px; border-radius: 8px; }

#chat-messages {
  padding: 10px;
  overflow: auto;
  min-height: 130px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(2, 10, 27, 0.9);
}

.chat-msg { padding: 8px 10px; border-radius: 10px; line-height: 1.35; white-space: pre-wrap; }
.chat-msg.user { background: #2563eb; color: #fff; align-self: flex-end; }
.chat-msg.ai { background: rgba(30, 41, 59, 0.92); color: #e2e8f0; align-self: flex-start; }

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(8, 15, 34, 0.95);
}
.chat-input input { margin: 0; background: rgba(15, 23, 42, 0.9); color: #e2e8f0; border-color: rgba(148, 163, 184, 0.35); }
.chat-input button { width: auto; margin: 0; padding: 10px 14px; }

body.light-mode {
  background: radial-gradient(circle at top left, #f5f8fd 0%, #edf2f8 45%, #e7edf5 100%);
  color: #0f172a;
}
body.light-mode .navbar {
  background: rgba(255, 255, 255, 0.72);
  border-bottom-color: rgba(148, 163, 184, 0.28);
}
body.light-mode .logo, body.light-mode .nav-links a { color: #334155; }
body.light-mode .nav-links a.active { color: #2563eb; border-bottom-color: #2563eb; }
body.light-mode .hero h1 { color: #2fb6c4; }
body.light-mode .hero p,
body.light-mode .about-text,
body.light-mode .tool-description { color: #64748b; }
body.light-mode .tool-box,
body.light-mode #url-panel,
body.light-mode #file-panel,
body.light-mode #ip-panel,
body.light-mode #email-panel,
body.light-mode .info-section {
  background: rgba(255, 255, 255, 0.48);
  border-color: rgba(148, 163, 184, 0.35);
  color: #0f172a;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 26px rgba(30, 41, 59, 0.14);
}
body.light-mode input,
body.light-mode textarea,
body.light-mode pre,
body.light-mode .result-box,
body.light-mode .scan-result,
body.light-mode #passwordResult {
  background: rgba(255, 255, 255, 0.72);
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.35);
}
body.light-mode footer { color: #64748b; border-top-color: rgba(148, 163, 184, 0.3); }
body.light-mode footer a { color: #2563eb; }

body.light-mode #chat-widget {
  background: rgba(248, 250, 252, 0.92);
  color: #111827;
  border-color: rgba(203, 213, 225, 0.9);
}
body.light-mode #chat-messages {
  background: rgba(255, 255, 255, 0.9);
}
body.light-mode .chat-msg.ai {
  background: #e5e7eb;
  color: #0f172a;
}
body.light-mode .chat-input {
  background: rgba(248,250,252,0.95);
  border-top-color: #d7e0ee;
}
body.light-mode .chat-input input {
  background: #ffffff;
  color: #111827;
  border-color: #cbd5e1;
}

/* Dashboard Metrics & Chart Section */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.metric-card {
  background: rgba(23, 35, 60, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(2, 8, 28, 0.28);
}
.metric-card h4 {
  margin: 0 0 8px 0;
  color: #93c5fd;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: #38bdf8;
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.btn-export {
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-top: 6px;
}
.btn-export:hover {
  filter: brightness(1.15);
}
body.light-mode .metric-card {
  background: rgba(255, 255, 255, 0.48);
  border-color: rgba(148, 163, 184, 0.35);
  color: #0f172a;
}
body.light-mode .metric-card h4 {
  color: #1e40af;
}
body.light-mode .metric-value {
  color: #0284c7;
}

/* Modern Professional Result Cards */
.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.tool-header h3 {
  margin: 0;
}
.engine-badge {
  font-size: 11px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.engine-badge.live-pulse {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}
.modern-result-card {
  margin-top: 14px;
  background: rgba(10, 20, 45, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.4);
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  margin-bottom: 12px;
}
.file-name-title {
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 600;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-safe {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.score-pill {
  font-size: 12px;
  color: #94a3b8;
}
.score-pill strong {
  color: #38bdf8;
  font-size: 14px;
}

/* Metric Mini-Grids */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.mini-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
}
.mini-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.mini-val {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}
.text-safe { color: #4ade80 !important; }
.text-warning { color: #fbbf24 !important; }
.text-danger { color: #f87171 !important; }

.entropy-explainer-card {
  background: rgba(30, 58, 138, 0.2);
  border-left: 3px solid #38bdf8;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 10px;
  line-height: 1.4;
}
.rules-card {
  margin-top: 8px;
}
.rules-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.rule-item {
  font-size: 12px;
  color: #e2e8f0;
  padding: 3px 0;
}
.reason-chip {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
}
.reason-chip.clean {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}
.hash-tag {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 11px;
  color: #94a3b8;
  word-break: break-all;
}

/* Progress Meters */
.meter-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.meter-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease, background-color 0.4s ease;
}
.pwd-feedback-box {
  margin-top: 8px;
}
.pwd-tip {
  font-size: 12px;
  color: #fbbf24;
  margin-bottom: 4px;
}
.pwd-tip.clean {
  color: #4ade80;
}

/* Simulation Email Mockup */
.sim-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: #93c5fd;
}
.category-pill {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: 999px;
}
.sim-email-client {
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.sim-email-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #cbd5e1;
}
.sim-meta-line {
  margin-bottom: 3px;
}
.sim-sender-email {
  color: #93c5fd;
}
.sim-body-content {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.5;
  margin-bottom: 12px;
}
.sim-link-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}
.sim-fake-link {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: underline;
  display: block;
  margin: 2px 0 4px 0;
}
.sim-dest-preview {
  font-size: 11px;
  color: #94a3b8;
}
.sim-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-sim-report {
  background: linear-gradient(90deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.btn-sim-trap {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.btn-sim-next {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-sim-report:hover, .btn-sim-trap:hover, .btn-sim-next:hover {
  filter: brightness(1.15);
}
.sim-feedback-box {
  margin-top: 12px;
  border-radius: 8px;
  padding: 12px;
  animation: fadeIn 0.3s ease;
}
.sim-feedback-box.reported {
  background: rgba(6, 78, 59, 0.4);
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.sim-feedback-box.trapped {
  background: rgba(127, 29, 29, 0.4);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.feedback-header h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
}
.feedback-msg {
  font-size: 12px;
  margin: 0 0 8px 0;
  line-height: 1.4;
}
.red-flags-section {
  font-size: 12px;
  margin-bottom: 8px;
}
.rf-item {
  color: #cbd5e1;
  padding: 2px 0;
}
.security-advice-note {
  font-size: 12px;
  color: #fde047;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 6px;
}

/* Network Threat Visualizer Table */
.sensor-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.sensor-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #93c5fd;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}
.btn-refresh-stream {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #93c5fd;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}
.btn-refresh-stream:hover {
  background: rgba(56, 189, 248, 0.2);
}
.attack-table-responsive {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.modern-threat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.modern-threat-table th {
  background: rgba(15, 23, 42, 0.95);
  color: #94a3b8;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.modern-threat-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
}
.threat-name {
  font-weight: 700;
  display: block;
}
.sev-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}
.sev-crit { background: rgba(239, 68, 68, 0.25); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.5); }
.sev-high { background: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.5); }
.sev-med  { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.5); }

.country-tag { color: #94a3b8; font-size: 11px; }
.target-val { color: #38bdf8; font-weight: 600; }
.action-tag {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.details-text { font-size: 11px; color: #cbd5e1; max-width: 260px; line-height: 1.4; }
.sensor-explainer {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 10px;
  line-height: 1.4;
}

/* Loading & Alert States */
.loading-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93c5fd;
  font-size: 12px;
  padding: 10px;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.alert-box {
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
}
.alert-box.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.alert-box.danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* Light mode adaptations for modern components */
body.light-mode .modern-result-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 8px 24px rgba(100, 116, 139, 0.15);
}
body.light-mode .file-name-title { color: #0f172a; }
body.light-mode .mini-card {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(203, 213, 225, 0.8);
}
body.light-mode .mini-val { color: #1e293b; }
body.light-mode .entropy-explainer-card {
  background: rgba(224, 242, 254, 0.7);
  border-left-color: #0284c7;
  color: #0369a1;
}
body.light-mode .rule-item { color: #334155; }
body.light-mode .sim-email-client {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(203, 213, 225, 0.8);
}
body.light-mode .sim-email-header { color: #475569; }
body.light-mode .sim-body-content { color: #1e293b; }
body.light-mode .sim-link-box { background: #f1f5f9; }
body.light-mode .modern-threat-table th { background: #f1f5f9; color: #475569; }
body.light-mode .modern-threat-table td { color: #1e293b; }
body.light-mode .details-text { color: #475569; }

@media (max-width: 900px) {
  .tools-grid { grid-template-columns: 1fr; }
  .metrics-row, .analytics-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .nav-links { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  .theme-toggle { top: 96px; }
}