:root {
    /* Modern shadcn-inspired dark mode theme */
    --bg-deep: #09090b;
    --bg-surface: #18181b;
    --bg-glass: rgba(24, 24, 27, 0.65);
    /* Clean barely-there borders */
    --border-glass: rgba(255, 255, 255, 0.1);
    
    /* Sleeker accent colors */
    --acc-blue: #3b82f6;
    --acc-blue-glow: rgba(59, 130, 246, 0.2);
    --acc-purple: #8b5cf6;
    --acc-green: #10b981;
    --acc-red: #ef4444;
    --acc-orange: #f59e0b;
    
    /* Text colors */
    --text-main: #fafafa;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    
    --sidebar-width: 280px;
    --top-bar-h: 70px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    --ring: rgba(255, 255, 255, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100vh;
}

.hidden { display: none !important; }

/* Login Container Overhaul */
#login-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    padding: 2.5rem;
    z-index: 1000;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.login-header .logo-box {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--bg-surface), #27272a);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.login-header h1 { font-size: 1.75rem; font-weight: 600; text-align: center; margin-bottom: 0.5rem; letter-spacing: -0.025em; }
.login-header p { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2.5rem; }

.input-group label { display: block; font-size: 0.825rem; font-weight: 500; color: var(--text-main); margin-bottom: 0.5rem; }
.input-group input { 
    width: 100%; 
    padding: 0.75rem 1rem; 
    background: transparent; 
    border: 1px solid var(--border-glass); 
    border-radius: 8px; 
    color: white; 
    font-size: 0.9rem;
    outline: none; 
    transition: var(--transition);
}
.input-group input:focus { border-color: var(--acc-blue); box-shadow: 0 0 0 2px var(--acc-blue-glow); }

.password-wrapper { position: relative; }
.eye-btn { 
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%); 
    background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 1rem;
    padding: 4px;
}
.eye-btn:hover { color: var(--text-main); }

#login-btn { 
    width: 100%; margin-top: 2rem; padding: 0.75rem; border-radius: 8px; 
    background: var(--text-main); color: var(--bg-deep); border: none;
    font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: var(--transition); box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
#login-btn:hover { background: #e4e4e7; }

/* Sidebar Styling */
#dashboard-container { display: flex; height: 100vh; width: 100vw; background: var(--bg-deep); }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2.5rem; padding: 0 0.5rem; }
.logo-box.small { 
    width: 32px; height: 32px; border-radius: 8px; font-size: 1rem; font-weight: 600;
    background: var(--text-main); color: var(--bg-deep); display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.brand-name { font-weight: 600; font-size: 1.1rem; letter-spacing: -0.025em; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.nav-item { 
    all: unset; display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; 
    border-radius: 8px; cursor: pointer; color: var(--text-muted); transition: var(--transition);
    font-weight: 500; font-size: 0.9rem;
}
.nav-item i { font-size: 1rem; width: 20px; text-align: center; }
.nav-item:hover { background: var(--border-glass); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--border-glass); }
.nav-item.active { background: rgba(255,255,255,0.08); color: var(--text-main); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }

.sidebar-bottom { margin-top: auto; padding-top: 1.5rem; display: flex; align-items: center; gap: 0.75rem; }
.user-avatar { width: 36px; height: 36px; background: #27272a; border: 1px solid var(--border-glass); color: var(--text-muted); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; }
.user-meta { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.user-name { font-weight: 500; font-size: 0.875rem; }
.user-role { font-size: 0.75rem; color: var(--text-dim); }
.logout-minimal { all: unset; cursor: pointer; color: var(--text-muted); font-size: 1rem; padding: 0.5rem; border-radius: 6px; transition: var(--transition); }
.logout-minimal:hover { color: var(--text-main); background: var(--border-glass); }

/* Main Content Styling */
.main-content { flex: 1; background: var(--bg-deep); height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }

.top-bar { 
    min-height: var(--top-bar-h); padding: 1rem 3rem; display: flex; align-items: center; justify-content: space-between;
    background: rgba(9, 9, 11, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-glass);
    position: sticky; top: 0; z-index: 10; gap: 1rem; flex-wrap: wrap;
}

#view-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.025em; }
.refresh-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc-green); box-shadow: 0 0 8px var(--acc-green); }
.status-dot.pulsing { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.filter-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.filter-select, .date-input { 
    background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass); border-radius: 6px; 
    color: var(--text-main); font-size: 0.85rem; padding: 0.5rem 0.75rem; outline: none;
    transition: var(--transition);
}
.filter-select:focus, .date-input:focus { border-color: var(--acc-blue); box-shadow: 0 0 0 2px var(--acc-blue-glow); background: rgba(255,255,255,0.05); }
.filter-select option { background: var(--bg-surface); }
.date-sep { color: var(--text-dim); font-size: 0.8rem; margin: 0 0.2rem; }
.btn-icon { all: unset; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass); color: var(--text-muted); transition: var(--transition); }
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text-main); border-color: var(--acc-blue); }

/* Dashboard Content Views */
.content-view { padding: 2.5rem 3rem; display: flex; flex-direction: column; gap: 2rem; max-width: 1600px; margin: 0 auto; width: 100%; }

/* KPI Row */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.kpi-card { padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; }
.kpi-label { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; display: block; }
.kpi-value-row { display: flex; align-items: center; justify-content: space-between; }
.kpi-value { font-size: 2.25rem; font-weight: 700; line-height: 1; letter-spacing: -0.025em; }
.kpi-trend { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.pos { background: rgba(16, 185, 129, 0.1); color: var(--acc-green); border: 1px solid rgba(16, 185, 129, 0.2); }

/* Charts Layout */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.chart-container { padding: 1.5rem; height: 400px; display: flex; flex-direction: column; }
.chart-header { margin-bottom: 1.5rem; }
.chart-header h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.2rem; }
.chart-header p { font-size: 0.8rem; color: var(--text-muted); }

/* Bottom Row */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.section-header h3 { font-size: 1rem; font-weight: 600; }
.btn-text-only { all: unset; color: var(--text-main); font-size: 0.8rem; cursor: pointer; font-weight: 500; padding: 4px 8px; border-radius: 4px; transition: var(--transition); }
.btn-text-only:hover { background: var(--border-glass); }

.problematic-section, .activity-section { padding: 1.5rem; }

/* Problematic List Injection */
.list-container { display: flex; flex-direction: column; gap: 0.75rem; }
.problem-card { 
    display: flex; align-items: center; justify-content: space-between; padding: 1rem; 
    background: rgba(255,255,255,0.02); border: 1px solid var(--border-glass); border-radius: 8px;
    transition: var(--transition); cursor: default;
}
.problem-card:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); }
.problem-id { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85rem; color: var(--text-main); }
.problem-score { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); background: var(--border-glass); padding: 2px 8px; border-radius: 12px; }

/* Activity Feed Injection */
.activity-feed { display: flex; flex-direction: column; gap: 0.75rem; max-height: 400px; overflow-y: auto; padding-right: 5px; }
.activity-item { display: flex; gap: 1rem; padding: 1rem; border-radius: 8px; background: transparent; border: 1px solid var(--border-glass); transition: var(--transition); }
.activity-item:hover { background: rgba(255,255,255,0.02); }
.activity-user-pfp { width: 32px; height: 32px; border-radius: 50%; background: var(--border-glass); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; }
.activity-info { flex: 1; }
.activity-line { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; margin-bottom: 0.2rem; }
.activity-time { font-size: 0.75rem; color: var(--text-dim); }
.activity-comment-block { font-size: 0.85rem; color: var(--text-muted); background: rgba(255,255,255,0.03); padding: 0.75rem; border-radius: 6px; margin-top: 0.5rem; border: 1px solid var(--border-glass); }

/* Glassmorphism / Component Classes */
.glass-module { 
    background: var(--bg-surface); border: 1px solid var(--border-glass); border-radius: 12px; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}
.glass-module-small { background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass); border-radius: 6px; }

/* List View Container */
.list-header { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: center; }
.search-box { 
    display: flex; align-items: center; width: 400px; max-width: 100%;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass); 
    border-radius: 8px; padding: 0.75rem 1.25rem; transition: var(--transition); 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.search-box:focus-within { 
    border-color: var(--acc-blue); background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px var(--acc-blue-glow); 
}
.search-box i { color: var(--text-muted); font-size: 1rem; margin-right: 0.75rem; }
.search-box input { flex: 1; background: transparent; border: none; color: var(--text-main); font-size: 0.95rem; outline: none; }
.search-box input::placeholder { color: var(--text-dim); }

.table-frame { flex: 1; width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-glass); background: var(--bg-surface); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { 
    text-align: left; padding: 1.25rem; font-size: 0.75rem; font-weight: 600; 
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); 
    border-bottom: 1px solid var(--border-glass); background: #1f1f22; 
}
td { padding: 1.25rem; font-size: 0.875rem; border-bottom: 1px solid var(--border-glass); vertical-align: middle; color: var(--text-main); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.03); }

/* Pagination Styling */
.pagination-footer { margin-top: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
#page-info { font-size: 0.85rem; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 0.5rem; align-items: center; }
.btn-page { all: unset; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; background: transparent; border: 1px solid var(--border-glass); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: var(--transition); }
.btn-page:hover:not(:disabled) { background: var(--border-glass); color: var(--text-main); }
.btn-page:disabled { opacity: 0.3; cursor: not-allowed; }
.pages-list { display: flex; gap: 0.25rem; }
.page-num { all: unset; cursor: pointer; min-width: 32px; height: 32px; padding: 0 0.5rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; text-align: center; color: var(--text-muted); transition: var(--transition); }
.page-num:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.page-num.active { background: var(--text-main); color: var(--bg-deep); font-weight: 600; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

@media (max-width: 1024px) {
    .charts-row, .bottom-row { grid-template-columns: 1fr; }
    .content-view { padding: 1.5rem; }
    .top-bar { padding: 1rem 1.5rem; }
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
}
.modal.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    background: var(--bg-surface);
    width: 650px;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.close-modal {
    all: unset;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: var(--transition);
}
.close-modal:hover {
    color: var(--text-main);
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.detail-group {
    margin-bottom: 1.25rem;
}
.detail-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.detail-value {
    font-size: 0.95rem;
    color: var(--text-main);
    background: rgba(255,255,255,0.03);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    white-space: pre-wrap;
    word-break: break-word;
}
.detail-value.code-font {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--acc-blue);
}
.clickable-row {
    cursor: pointer;
    transition: background 0.2s;
}
.clickable-row:hover {
    background: rgba(255,255,255,0.05);
}
