/* ============================================================================
   NetSentry — Design System
   Enterprise security operations aesthetic
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    /* Core palette — deep navy with cyan accents (Cisco-inspired) */
    --bg-deep:      #04080f;
    --bg:           #080d16;
    --surface:      #0c1322;
    --surface-2:    #111a2e;
    --surface-3:    #162038;
    --surface-hover: #1a2744;
    --border:       #1a2540;
    --border-light: #243352;

    /* Text */
    --text:         #e8ecf4;
    --text-2:       #b0bdd0;
    --text-muted:   #5c6f8a;
    --text-dim:     #3a4d6a;

    /* Accents */
    --cyan:         #00bcd4;
    --cyan-glow:    rgba(0, 188, 212, 0.12);
    --cyan-bright:  #26e8ff;
    --blue:         #2979ff;
    --blue-glow:    rgba(41, 121, 255, 0.1);
    --green:        #00e676;
    --green-soft:   #4caf50;
    --green-glow:   rgba(0, 230, 118, 0.08);
    --red:          #ff3d57;
    --red-glow:     rgba(255, 61, 87, 0.08);
    --amber:        #ffab00;
    --amber-glow:   rgba(255, 171, 0, 0.08);
    --purple:       #7c4dff;

    /* Sizing */
    --radius:       8px;
    --radius-lg:    12px;
    --radius-xl:    16px;

    /* Shadows */
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.4);
    --shadow-glow:  0 0 20px rgba(0, 188, 212, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Subtle grid background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(0,188,212,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,188,212,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* ── Noise texture ── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

#app, .container, .dashboard, .admin-content { position: relative; z-index: 1; }

/* ── Typography ── */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
code, .mono { font-family: 'IBM Plex Mono', monospace; }

/* ── Shared header bar ── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(12, 19, 34, 0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    letter-spacing: 1px;
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.2);
}

.topbar-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.topbar-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--green);
    font-weight: 500;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
    animation: livePulse 2s ease infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
    50% { opacity: 0.4; box-shadow: 0 0 2px var(--green); }
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-light); }

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 500;
}

.card-body { padding: 1.25rem; }

/* ── Buttons ── */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--cyan);
    color: var(--bg-deep);
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--cyan-bright);
    box-shadow: 0 0 16px rgba(0, 188, 212, 0.25);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-light); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ff5270; }

.btn-success { background: var(--green-soft); color: #fff; }
.btn-success:hover { background: var(--green); color: var(--bg-deep); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

/* ── Forms ── */
.input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px var(--cyan-glow);
}

.input::placeholder { color: var(--text-dim); }

.input-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c6f8a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

textarea.input { resize: vertical; min-height: 80px; }

.label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.3rem;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--green-glow); color: var(--green); border: 1px solid rgba(0,230,118,0.15); }
.badge-danger  { background: var(--red-glow); color: var(--red); border: 1px solid rgba(255,61,87,0.15); }
.badge-warning { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(255,171,0,0.15); }
.badge-info    { background: var(--cyan-glow); color: var(--cyan); border: 1px solid rgba(0,188,212,0.15); }
.badge-muted   { background: rgba(92,111,138,0.1); color: var(--text-muted); border: 1px solid rgba(92,111,138,0.15); }

/* ── Tables ── */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 0.6rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

td {
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(26, 39, 68, 0.3); }

/* ── KPI stat display ── */
.stat-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text) 30%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-value.green {
    background: linear-gradient(135deg, var(--green) 0%, var(--cyan-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Risk bar visualization ── */
.risk-bar {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}
.risk-bar .bar-seg {
    width: 4px;
    height: 16px;
    border-radius: 1px;
    background: var(--border);
    transition: background 0.3s;
}
.risk-bar.low .bar-seg.on { background: var(--green); }
.risk-bar.medium .bar-seg.on { background: var(--amber); }
.risk-bar.high .bar-seg.on { background: var(--red); }
.risk-bar.critical .bar-seg.on { background: var(--red); box-shadow: 0 0 4px var(--red); }

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-in {
    animation: fadeInUp 0.4s ease both;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .topbar { padding: 0.6rem 1rem; }
}
