/* Sentinel Engine Web Application - Dark Theme Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: #16213e;
    border-bottom: 1px solid #667eea;
    padding: 1rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #e0e0e0;
}

.logo {
    height: 40px;
    margin-right: 12px;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
}

nav a {
    color: #a0a0a0;
    text-decoration: none;
    margin-left: 2rem;
    transition: color 0.2s;
}

nav a:hover {
    color: #667eea;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0;
}

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

/* Cards */
.card {
    background: #16213e;
    border-radius: 12px;
    border: 1px solid #2a2a4e;
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Upload Card */
.upload-card {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
}

.upload-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.subtitle {
    color: #888;
    margin-bottom: 2rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #a0a0a0;
    font-weight: 500;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0f1629;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.05);
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: #888;
    margin-bottom: 0.5rem;
}

.upload-formats {
    color: #667eea;
    font-size: 0.875rem;
}

/* File List */
.file-list {
    margin-bottom: 1.5rem;
    text-align: left;
}

.file-item {
    display: flex;
    align-items: center;
    background: #0f1629;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.file-name {
    flex: 1;
    color: #e0e0e0;
}

.file-size {
    color: #888;
    font-size: 0.875rem;
    margin-right: 1rem;
}

.file-remove {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.5rem;
}

.file-remove:hover {
    color: #ff6666;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   RESULTS PAGE
   ============================================ */

/* A. Project Header Bar */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #16213e;
    border: 1px solid #2a2a4e;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.project-header h1 {
    font-size: 1.75rem;
    color: #fff;
    margin: 0;
}

.project-timestamp {
    color: #888;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.verdict-badge {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.verdict-pass {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 2px solid #28a745;
}

.verdict-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 2px solid #ffc107;
}

.verdict-fail {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 2px solid #dc3545;
}

/* B. Scan Coverage Card */
.scan-coverage {
    border-left: 4px solid #667eea;
    margin-bottom: 1.5rem;
}

.scan-coverage-header h2 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 0;
    border-bottom: 1px solid #2a2a4e;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-divider {
    width: 1px;
    height: 2.5rem;
    background: #2a2a4e;
}

.analyzers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.analyzer-item {
    border-radius: 8px;
    overflow: hidden;
}

.analyzer-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
}

.analyzer-row:hover {
    background: rgba(102, 126, 234, 0.05);
}

.analyzer-status {
    font-size: 1rem;
    font-weight: 700;
    min-width: 1.25rem;
    text-align: center;
}

.analyzer-item[data-status="completed"] .analyzer-status {
    color: #28a745;
}

.analyzer-item[data-status="skipped"] .analyzer-status,
.analyzer-item[data-status="not_configured"] .analyzer-status {
    color: #555;
}

.analyzer-item[data-status="not_installed"] .analyzer-status {
    color: #ffc107;
}

.analyzer-item[data-status="timeout"] .analyzer-status {
    color: #fd7e14;
}

.analyzer-item[data-status="error"] .analyzer-status {
    color: #dc3545;
}

.analyzer-name {
    font-weight: 500;
    color: #e0e0e0;
    flex: 1;
}

.analyzer-patterns {
    color: #888;
    font-size: 0.85rem;
}

.analyzer-patterns.not-installed {
    color: #ffc107;
    font-style: italic;
}

.analyzer-patterns.not-configured {
    color: #555;
    font-style: italic;
}

.analyzer-findings {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 4rem;
    text-align: right;
}

.analyzer-toggle {
    color: #888;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.analyzer-note {
    font-size: 0.8rem;
    color: #666;
    padding: 0.6rem 1rem 0.2rem;
    line-height: 1.5;
}

.analyzer-note a {
    color: #667eea;
    text-decoration: none;
}

.analyzer-note a:hover {
    text-decoration: underline;
}

.category-list {
    padding: 0 1rem 0.75rem 2.5rem;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
}

.category-connector {
    color: #2a2a4e;
    font-size: 0.85rem;
}

.category-name {
    color: #c0c0c0;
    font-size: 0.875rem;
}

.category-patterns {
    color: #666;
    font-size: 0.8rem;
}

.category-findings {
    color: #888;
    font-size: 0.8rem;
    margin-left: auto;
}

.category-findings.has-findings {
    color: #ff8c00;
    font-weight: 600;
}

/* C. Risk Score & Severity Row */
.risk-severity-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.risk-score-card {
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
}

.risk-score-label {
    font-size: 0.875rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.risk-score-value {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 0.5rem;
}

.risk-score-max {
    font-size: 1rem;
    color: #888;
    font-weight: 400;
}

.risk-score-value.risk-low { color: #28a745; }
.risk-score-value.risk-medium { color: #ffc107; }
.risk-score-value.risk-high { color: #fd7e14; }
.risk-score-value.risk-critical { color: #dc3545; }

.severity-summary {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.severity-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    min-width: 80px;
    border: 1px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.severity-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.severity-pill.critical {
    background: rgba(220, 53, 69, 0.12);
    border-color: rgba(220, 53, 69, 0.3);
}
.severity-pill.high {
    background: rgba(255, 140, 0, 0.12);
    border-color: rgba(255, 140, 0, 0.3);
}
.severity-pill.medium {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.3);
}
.severity-pill.low {
    background: rgba(68, 136, 255, 0.12);
    border-color: rgba(68, 136, 255, 0.3);
}
.severity-pill.info {
    background: rgba(136, 136, 136, 0.12);
    border-color: rgba(136, 136, 136, 0.3);
}

.pill-count {
    font-size: 1.75rem;
    font-weight: 700;
}
.severity-pill.critical .pill-count { color: #ff4444; }
.severity-pill.high .pill-count { color: #ff8c00; }
.severity-pill.medium .pill-count { color: #ffd700; }
.severity-pill.low .pill-count { color: #4488ff; }
.severity-pill.info .pill-count { color: #888; }

.pill-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.03em;
}

/* D. Download Section */
.download-section {
    margin-bottom: 1.5rem;
}

.download-section h3 {
    margin-bottom: 1rem;
    color: #fff;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    background: #0f1629;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #e0e0e0;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-download:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.btn-download .icon {
    margin-right: 0.5rem;
}

.btn-attack-graph {
    border-color: #764ba2;
    color: #c084fc;
}

.btn-attack-graph:hover {
    background: rgba(118, 75, 162, 0.1);
}

/* E. Findings Section with Filter Tabs */
.findings-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.findings-header-row h3 {
    color: #fff;
    margin: 0;
}

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    background: #0f1629;
    border-radius: 8px;
    padding: 0.25rem;
}

.filter-tab {
    background: transparent;
    border: none;
    color: #888;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    color: #e0e0e0;
    background: rgba(102, 126, 234, 0.1);
}

.filter-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.findings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finding-card {
    background: #0f1629;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.finding-card.expanded {
    border-color: #667eea;
}

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.finding-header:hover {
    background: rgba(102, 126, 234, 0.05);
}

.finding-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-critical {
    background: #ff4444;
    color: white;
}

.severity-high {
    background: #ff8c00;
    color: white;
}

.severity-medium {
    background: #ffd700;
    color: #1a1a2e;
}

.severity-low {
    background: #4488ff;
    color: white;
}

.severity-info {
    background: #888;
    color: white;
}

.finding-title {
    font-weight: 500;
    color: #e0e0e0;
}

.finding-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.finding-location {
    color: #888;
    font-size: 0.875rem;
}

.finding-toggle {
    color: #888;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.finding-content {
    padding: 0 1rem 1rem;
    border-top: 1px solid #2a2a4e;
    transition: max-height 0.3s ease;
}

.finding-description {
    padding: 1rem 0;
    color: #c0c0c0;
}

.code-block {
    background: #0d1117;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    color: #e0e0e0;
}

.remediation-box {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.remediation-box h4 {
    color: #28a745;
    margin-bottom: 0.5rem;
}

.remediation-box p {
    color: #c0c0c0;
}

.finding-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #2a2a4e;
}

.detail-item {
    color: #888;
    font-size: 0.875rem;
}

.no-findings {
    text-align: center;
    padding: 3rem;
    color: #888;
}

.no-findings-icon {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 1rem;
}

/* F. AI Insights Section */
.ai-insights {
    margin-top: 2rem;
    border-left: 4px solid #667eea;
}

.ai-insights h2 {
    color: #fff;
    margin-bottom: 1rem;
}

.ai-summary-card {
    background: #0f1629;
    border: 1px solid #2a2a4e;
    border-left: 4px solid #667eea;
    border-radius: 12px;
    padding: 1.5rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

.ai-summary-card p {
    color: #c0c0c0;
    margin: 0;
}

/* Footer */
footer {
    background: #16213e;
    border-top: 1px solid #2a2a4e;
    padding: 1.5rem 0;
    text-align: center;
    color: #888;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    nav a {
        margin: 0 1rem;
    }

    .project-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .risk-severity-row {
        flex-direction: column;
    }

    .severity-summary {
        flex-wrap: wrap;
    }

    .stats-bar {
        justify-content: center;
    }

    .download-buttons {
        justify-content: center;
    }

    .finding-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .finding-meta {
        width: 100%;
        justify-content: space-between;
    }

    .findings-header-row {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }
}
