:root {
    --jtr-primary: #3b82f6;
    --jtr-primary-dark: #1d4ed8;
    --jtr-dark: #0f172a;
    --jtr-dark-card: #1e293b;
    --jtr-sidebar-bg: #0b1120;
    --jtr-accent: #6366f1;
    --jtr-danger: #ef4444;
    --jtr-warning: #f59e0b;
    --jtr-success: #10b981;
    --jtr-info: #06b6d4;
    --jtr-body-bg: #f8fafc;
    --jtr-card-border: #e2e8f0;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--jtr-body-bg);
    color: #334155;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* =======================================================
   FontAwesome & SVG Icon Constraints (Prevents Icon Explosion)
   ======================================================= */
svg.svg-inline--fa,
.svg-inline--fa {
    display: inline-block !important;
    height: 1em !important;
    width: 1em !important;
    max-height: 1.25em !important;
    max-width: 1.25em !important;
    overflow: visible !important;
    vertical-align: -0.125em !important;
}

i[class*="fa-"],
.fa, .fas, .far, .fal, .fab, .fa-solid, .fa-regular, .fa-brands {
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
    font-size: inherit;
}

/* Sidebar Styling (Modern Dark Cyber Theme) */
.app-sidebar {
    width: 270px;
    background: var(--jtr-sidebar-bg);
    color: #cbd5e1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    flex-shrink: 0;
}

.brand-text h5 {
    margin: 0;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.brand-text span {
    font-size: 11.5px;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.sidebar-menu {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.menu-header {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94a3b8;
    padding: 12px 14px 6px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.nav-item-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: #93c5fd;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-item-link:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}

.nav-item-link:hover i {
    color: #38bdf8;
}

.nav-item-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(59,130,246,0.35), rgba(99,102,241,0.35));
    border-left: 3px solid #38bdf8;
    font-weight: 700;
}

.nav-item-link.active i {
    color: #38bdf8;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.35);
    color: #cbd5e1 !important;
}

/* App Main Container */
.app-main {
    margin-left: 270px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.app-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--jtr-card-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.app-content {
    padding: 28px;
    flex: 1;
    max-width: 1600px;
    width: 100%;
}

/* Cards & Widgets */
.card {
    border: 1px solid var(--jtr-card-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    background: #ffffff;
    transition: all 0.2s ease;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--jtr-card-border);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
    color: var(--jtr-dark);
}

.stat-widget {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: 12px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-val {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

/* Severity Badges */
.severity-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}

.badge-critical { background: #fee2e2; color: #991b1b; border: 1px solid #f87171; font-weight: 700; }
.badge-high { background: #ffedd5; color: #9a3412; border: 1px solid #fb923c; font-weight: 700; }
.badge-medium { background: #fef9c3; color: #713f12; border: 1px solid #facc15; font-weight: 700; }
.badge-low { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; font-weight: 700; }
.badge-safe { background: #dcfce7; color: #166534; border: 1px solid #4ade80; font-weight: 700; }
.badge-info { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; font-weight: 700; }

/* Custom Buttons */
.btn-jtr-primary {
    background: linear-gradient(135deg, var(--jtr-primary), var(--jtr-accent));
    color: #ffffff;
    border: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    transition: all 0.2s ease;
}

.btn-jtr-primary:hover {
    background: linear-gradient(135deg, var(--jtr-primary-dark), #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

/* Code Evidence Box - Clean Left-Aligned */
.code-evidence {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
    font-size: 12px !important;
    background: #0f172a !important;
    color: #38bdf8 !important;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    border: 1px solid #1e293b !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    line-height: 1.5 !important;
    text-align: left !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
}

/* Remediation Guidance Box */
.remediation-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-left: 4px solid #0284c7;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    color: #0369a1;
    margin-top: 8px;
    line-height: 1.5;
    text-align: left;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 18px 14px;
    }
}

/* Pagination & SVG Global Containment */
nav[role="navigation"] svg,
nav[aria-label="Pagination Navigation"] svg,
.pagination svg,
svg.w-5, svg.h-5,
svg[fill="currentColor"] {
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.pagination {
    margin-bottom: 0;
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    border-radius: 6px;
    color: #1e293b;
    padding: 6px 12px;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
}

.pagination .page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
}
