/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #036897;
  --blue-lt: #e6f4f8;
  --green:   #1a7f4b;
  --green-lt:#e8f5ee;
  --red:     #c0392b;
  --red-lt:  #fdf0ef;
  --yellow:  #f0a30a;
  --yellow-lt:#fff8e6;
  --gray-50: #f8fafc;
  --gray-100:#f1f5f9;
  --gray-200:#e2e8f0;
  --gray-400:#94a3b8;
  --gray-600:#475569;
  --gray-800:#1e293b;
  --radius:  10px;
  --shadow:  0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --font:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ───────────────────────────────────────────────────── */
.app   { display: flex; flex-direction: column; min-height: 100vh; }
.main  { flex: 1; max-width: 780px; width: 100%; margin: 0 auto; padding: 28px 16px 48px; }

/* ── Header ───────────────────────────────────────────────────── */
.header { background: var(--blue); color: white; }
.header-inner {
  max-width: 780px; margin: 0 auto;
  padding: 16px 16px;
  display: flex; align-items: center; gap: 14px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; }
.header-sub { margin-left: auto; font-size: .85rem; opacity: .75; }

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px;
  margin-bottom: 20px;
}
.card h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.card .hint {
  font-size: .84rem; color: var(--gray-600); margin-bottom: 20px; line-height: 1.6;
}
.card .hint code {
  background: var(--gray-100); padding: 1px 6px; border-radius: 4px;
  font-family: "Cascadia Code", "Fira Code", monospace; font-size: .82rem;
}

/* ── Drop zone ────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 36px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-lt);
}
.drop-icon { width: 56px; height: 56px; }
.drop-text { text-align: center; color: var(--gray-600); font-size: .9rem; line-height: 1.5; }
.drop-text span { font-size: .8rem; color: var(--gray-400); }

/* ── File list ────────────────────────────────────────────────── */
.file-list-wrap { margin-top: 16px; }
.file-list-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem; color: var(--gray-600); margin-bottom: 8px;
}
.file-list {
  list-style: none; max-height: 180px; overflow-y: auto;
  border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: .82rem; color: var(--gray-600);
}
.file-list li {
  padding: 5px 12px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; gap: 8px; align-items: center;
}
.file-list li:last-child { border-bottom: none; }
.file-site-badge {
  background: var(--blue-lt); color: var(--blue);
  border-radius: 4px; padding: 1px 6px; font-size: .75rem; white-space: nowrap;
}

/* ── Action row ───────────────────────────────────────────────── */
.action-row { display: flex; gap: 12px; margin-top: 20px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  padding: 9px 22px; border-radius: 7px; border: none;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):hover { opacity: .88; }
.btn:not(:disabled):active { transform: scale(.97); }

.btn-primary { background: var(--blue); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-outline  {
  background: white; color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-link {
  background: none; border: none; color: var(--blue);
  font-size: .84rem; cursor: pointer; text-decoration: underline;
}

.download-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.download-btn { font-size: 1rem; padding: 12px 28px; }

/* ── Stats grid ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-box {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 8px; padding: 14px 16px; text-align: center;
}
.stat-box .stat-val {
  font-size: 1.8rem; font-weight: 700; color: var(--blue); line-height: 1;
}
.stat-box .stat-label { font-size: .78rem; color: var(--gray-600); margin-top: 4px; }
.stat-box.warn .stat-val { color: var(--yellow); }
.stat-box.danger .stat-val { color: var(--red); }
.stat-box.success .stat-val { color: var(--green); }

/* ── Subsections ──────────────────────────────────────────────── */
.subsection { margin-top: 16px; }
.subsection h3 {
  font-size: .88rem; font-weight: 600;
  color: var(--gray-600); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
.alert {
  border-radius: 6px; padding: 10px 14px;
  font-size: .84rem; line-height: 1.5; margin-bottom: 6px;
}
.alert-warn  { background: var(--yellow-lt); border-left: 3px solid var(--yellow); }
.alert-error { background: var(--red-lt);    border-left: 3px solid var(--red); }

/* ── Device table ─────────────────────────────────────────────── */
.device-table {
  width: 100%; border-collapse: collapse; font-size: .83rem;
}
.device-table th {
  background: var(--gray-100); padding: 7px 10px;
  text-align: left; font-weight: 600; color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}
.device-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}
.device-table tr:last-child td { border-bottom: none; }
.device-table tbody tr:hover { background: var(--gray-50); }
.badge {
  display: inline-block; border-radius: 4px;
  padding: 1px 7px; font-size: .75rem; font-weight: 600;
}
.badge-router   { background: #e0f0e8; color: #1a6340; }
.badge-switch   { background: var(--blue-lt); color: var(--blue); }
.badge-firewall { background: #fde8e6; color: #a0291e; }
.badge-unknown  { background: var(--gray-100); color: var(--gray-600); }

/* Badges de role (papel hierárquico) */
.badge-role { font-weight: 700; letter-spacing: .2px; }
.badge-core         { background: #d6eaf8; color: #1a5276; }
.badge-aggregation  { background: #d4e6f1; color: #036897; }
.badge-distribution { background: #d1f2eb; color: #117a65; }
.badge-edge         { background: #e8daef; color: #6c3483; }
.badge-access       { background: #fcf3cf; color: #7d6608; }

.table-hint {
  font-size: .8rem; color: var(--gray-600); margin: 4px 0 10px;
}
.table-hint code {
  background: var(--gray-100); padding: 1px 5px; border-radius: 3px;
  font-size: .78rem;
}

/* ── Progress ─────────────────────────────────────────────────── */
.progress-inner { display: flex; align-items: center; gap: 16px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--gray-200); border-top-color: var(--blue);
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  text-align: center; padding: 14px;
  font-size: .78rem; color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  background: white;
}

/* ── Utilities ────────────────────────────────────────────────── */
.hidden { display: none !important; }
