:root {
    --bg-color: #f4f4f9;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --critical: #ef4444;
    --high: #f97316;
    --medium: #eab308;
    --low: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--card-bg);
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

h1, h2, h3 {
    color: var(--text-main);
}

.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
}

/* A simple, clean table for our vulnerabilities */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f9fafb;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.badge {
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.badge.critical { background-color: var(--critical); }
.badge.high { background-color: var(--high); }
.badge.medium { background-color: var(--medium); color: #000; }
.badge.low { background-color: var(--low); }


/* File: RiskRancher/ui/static/style.css (Append to bottom) */

/* The Tab Navigation Bar */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 20px;
}

.tab-link {
    padding: 10px 5px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.tab-link:hover {
    color: var(--primary);
}

.tab-link.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

/* Pagination Controls */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 8px 16px;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn:hover {
    background-color: #f9fafb;
}

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Info Severity Badge */
.badge.info { background-color: #9ca3af; }

/* SLA Badges */
.sla-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid transparent;
}
.sla-safe { background-color: #dcfce7; color: #166534; border-color: #bbf7d0; }
.sla-warn { background-color: #fef08a; color: #854d0e; border-color: #fde047; }
.sla-breach { background-color: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* Table Checkboxes for future Bulk Actions */
td input[type="checkbox"], th input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* ==========================================
   THE CORRAL (TABS & PILLS)
   ========================================== */

/* The Tab Navigation */
.nav-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    gap: 20px;
}

.nav-tabs a {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    padding: 10px 5px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-tabs a:hover {
    color: #0f172a;
    border-bottom-color: #cbd5e1;
}

.nav-tabs a.active {
    color: #2563eb; /* A nice, sharp blue */
    border-bottom-color: #2563eb;
}

/* The Filter Pills */
.filter-pills {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 999px; /* Perfect pill shape */
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}

.pill:hover {
    background-color: #e2e8f0;
}

.pill.active {
    background-color: #1e293b;
    color: white;
    border-color: #1e293b;
}

/* The Metric Badges inside the Pills */
.pill .badge {
    background-color: white;
    color: #000;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-left: 8px;
    font-weight: bold;
}

/* Specific Pill Colors (When Active) */
.pill-critical.active { background-color: #dc2626; border-color: #dc2626; color: white; }
.pill-critical.active .badge { color: #dc2626; }

.pill-overdue.active { background-color: #ea580c; border-color: #ea580c; color: white; }
.pill-overdue.active .badge { color: #ea580c; }

.pill-mine.active { background-color: #2563eb; border-color: #2563eb; color: white; }
.pill-mine.active .badge { color: #2563eb; }

/* ==========================================
   BULK ACTION MODAL
   ========================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); /* Slate backdrop */
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white; padding: 24px; border-radius: 8px;
    width: 400px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.modal-content h3 { margin-top: 0; color: #0f172a; }
.modal-content label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; color: #475569; }
.modal-content select, .modal-content textarea {
    width: 100%; padding: 10px; margin-bottom: 20px;
    border: 1px solid #cbd5e1; border-radius: 4px; font-family: inherit; box-sizing: border-box;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-secondary { background-color: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background-color: #cbd5e1; }
.false-positive { background: #f1f5f9; color: #475569; border: 1px dashed #cbd5e1; }

/* ==========================================
   🚀 THE SLIDE-OUT DRAWER & MODALS
   ========================================== */
.drawer-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.4); z-index: 1000; backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; right: -650px; width: 600px; height: 100vh; background: white; box-shadow: -4px 0 25px rgba(0,0,0,0.15); transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1001; display: flex; flex-direction: column; }
.drawer.open { right: 0; }
.drawer-header { padding: 25px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: flex-start; background: #f8fafc; }
.drawer-body { padding: 25px; overflow-y: auto; flex: 1; }
.drawer-footer { padding: 20px 25px; border-top: 1px solid #e2e8f0; background: #f8fafc; display: flex; justify-content: flex-end; gap: 10px; }

/* ==========================================
   🚀 UNIFIED TABS & TOOLBARS
   ========================================== */
.tab-nav { display: flex; gap: 4px; margin-bottom: 0; padding-left: 20px; position: relative; z-index: 2; }
.tab-btn { padding: 10px 24px; cursor: pointer; text-decoration: none; background: #f8fafc; border: 1px solid #cbd5e1; font-size: 0.95rem; color: #64748b; font-weight: 600; border-radius: 6px 6px 0 0; margin-bottom: -1px; transition: background 0.2s, color 0.2s; }
.tab-btn:hover { background: #e2e8f0; color: #0f172a; }
.tab-btn.active { background: #ffffff; color: #2563eb; border-bottom: 1px solid #ffffff; z-index: 3; }
.tab-pane { display: none; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 20px; position: relative; z-index: 1; min-height: 400px; }
.tab-pane.active { display: block; }
.unified-card { background: white; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); position: relative; z-index: 2; overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }

/* ==========================================
   🗂️ TREE BRANCHES & SCROLLING CSS
   ========================================== */
.asset-header-row td { transition: background 0.2s; }
.asset-header-row:hover td { background: #f1f5f9 !important; }
.nested-table tr td { background: #ffffff; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; padding: 12px; }
.nested-table tr td:first-child { border-left: 1px solid #e2e8f0; border-top-left-radius: 8px; border-bottom-left-radius: 8px; position: relative; }
.nested-table tr td:last-child { border-right: 1px solid #e2e8f0; border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.nested-table tr td:first-child::before { content: ""; position: absolute; left: -25px; top: 50%; width: 25px; height: 3px; background: #0f172a; }
.scroll-container::-webkit-scrollbar { width: 8px; }
.scroll-container::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.scroll-container::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
.scroll-container::-webkit-scrollbar-thumb:hover { background: #64748b; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================
   📊 KPI CARDS (Sheriff Dashboard)
   ========================================== */
.kpi-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 8px;
    background: white;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* ==========================================
   🔒 AUTH PAGES (Login & Register)
   ========================================== */
.auth-card { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.auth-card.dark { background: #1e293b; box-shadow: 0 10px 25px rgba(0,0,0,0.5); max-width: 450px; border: 1px solid #334155; }
.auth-card input { width: 100%; padding: 10px; margin: 10px 0 20px 0; border: 1px solid #cbd5e1; border-radius: 4px; box-sizing: border-box; }
.auth-card.dark input { border: 1px solid #475569; background: #0f172a; color: white; }
.auth-card .btn { width: 100%; padding: 12px; font-weight: bold; cursor: pointer; font-size: 1rem; }
.error { color: #dc2626; margin-bottom: 15px; font-size: 0.9rem; display: none; }
.error.dark { color: #ef4444; }

/* ==========================================
   📊 ASSET ROLLUP VIEW
   ========================================== */
.count-badge { padding: 4px 8px; border-radius: 999px; font-weight: bold; font-size: 0.85rem; display: inline-block; min-width: 20px; text-align: center; }
.bg-critical { background: #fee2e2; color: #dc2626; }
.bg-high { background: #ffedd5; color: #ea580c; }
.bg-medium { background: #fef9c3; color: #ca8a04; }
.bg-low { background: #e0f2fe; color: #0284c7; }
.bg-zero { background: #f1f5f9; color: #94a3b8; font-weight: normal; }

.navbar-strategic { background: #0f172a; color: white; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; }
.navbar-strategic a { color: #cbd5e1; text-decoration: none; margin-left: 20px; font-weight: 500; }
.navbar-strategic a:hover { color: white; }

.notification-bubble {
    background: #e11d48;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    margin-left: 8px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(225, 29, 72, 0.3);
}


.archived-row {
    background-color: #fafafa !important;
    opacity: 0.8;
}

.archived-row td {
    color: #64748b;
}

.archived-row .badge {
    filter: grayscale(0.5) opacity(0.7);
}

.archived-row a {
    color: #64748b !important;
}

.archive-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
}