/* --- DASHBOARD THEME VARIABLES --- */
:root {
    --dash-bg: #050505;
    --dash-surface: #0e0e11;
    --dash-surface-hover: #16161a;
    --dash-border: rgba(255, 255, 255, 0.08);
    --dash-primary: #6366f1;
    --dash-primary-glow: rgba(99, 102, 241, 0.4);
    --dash-text-main: #ffffff;
    --dash-text-muted: #888899;
    --dash-success: #10b981;
    --dash-warning: #f59e0b;
    --dash-error: #f43f5e;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --- GLOBAL RESET & SCROLLBAR --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--dash-bg);
    color: var(--dash-text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* App-like feel */
    display: flex;
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* --- SIDEBAR STYLES --- */
.app-sidebar {
    width: 260px;
    background: #08080a;
    border-right: 1px solid var(--dash-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    height: 100%;
    flex-shrink: 0;
    z-index: 50;
    transition: width 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 24px 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--dash-border);
}

.logo-symbol-small {
    display: flex;
    gap: 3px;
    align-items: flex-end;
}
.logo-symbol-small .bar {
    width: 3px;
    background: var(--dash-primary);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--dash-primary-glow);
}
.logo-symbol-small .bar:nth-child(1) { height: 12px; }
.logo-symbol-small .bar:nth-child(2) { height: 18px; }
.logo-symbol-small .bar:nth-child(3) { height: 14px; }

.brand-text {
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: -0.5px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #555;
    margin: 24px 0 8px 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-section-title:first-of-type { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--dash-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 4px;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: #fff;
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-item i {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--dash-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}
.user-profile:hover { background: rgba(255, 255, 255, 0.03); }

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--dash-primary), #818cf8);
    border-radius: 10px; /* Squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.user-info div:first-child { color: #fff; font-size: 13px; font-weight: 600; }
.user-info div:last-child { color: var(--dash-text-muted); font-size: 11px; }


/* --- MAIN CONTENT AREA --- */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #050505;
    position: relative;
    overflow: hidden;
    /* Create depth with subtle radial gradient */
    background: radial-gradient(circle at 100% 0%, #13131a 0%, #050505 40%); 
}

/* --- TOP BAR --- */
.top-bar {
    height: 70px;
    border-bottom: 1px solid var(--dash-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(20px);
    z-index: 40;
    position: relative;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--dash-text-muted);
}
.breadcrumbs span.current { color: #fff; font-weight: 500; }

.search-bar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dash-border);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 280px;
    transition: 0.2s;
}
.search-bar:focus-within {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    background: rgba(0, 0, 0, 0.3);
}
.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    width: 100%;
    outline: none;
}

.btn-mini {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
.btn-primary {
    background: var(--dash-primary);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 2px 10px var(--dash-primary-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--dash-primary-glow);
}

/* --- VIEW CONTAINER --- */
.view-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.app-view {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow-y: auto;
    padding: 32px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.app-view.active-view {
    display: block;
    opacity: 1;
}

/* --- DASHBOARD CARDS & GRID --- */
.dashboard-title-area { margin-bottom: 32px; }
.dash-h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; color: #fff; letter-spacing: -0.5px; }
.dash-sub { color: var(--dash-text-muted); font-size: 14px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.dash-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}
.dash-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dash-text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}
.stat-value.highlight { color: var(--dash-primary); }
.stat-value.warning { color: var(--dash-warning); }
.stat-value.success { color: var(--dash-success); }

/* --- RECENT PROJECTS TABLE --- */
.table-container {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    overflow: hidden;
}
.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--dash-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 600; color: #fff; }
.card-header a { font-size: 12px; color: var(--dash-primary); text-decoration: none; font-weight: 500; }

.project-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.project-table th {
    text-align: left;
    padding: 16px 24px;
    color: var(--dash-text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--dash-border);
    background: rgba(255,255,255,0.01);
}
.project-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--dash-border);
    color: #ddd;
}
.project-table tr:last-child td { border-bottom: none; }
.project-table tr:hover { background: rgba(255,255,255,0.02); }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.status-badge.success { background: rgba(16, 185, 129, 0.15); color: var(--dash-success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--dash-warning); border: 1px solid rgba(245, 158, 11, 0.2); }

/* --- TOOLS GRID --- */
.quick-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.tool-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
    transition: 0.2s;
    cursor: pointer;
}
.tool-card:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--dash-primary);
    transform: translateY(-2px);
}
.tool-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.tool-card h4 { font-size: 14px; color: #fff; font-weight: 600; }
.tool-card p { font-size: 12px; color: var(--dash-text-muted); }


/* --- SCANNER & DEMO STYLES --- */
.scanner-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.upload-zone {
    width: 100%;
    border: 2px dashed var(--dash-border);
    background: rgba(255,255,255,0.01);
    border-radius: 24px;
    padding: 80px 40px;
    text-align: center;
    transition: 0.3s;
}
.upload-zone:hover {
    border-color: var(--dash-primary);
    background: rgba(99, 102, 241, 0.03);
}
.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--dash-text-muted);
    margin-bottom: 24px;
}
.upload-title { font-size: 24px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.upload-sub { color: var(--dash-text-muted); margin-bottom: 32px; }

/* Terminal */
.terminal-window {
    width: 100%;
    background: #09090b;
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
    display: none; /* Controlled by JS */
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.terminal-header {
    background: #18181b;
    padding: 12px 16px;
    border-bottom: 1px solid var(--dash-border);
    display: flex;
    gap: 8px;
    align-items: center;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.red { background: #ff5f56; } .yellow { background: #ffbd2e; } .green { background: #27c93f; }
.term-title { margin-left: auto; color: #666; font-size: 11px; font-family: var(--font-mono); }

.terminal-body {
    padding: 24px;
    height: 320px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #a1a1aa;
    line-height: 1.6;
}

/* Results Split View */
.results-view {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    height: 100%;
    width: 100%;
    display: none; /* Controlled by JS */
    animation: fadeIn 0.5s ease;
}

.pdf-viewer {
    background: #131315;
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.pdf-placeholder {
    text-align: center;
    color: var(--dash-text-muted);
}

.analysis-panel {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.score-display {
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--dash-border);
    margin-bottom: 24px;
}
.score-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 6px solid var(--dash-warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin: 0 auto 16px;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.2);
}

.issue-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--dash-border);
    border-left-width: 3px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: 0.2s;
}
.issue-card:hover { background: rgba(255,255,255,0.05); }
.issue-card.high { border-left-color: var(--dash-error); }
.issue-card.medium { border-left-color: var(--dash-warning); }

.issue-meta {
    font-size: 10px;
    font-weight: 700;
    color: var(--dash-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}
.issue-title { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 4px; }
.issue-desc { font-size: 12px; color: #aaa; line-height: 1.4; }

/* Animations */
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Fix Dropdown Button Background */
.setup-select {
    background-color: var(--dash-surface) !important;
    color: var(--dash-text-main) !important;
    border: 1px solid var(--dash-border);
    padding: 8px 12px;
    border-radius: 8px;
    appearance: none; /* Removes default styling if needed */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); /* Add custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* Ensure focus state is also readable */
.setup-select:focus {
    background-color: var(--dash-surface-hover) !important;
    border-color: var(--dash-primary);
    outline: none;
}