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

:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --card-bg: rgba(30, 41, 59, 0.4);
    --border: rgba(255, 255, 255, 0.05);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-color));
    color: var(--text-main);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* Glassmorphism containers */
.glass-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select.form-control option {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.btn-block { width: 100%; }

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-main);
    box-shadow: none;
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: none;
}

.btn-outline-warning {
    background: transparent;
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: var(--warning);
    box-shadow: none;
}
.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.1);
    transform: none;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 1rem;
}
.login-box { width: 100%; max-width: 400px; }
.login-title { text-align: center; font-size: 1.5rem; margin-bottom: 2rem; font-weight: 600; }

.error-msg { background: rgba(239, 68, 68, 0.1); color: var(--danger); padding: 0.75rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.875rem; border: 1px solid rgba(239, 68, 68, 0.2); }

/* App Layout (Left Sidebar) */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
}
.sidebar-brand {
    font-size: 1.25rem; font-weight: 700; background: linear-gradient(to right, #3b82f6, #8b5cf6); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    padding: 0 1.5rem; margin-bottom: 2rem;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.sidebar-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s;
    font-weight: 500;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border-right: 3px solid var(--accent);
}
.sidebar-nav .divider {
    height: 1px; background: var(--border); margin: 1rem 1.5rem;
}
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem; width: 100%; box-sizing: border-box; flex-grow: 1; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-title { font-size: 1.875rem; font-weight: 600; margin: 0; }

/* Tables */
.table-wrapper { overflow: visible; padding-bottom: 150px; min-height: 400px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
th, td { padding: 1rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr { transition: background 0.2s; }
tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Badges */
.badge { padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center;}
.badge-pass { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-fail, .badge-hard_fail, .badge-failed { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-medium, .badge-high { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-low, .badge-completed { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

.badge-pulse { animation: pulse 1.5s infinite; }
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
    100% { opacity: 1; }
}

/* Modals for JSON */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 50; opacity: 0; transition: opacity 0.3s; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal { background: var(--bg-color); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; padding: 2rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); transform: translateY(20px); transition: transform 0.3s; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.25rem; font-weight: 600; }
.close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.5rem; transition: color 0.2s; }
.close-btn:hover { color: white; }

pre.json-view { background: #0f172a; padding: 1rem; border-radius: 8px; border: 1px solid var(--border); overflow-x: auto; color: #e2e8f0; font-size: 0.875rem; }

/* Responsive Design */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
    .sidebar-brand { margin-bottom: 0; padding: 0; }
    .sidebar-nav { width: 100%; flex-direction: row; flex-wrap: wrap; margin-top: 1rem; justify-content: flex-start; gap: 0.5rem; }
    .sidebar-nav a { padding: 0.5rem 0.75rem; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 6px; }
    .sidebar-nav a:hover, .sidebar-nav a.active { border-right: 1px solid var(--border); background: var(--accent); color: #fff; }
    .sidebar-nav .divider { display: none; }
    .main-content { overflow-y: visible; height: auto; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-ribbon { flex-direction: column; gap: 2rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* Dropdown Actions */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none; position: absolute; right: 0; background-color: var(--bg-color); min-width: 130px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5); z-index: 10; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.dropdown-content a, .dropdown-content button {
    color: var(--text-main); padding: 10px 16px; text-decoration: none; display: block; border: none; background: transparent; width: 100%; text-align: left; font-size: 0.85rem; font-family: 'Inter', sans-serif; cursor: pointer; border-radius: 0; box-shadow: none; font-weight: normal; margin: 0;
}
.dropdown-content a:hover, .dropdown-content button:hover {
    background-color: rgba(255, 255, 255, 0.05); color: #fff; transform: none; box-shadow: none;
}
.dropdown:hover .dropdown-content, .dropdown:focus-within .dropdown-content { display: block; }

/* Toaster Styles */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { background: var(--card-bg); backdrop-filter: blur(8px); border: 1px solid var(--border); padding: 1rem 1.5rem; border-radius: 8px; color: var(--text-main); font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); opacity: 0; transform: translateX(100%); transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); pointer-events: auto; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }

/* Custom Confirm Modal */
#customConfirmOverlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 10000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
#customConfirmOverlay.active { display: flex; opacity: 1; }
#customConfirmModal { background: var(--bg-color); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; max-width: 400px; width: 90%; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.5); transform: scale(0.95); transition: transform 0.2s; }
#customConfirmOverlay.active #customConfirmModal { transform: scale(1); }
#customConfirmMessage { margin-bottom: 1.5rem; font-size: 1.1rem; color: var(--text-main); }
#customConfirmButtons { display: flex; justify-content: center; gap: 1rem; }
