/* ============================================
   NMAP VIEWER - STYLES
   Estética premium con gradientes y animaciones
   ============================================ */

:root {
  --bg: #0b1020;
  --text: #e7ecff;
  --muted: #a7b2da;
  --accent: #7aa2ff;
  --accent-alt: #9d7aff;
  --ok: #38d18a;
  --warn: #ffcc66;
  --bad: #ff6b6b;
  --border: rgba(255,255,255,.10);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% -10%, rgba(122,162,255,.30), transparent 55%),
              radial-gradient(1000px 700px at 90% 10%, rgba(56,209,138,.22), transparent 55%),
              var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ============================================
   SITE HEADER
   ============================================ */
.siteHeader {
  background: linear-gradient(180deg, rgba(0,0,0,.4), transparent);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.headerContent {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.logoIcon {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

.logoText {
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.headerLinks {
  display: flex;
  gap: 24px;
  align-items: center;
}

.headerLinks a {
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s ease;
}

.headerLinks a:hover {
  color: var(--text);
}

.headerBtn {
  padding: 8px 16px !important;
  background: rgba(122,162,255,.15) !important;
  border: 1px solid rgba(122,162,255,.3) !important;
  border-radius: 8px !important;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
.langSwitcher {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
}

.langBtn {
  width: auto;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.langBtn:hover {
  background: rgba(255,255,255,.08);
  transform: scale(1.05);
}

.langBtn.active {
  background: rgba(122,162,255,.25);
  border-color: rgba(122,162,255,.4);
  box-shadow: 0 2px 8px rgba(122,162,255,.2);
}

.langBtn:active {
  transform: scale(0.98);
}

/* ============================================
   SITE FOOTER
   ============================================ */
.siteFooter {
  margin-top: 60px;
  padding: 40px 24px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.3));
  border-top: 1px solid rgba(255,255,255,.08);
}

.footerContent {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.footerBrand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.footerLinks {
  display: flex;
  gap: 24px;
}

.footerLinks a {
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s ease;
}

.footerLinks a:hover {
  color: var(--accent);
}

.footerCopy {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ============================================
   MODE SWITCHER - Minimalist Design
   ============================================ */
.modeSwitcher {
  display: inline-flex;
  gap: 0;
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.modeSwitcher button {
  padding: 14px 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  letter-spacing: 0.02em;
}

.modeSwitcher button:hover:not(.active) {
  color: var(--text);
}

.modeSwitcher button.active {
  color: var(--text);
}

.modeSwitcher button.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* ============================================
   HELP TOOLTIP
   ============================================ */
.helpIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  cursor: help;
  position: relative;
  transition: all 0.2s ease;
}

.helpIcon:hover {
  color: var(--text);
  border-color: var(--accent);
}

.helpIcon .tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  padding: 16px;
  background: rgba(15,20,35,.98);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
}

.helpIcon:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

.tooltip h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.tooltip code {
  display: block;
  margin: 8px 0;
  padding: 10px 12px;
  background: rgba(0,0,0,.4);
  border-radius: 8px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  color: var(--accent);
  white-space: pre-wrap;
  word-break: break-all;
}

.tooltip p {
  margin: 8px 0 0;
  color: var(--muted);
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(8px);
}

/* New Dashboard Layout */
header {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 20px;
}

.uploadSection {
  width: 100%;
}

.title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 6px 0;
  font-size: 22px;
  letter-spacing: .2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ============================================
   KPIs & CHARTS - Enhanced Dashboard Design
   ============================================ */
.statsSection {
  display: grid;
  gap: 20px;
}

.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
  gap: 16px; 
}

.kpi {
  position: relative;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(122,162,255,.08), rgba(157,122,255,.05));
  border: 1px solid rgba(122,162,255,.20);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(122,162,255,.15), transparent 70%);
  border-radius: 50%;
  transform: translate(30%, -30%);
  transition: transform 0.4s ease;
}

.kpi:hover {
  background: linear-gradient(135deg, rgba(122,162,255,.12), rgba(157,122,255,.08));
  border-color: rgba(122,162,255,.35);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(122,162,255,.15), 0 4px 8px rgba(0,0,0,.1);
}

.kpi:hover::before {
  transform: translate(20%, -20%) scale(1.3);
}

.kpi .icon {
  font-size: 32px;
  opacity: 0.6;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.kpi .v { 
  font-size: 36px; 
  font-weight: 700;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.kpi .l { 
  color: var(--muted); 
  font-size: 13px; 
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.chartsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
}

.chartBox {
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(122,162,255,.15);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 16px rgba(0,0,0,.15);
  transition: all 0.3s ease;
  min-height: 380px;
}

.chartBox:hover {
  border-color: rgba(122,162,255,.25);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,.20);
}

.chartBox .chartTitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chartBox .chartTitle::before {
  content: '📊';
  font-size: 20px;
}

.chartBox canvas {
  max-height: 300px;
}

canvas { 
  width: 100% !important; 
  height: auto !important;
}

/* ============================================
   CONTROLS & INPUTS
   ============================================ */
.controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: end;
}

label { 
  display: block; 
  font-size: 12px; 
  color: var(--muted); 
  margin-bottom: 6px; 
}

input, select, button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
  font-family: var(--sans);
}

input:focus, select:focus {
  border-color: rgba(122,162,255,.50);
  background: rgba(0,0,0,.35);
}

input::placeholder { color: rgba(231,236,255,.45); }

input[type="file"] { max-width: 100%; }

button {
  cursor: pointer;
  background: linear-gradient(180deg, rgba(122,162,255,.22), rgba(122,162,255,.10));
  border: 1px solid rgba(122,162,255,.35);
  font-weight: 500;
}

button:hover {
  background: linear-gradient(180deg, rgba(122,162,255,.32), rgba(122,162,255,.18));
  border-color: rgba(122,162,255,.50);
}

button.secondary { 
  background: rgba(255,255,255,.06); 
  border: 1px solid var(--border); 
}

button.secondary:hover { 
  background: rgba(255,255,255,.10); 
}

button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   TABLE
   ============================================ */
.tableWrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.16);
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  min-width: 860px; 
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky; 
  top: 0;
  background: rgba(15,23,48,.96);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

th:hover { background: rgba(20,30,60,.96); }
tr:hover td { background: rgba(255,255,255,.03); }

/* ============================================
   BADGES & INDICATORS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  font-size: 12px;
  margin: 2px 6px 2px 0;
  white-space: nowrap;
}

.dot { 
  width: 7px; 
  height: 7px; 
  border-radius: 50%; 
  background: var(--ok); 
  box-shadow: 0 0 0 4px rgba(56,209,138,.12); 
}

.dot.warn { 
  background: var(--warn); 
  box-shadow: 0 0 0 4px rgba(255,204,102,.12); 
}

.dot.bad { 
  background: var(--bad); 
  box-shadow: 0 0 0 4px rgba(255,107,107,.12); 
}

.rowActions { 
  display: flex; 
  gap: 8px; 
  justify-content: flex-end; 
}

.rowActions button { 
  width: auto; 
  padding: 8px 10px; 
  border-radius: 10px; 
  font-size: 12px; 
}

/* ============================================
   FILE DROP ZONE
   ============================================ */
.drop {
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 18px;
  background: rgba(0,0,0,.16);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.drop strong { font-size: 14px; }
.drop .hint { color: var(--muted); font-size: 12px; max-width: 820px; }

.drop.drag { 
  border-color: rgba(122,162,255,.55); 
  background: rgba(122,162,255,.12); 
}

.err {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,107,107,.35);
  background: rgba(255,107,107,.10);
  color: rgba(255,220,220,.95);
  display: none;
  white-space: pre-wrap;
}

/* ============================================
   MODAL
   ============================================ */
dialog {
  width: min(980px, calc(100% - 40px));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15,23,48,.96);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

dialog::backdrop { 
  background: rgba(0,0,0,.6); 
  backdrop-filter: blur(2px); 
}

.modalHead {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.modalBody { padding: 16px; }
.modalHead h2 { margin: 0; font-size: 18px; }

.closeBtn {
  width: auto;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
}

pre {
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(231,236,255,.92);
}

.vulnTable { width: 100%; border-collapse: collapse; }
.vulnTable th, .vulnTable td { 
  border-bottom: 1px solid rgba(255,255,255,.06); 
  padding: 8px 10px; 
}
.vulnTable th { 
  color: var(--muted); 
  background: rgba(0,0,0,.18); 
  position: sticky; 
  top: 0; 
  cursor: default; 
}

/* ============================================
   UTILITY
   ============================================ */
.hidden { display: none !important; }


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(56,209,138,.95), rgba(56,209,138,.85));
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(56,209,138,.3), 0 2px 8px rgba(0,0,0,.2);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  animation: slideInUp 0.3s ease forwards, slideOutDown 0.3s ease 2.7s forwards;
  z-index: 9999;
  pointer-events: none;
}

.toast::before {
  content: '✓';
  font-size: 18px;
  background: rgba(255,255,255,.3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes slideInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOutDown {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .chartsGrid { 
    grid-template-columns: 1fr; 
  }
}

@media (max-width: 980px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  table { min-width: 920px; }
  
  .kpi .v { font-size: 28px; }
  .kpi { padding: 16px; }
}
