/* NetAudit Dashboard — app.css */
/* Design system: dark premium with glassmorphism accents */

/* ── Inter font (self-hosted — funciona sem internet) ────── */
@import url('/static/css/fonts/inter.css');

/* ── Design tokens ───────────────────────────────────────── */
:root {
    --bg:           #0A0E1A;
    --bg-panel:     #111827;
    --bg-surface:   #0F172A;
    --bg-hover:     #1F2937;
    --bg-glass:     rgba(255,255,255,0.03);
    --border:       #1F2937;
    --border-bright:#374151;
    --text:         #F9FAFB;
    --text-muted:   #9CA3AF;
    --text-sm:      12px;

    --primary:      #3B82F6;
    --primary-dark: #2563EB;
    --primary-glow: rgba(59,130,246,0.20);
    --cyan:         #06B6D4;
    --orange:       #F97316;
    --purple:       #8B5CF6;
    --yellow:       #F59E0B;

    --success:      #10B981;
    --warn:         #F59E0B;
    --error:        #EF4444;
    --critical:     #EF4444;
    --high:         #F97316;
    --medium:       #F59E0B;
    --low:          #10B981;
    --info:         #3B82F6;

    --radius:       8px;
    --radius-sm:    6px;
    --shadow:       0 4px 24px rgba(0,0,0,0.5);
    --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
}

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

/* ── Base ────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 28px;
    height: 58px;
    background: rgba(17,24,39,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.3px;
    white-space: nowrap;
}
.nav-brand a:hover { text-decoration: none; }

.nav-logo-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2px;
    flex: 1;
    margin-left: 12px;
}

.nav-links li { position: relative; }

.nav-links a {
    display: block;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}

.nav-links a:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--primary);
    background: rgba(59,130,246,0.10);
    text-decoration: none;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 11px;
    right: 11px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

/* ── Health indicator ────────────────────────────────────── */
.nav-health {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: default;
    white-space: nowrap;
    margin-left: auto;
}

.nav-user {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: 8px;
    color: var(--text-muted);
    font-size: 16px;
    text-decoration: none;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.nav-logout:hover { color: var(--error); background: rgba(239,68,68,.1); }

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-bright);
    flex-shrink: 0;
    transition: background 0.3s;
}

.nav-health.ok .health-dot {
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(16,185,129,0.5);
    animation: pulse-health 2.5s ease-in-out infinite;
}

.nav-health.degraded .health-dot {
    background: var(--error);
}

.nav-health.ok .health-label  { color: var(--success); }
.nav-health.degraded .health-label { color: var(--error); }

@keyframes pulse-health {
    0%   { box-shadow: 0 0 0 0   rgba(16,185,129,0.6); }
    70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0   rgba(16,185,129,0); }
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    padding: 32px 28px;
    max-width: 1440px;
    margin: 0 auto;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.page-header__filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.breadcrumb .bc-sep { opacity: 0.4; }
.breadcrumb .bc-active { color: var(--text); font-weight: 500; }

/* ── Stats grid (legacy, used by other pages if needed) ──── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-bright);
}
.stat-card--warn { border-color: rgba(249,115,22,0.4); }

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 6px;
}
.stat-card--warn .stat-value { color: var(--orange); }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

/* ── Section ─────────────────────────────────────────────── */
.section { margin-bottom: 32px; }

.section h2 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

.section-header h2 { margin-bottom: 0; }

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59,130,246,0.12);
    color: var(--primary);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 9px;
    min-width: 24px;
}

/* ── Table ───────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13px;
}

.table th {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    white-space: nowrap;
}

.table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(31,41,55,0.7);
    vertical-align: middle;
    transition: background 0.1s;
}

.table tr:last-child td { border-bottom: none; }

.table--striped tr:nth-child(even) td {
    background: rgba(255,255,255,0.015);
}

.table tbody tr:hover td {
    background: rgba(59,130,246,0.06);
}

.table-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-wrap .table {
    border: none;
    border-radius: 0;
}

/* ── Device type badges ──────────────────────────────────── */
.badge--router       { background: rgba(239,68,68,0.12);   color: #F87171;  border: 1px solid rgba(239,68,68,0.2); }
.badge--switch       { background: rgba(59,130,246,0.12);  color: #60A5FA;  border: 1px solid rgba(59,130,246,0.2); }
.badge--access_point { background: rgba(16,185,129,0.12);  color: #34D399;  border: 1px solid rgba(16,185,129,0.2); }
.badge--server       { background: rgba(139,92,246,0.12);  color: #A78BFA;  border: 1px solid rgba(139,92,246,0.2); }
.badge--workstation  { background: rgba(156,163,175,0.12); color: #9CA3AF;  border: 1px solid rgba(156,163,175,0.2); }
.badge--printer      { background: rgba(6,182,212,0.12);   color: #22D3EE;  border: 1px solid rgba(6,182,212,0.2); }
.badge--firewall     { background: rgba(249,115,22,0.12);  color: #FB923C;  border: 1px solid rgba(249,115,22,0.2); }
.badge--unknown      { background: rgba(75,85,99,0.15);    color: #9CA3AF;  border: 1px solid rgba(75,85,99,0.2); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--bg-hover);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Severity */
.badge--sev-critical { background: rgba(239,68,68,0.15);  color: #F87171; border: 1px solid rgba(239,68,68,0.25); }
.badge--sev-high     { background: rgba(249,115,22,0.15); color: #FB923C; border: 1px solid rgba(249,115,22,0.25); }
.badge--sev-medium   { background: rgba(245,158,11,0.15); color: #FCD34D; border: 1px solid rgba(245,158,11,0.25); }
.badge--sev-low      { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.25); }
.badge--sev-info     { background: rgba(59,130,246,0.15); color: #60A5FA; border: 1px solid rgba(59,130,246,0.25); }

/* Finding status */
.badge--status-open           { background: rgba(239,68,68,0.12);  color: #F87171;  border: 1px solid rgba(239,68,68,0.2); }
.badge--status-acknowledged   { background: rgba(245,158,11,0.12); color: #FCD34D;  border: 1px solid rgba(245,158,11,0.2); }
.badge--status-resolved       { background: rgba(16,185,129,0.12); color: #34D399;  border: 1px solid rgba(16,185,129,0.2); }
.badge--status-false_positive { background: rgba(156,163,175,0.12);color: #9CA3AF;  border: 1px solid rgba(156,163,175,0.2); }

/* Scan status */
.badge--completed { background: rgba(16,185,129,0.12);  color: #34D399;  border: 1px solid rgba(16,185,129,0.25); }
.badge--running   { background: rgba(245,158,11,0.12);  color: #FCD34D;  border: 1px solid rgba(245,158,11,0.25); }
.badge--failed    { background: rgba(239,68,68,0.12);   color: #F87171;  border: 1px solid rgba(239,68,68,0.25); }
.badge--pending   { background: rgba(156,163,175,0.10); color: #9CA3AF;  border: 1px solid rgba(156,163,175,0.2); }
.badge--new       { background: rgba(59,130,246,0.12);  color: #60A5FA;  border: 1px solid rgba(59,130,246,0.25); }
.badge--sent      { background: rgba(16,185,129,0.12);  color: #34D399;  border: 1px solid rgba(16,185,129,0.25); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: #293548;
    border-color: #4B5563;
    color: var(--text);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn:active { transform: translateY(0); box-shadow: none; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(59,130,246,0.35);
    color: #fff;
}

.btn-success { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.35); color: var(--success); }
.btn-success:hover { background: rgba(16,185,129,0.2); border-color: var(--success); color: var(--success); }

.btn-warn    { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); color: var(--error); }
.btn-warn:hover { background: rgba(239,68,68,0.2); border-color: var(--error); color: var(--error); }

.btn-sm { padding: 4px 12px; font-size: 12px; }

/* Ripple */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 0.5s linear;
    background: rgba(255,255,255,0.15);
    pointer-events: none;
}
@keyframes ripple-anim {
    to { transform: scale(4); opacity: 0; }
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"],
textarea, select {
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

input::placeholder, textarea::placeholder {
    color: #4B5563;
}

select option { background: var(--bg-panel); }

.input-sm { padding: 5px 9px; font-size: 12px; width: auto; }

/* ── Alert banners ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid transparent;
}
.alert-error   {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-left-color: var(--error);
    color: #FCA5A5;
}
.alert-success {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    border-left-color: var(--success);
    color: #6EE7B7;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
}

.modal-box {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: 12px;
    padding: 28px;
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    animation: modal-in 0.2s ease;
}

.modal-box--wide { width: 740px; }

.modal-box h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -0.2px;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Detail list ─────────────────────────────────────────── */
.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    font-size: 13px;
    margin-bottom: 16px;
}
.detail-list dt {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding-top: 2px;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Tooltip ─────────────────────────────────────────────── */
.tooltip {
    position: fixed;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 11px;
    pointer-events: none;
    z-index: 300;
    max-width: 260px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    color: var(--text);
    white-space: nowrap;
}

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #1E293B;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: toast-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
    max-width: 340px;
    min-width: 200px;
}
.toast--success { border-color: rgba(16,185,129,0.4); color: #6EE7B7; border-left: 3px solid var(--success); }
.toast--error   { border-color: rgba(239,68,68,0.4);  color: #FCA5A5; border-left: 3px solid var(--error); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Utility ─────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-error   { color: var(--error); }
.text-success { color: var(--success); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: 11px; }
.mono         { font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; }

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--cyan);
}

/* ── Score bar (shared) ──────────────────────────────────── */
.score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}
.score-bar-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.score-bar-fill--good   { background: var(--success); }
.score-bar-fill--medium { background: var(--warn); }
.score-bar-fill--bad    { background: var(--error); }
.score-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    min-width: 28px;
    text-align: right;
}

/* ── Status pill ─────────────────────────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.status-pill--completed { background: rgba(16,185,129,0.12);  color: #34D399;  border: 1px solid rgba(16,185,129,0.3); }
.status-pill--running   { background: rgba(245,158,11,0.12);  color: #FCD34D;  border: 1px solid rgba(245,158,11,0.3); }
.status-pill--failed    { background: rgba(239,68,68,0.12);   color: #F87171;  border: 1px solid rgba(239,68,68,0.3); }
.status-pill--pending   { background: rgba(156,163,175,0.08); color: #9CA3AF;  border: 1px solid rgba(156,163,175,0.2); }

/* Spinner for running */
.spin-icon {
    width: 10px; height: 10px;
    border: 1.5px solid rgba(252,211,77,0.3);
    border-top-color: #FCD34D;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1280px) {
    .main-content { padding: 24px 20px; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 16px; gap: 4px; }
    .nav-links { display: none; }
    .main-content { padding: 16px; }
    .page-header h1 { font-size: 18px; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .form-inline { flex-direction: column; }
    .modal-box { padding: 20px 16px; }
}
