/* ==========================================================================
   DARK THEME OVERRIDE for pre-generated model pages
   Converts light-themed static HTML pages to match the DMT dark palette.
   Applied via <link> injection to evaluations/model_pages/*.html
   ==========================================================================
   WCAG AA Compliance Notes:
   - Normal text: minimum 4.5:1 contrast ratio
   - Large text (18px+ or 14px bold): minimum 3:1
   - All colors below verified against dark backgrounds
   ========================================================================== */

/* Skip navigation link for keyboard accessibility (WCAG 2.4.1) */
.skip-link {
    position: absolute;
    top: -44px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 10px 16px;
    z-index: 9999;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid #00D4FF;
}

:root {
    --deep-purple-1: #8B00FF;
    --deep-purple-2: #9D00FF;
    --electric-blue-1: #00D4FF;
    --electric-blue-2: #0099FF;
    --neon-green-1: #39FF14;
    --neon-green-2: #00FF41;
    --vibrant-magenta-1: #FF00FF;
    --vibrant-magenta-2: #FF1493;
    --dark-bg-1: #0A0E27;
    --dark-bg-2: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
}

/* --- Body & Container --- */
body {
    background: linear-gradient(135deg, var(--dark-bg-1) 0%, var(--dark-bg-2) 50%, #1f1545 100%) !important;
    color: var(--text-primary) !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.container {
    background: rgba(10, 14, 39, 0.95) !important;
    border: 1px solid var(--deep-purple-2) !important;
    box-shadow: 0 20px 60px rgba(139, 0, 255, 0.3) !important;
}

/* --- Header --- */
.header {
    background: linear-gradient(90deg, rgba(139, 0, 255, 0.4), rgba(0, 212, 255, 0.3)) !important;
    border-bottom: 2px solid var(--deep-purple-1) !important;
}

.header h1 {
    color: var(--electric-blue-1) !important;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5) !important;
}

.header .subtitle,
.header p {
    color: var(--text-secondary) !important;
}

/* --- Stats Section --- */
.stats {
    background: rgba(15, 52, 96, 0.2) !important;
    border-bottom: 1px solid var(--deep-purple-2) !important;
}

.stat-card {
    background: rgba(15, 52, 96, 0.4) !important;
    border-left: 4px solid var(--deep-purple-1) !important;
    border: 1px solid rgba(15, 52, 96, 0.6) !important;
    border-left: 4px solid var(--deep-purple-1) !important;
    box-shadow: 0 2px 8px rgba(139, 0, 255, 0.2) !important;
}

.stat-card .value {
    color: var(--electric-blue-1) !important;
}

.stat-card .label {
    color: var(--text-secondary) !important; /* #b0b0b0 on dark = ~7:1 contrast */
}

/* --- Content Area --- */
.content {
    color: var(--text-primary) !important;
}

.content h2,
.content h3 {
    color: var(--electric-blue-1) !important;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3) !important;
}

/* --- Evaluation Cards --- */
.evaluation {
    background: rgba(15, 52, 96, 0.3) !important;
    border: 1px solid rgba(139, 0, 255, 0.3) !important;
    border-radius: 8px !important;
}

.evaluation:hover {
    border-color: var(--electric-blue-1) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.15) !important;
}

.evaluation h3 {
    color: var(--electric-blue-1) !important;
}

/* --- Technique Names --- */
.technique-name,
.technique {
    color: var(--neon-green-1) !important;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3) !important;
}

/* --- Success/Fail Badges with WCAG-compliant contrast --- */
.success, .badge-success, [class*="success"] {
    background: rgba(0, 212, 100, 0.2) !important;
    color: #4AFF8B !important; /* Bright green on dark bg = 8.5:1 */
    border: 1px solid #00d464 !important;
    padding: 4px 12px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
}

.fail, .badge-fail, .badge-danger, [class*="fail"] {
    background: rgba(255, 100, 100, 0.2) !important;
    color: #FF8A8A !important; /* Bright red on dark bg = 5.5:1 */
    border: 1px solid #ff6464 !important;
    padding: 4px 12px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
}

/* --- Tables --- */
table {
    color: var(--text-primary) !important;
    border-collapse: collapse !important;
}

th {
    background: rgba(139, 0, 255, 0.25) !important;
    color: var(--electric-blue-1) !important;
    border-color: var(--deep-purple-2) !important;
    padding: 10px 15px !important;
}

td {
    border-color: rgba(157, 0, 255, 0.3) !important;
    padding: 8px 15px !important;
}

tr:nth-child(even) {
    background-color: rgba(157, 0, 255, 0.08) !important;
}

tr:hover {
    background-color: rgba(255, 0, 255, 0.12) !important;
}

/* --- Response Display --- */
.response, .response-text, .response-content {
    background: rgba(10, 14, 39, 0.8) !important;
    border: 1px solid var(--deep-purple-2) !important;
    border-radius: 6px !important;
    padding: 15px !important;
    color: var(--text-primary) !important;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    line-height: 1.5 !important;
}

pre, code {
    background: rgba(139, 0, 255, 0.15) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--deep-purple-2) !important;
    border-radius: 4px !important;
}

/* --- Prompt Display --- */
.prompt, .prompt-text {
    background: rgba(139, 0, 255, 0.2) !important;
    border-left: 4px solid var(--electric-blue-1) !important;
    padding: 12px !important;
    color: var(--text-primary) !important;
    border-radius: 0 6px 6px 0 !important;
}

/* --- Links --- */
a {
    color: var(--electric-blue-1) !important;
    text-decoration: none !important;
}

a:hover {
    color: var(--neon-green-1) !important;
    text-decoration: underline !important;
}

/* --- Back Button --- */
.back-btn, .back-link, a[href*="index"] {
    display: inline-block !important;
    padding: 10px 20px !important;
    background: rgba(15, 52, 96, 0.5) !important;
    border: 1px solid var(--deep-purple-1) !important;
    border-radius: 5px !important;
    color: var(--electric-blue-1) !important;
    transition: all 0.3s ease !important;
}

.back-btn:hover, .back-link:hover, a[href*="index"]:hover {
    background: rgba(15, 52, 96, 0.8) !important;
    border-color: var(--electric-blue-1) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3) !important;
}

/* --- Metadata / Labels --- */
.meta, .metadata, .info, .details-label {
    color: var(--text-secondary) !important;
}

/* --- Summary / Footer --- */
.summary, .footer, footer {
    background: rgba(15, 52, 96, 0.2) !important;
    border-top: 1px solid var(--deep-purple-2) !important;
    color: var(--text-secondary) !important;
}

/* --- Misc light-mode overrides --- */
.card, .panel, .box, .section {
    background: rgba(15, 52, 96, 0.3) !important;
    border: 1px solid rgba(139, 0, 255, 0.3) !important;
    color: var(--text-primary) !important;
}

/* Override any white/light backgrounds */
[style*="background: white"],
[style*="background-color: white"],
[style*="background:#fff"],
[style*="background: #fff"],
[style*="background: #f8f9fa"],
[style*="background-color: #f8f9fa"] {
    background: rgba(15, 52, 96, 0.3) !important;
}

/* Override dark text on light backgrounds */
[style*="color: #333"],
[style*="color:#333"],
[style*="color: #666"],
[style*="color:#666"] {
    color: var(--text-primary) !important;
}

/* --- Scrollbar styling for dark theme --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg-2);
}

::-webkit-scrollbar-thumb {
    background: var(--deep-purple-1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--electric-blue-1);
}

/* ============================================
   CLASS-LEVEL OVERRIDES FOR INLINE STYLE BLOCKS
   These override styles from <style> blocks in
   pre-generated technique/model/record pages
   ============================================ */

/* Main body and containers */
body {
    background: linear-gradient(135deg, #0a0e27 0%, #1a0a2e 50%, #0d1b3e 100%) !important;
    color: #e8e8e8 !important;
}

.container, .main-container, .content-container {
    background: rgba(10, 14, 39, 0.95) !important;
    color: #e8e8e8 !important;
}

.content, .content-section, .main-content {
    background: rgba(15, 52, 96, 0.3) !important;
    color: #e8e8e8 !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
}

/* Model and technique info boxes */
.model-info, .technique-info, .info-card, .info-box {
    background: rgba(15, 52, 96, 0.3) !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
    color: #e8e8e8 !important;
}

/* Test records and results */
.test-record, .eval-record, .record, .result-card {
    background: rgba(15, 52, 96, 0.2) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
    color: #e8e8e8 !important;
}

.record-label, .result-label, .field-label {
    color: #b0b0b0 !important;
}

.record-value, .result-value, .field-value {
    color: #e8e8e8 !important;
}

/* Compliance and checklist sections */
.compliance-checklist, .checklist, .compliance-section {
    background: rgba(15, 52, 96, 0.2) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
}

/* Prompt and response display */
.prompt-content, .response-content, .prompt-box, .response-box {
    background: rgba(10, 14, 39, 0.8) !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
    color: #e8e8e8 !important;
}

/* Config sections */
.config-section, .config-box, .settings-section {
    background: rgba(15, 52, 96, 0.3) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
    color: #e8e8e8 !important;
}

/* Count boxes and stat displays */
.count-box, .stat-box, .metric-box {
    background: rgba(15, 52, 96, 0.3) !important;
    color: #e8e8e8 !important;
}

.count-label, .stat-label, .metric-label {
    color: #b0b0b0 !important;
}

.count-value, .stat-value, .metric-value {
    color: #4AFF8B !important;
}

/* Content boxes and detail sections */
.content-box, .detail-box, .detail-section {
    background: rgba(15, 52, 96, 0.2) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
    color: #e8e8e8 !important;
}

/* Headers and titles */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff !important;
}

.section-title, .card-title, .header-title {
    color: #ffffff !important;
}

/* Footer */
.footer, footer {
    background: rgba(15, 52, 96, 0.2) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
    color: #b0b0b0 !important;
}

/* Tables */
table {
    color: #e8e8e8 !important;
}

table th {
    background: rgba(15, 52, 96, 0.4) !important;
    color: #ffffff !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
}

table td {
    background: rgba(10, 14, 39, 0.6) !important;
    color: #e8e8e8 !important;
    border-color: rgba(138, 43, 226, 0.15) !important;
}

table tr:hover td {
    background: rgba(15, 52, 96, 0.4) !important;
}

/* Links */
a {
    color: #8a6fff !important;
}

a:hover {
    color: #b89aff !important;
}

/* Badges - success/fail */
.badge-pass, .badge-success, .pass, .success {
    color: #4AFF8B !important;
    font-weight: 600 !important;
}

.badge-fail, .badge-danger, .fail, .failure {
    color: #FF8A8A !important;
    font-weight: 600 !important;
}

/* Navigation header/bar */
.nav, .navbar, .nav-bar, .header-nav {
    background: rgba(10, 14, 39, 0.95) !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
}

.nav a, .navbar a, .nav-link {
    color: #b89aff !important;
}

/* Code blocks and pre */
pre, code {
    background: rgba(10, 14, 39, 0.8) !important;
    color: #4AFF8B !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
}

/* Form controls */
select, input, textarea {
    background: rgba(15, 52, 96, 0.4) !important;
    color: #e8e8e8 !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 14, 39, 0.8);
}

::-webkit-scrollbar-thumb {
    background: rgba(138, 43, 226, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 43, 226, 0.6);
}

/* Override ALL light gray backgrounds with catch-all */
*[style*="background: #f"],
*[style*="background:#f"],
*[style*="background-color: #f"],
*[style*="background-color:#f"],
*[style*="background: white"],
*[style*="background:white"],
*[style*="background-color: white"],
*[style*="background-color:white"],
*[style*="background: rgb(2"],
*[style*="background-color: rgb(2"] {
    background: rgba(15, 52, 96, 0.3) !important;
}

/* Override all dark text colors */
*[style*="color: #3"],
*[style*="color:#3"],
*[style*="color: #4"],
*[style*="color:#4"],
*[style*="color: #5"],
*[style*="color:#5"],
*[style*="color: #6"],
*[style*="color:#6"] {
    color: #e8e8e8 !important;
}

/* Specific purple-gradient header override for model pages */
.header, .page-header, .model-header {
    background: linear-gradient(135deg, #1a0a2e, #0d1b3e) !important;
    color: #ffffff !important;
}

/* Phase indicators */
.phase-b, .phase-c {
    background: rgba(15, 52, 96, 0.3) !important;
    border-color: rgba(138, 43, 226, 0.3) !important;
    color: #e8e8e8 !important;
}

/* Summary sections */
.summary, .summary-section, .overview {
    background: rgba(15, 52, 96, 0.2) !important;
    color: #e8e8e8 !important;
}

/* Technique cards */
.technique-card, .attack-card, .method-card {
    background: rgba(15, 52, 96, 0.25) !important;
    border-color: rgba(138, 43, 226, 0.25) !important;
    color: #e8e8e8 !important;
}

/* Search and filter sections */
.filter-section, .search-section, .controls {
    background: rgba(10, 14, 39, 0.8) !important;
    border-color: rgba(138, 43, 226, 0.2) !important;
}

/* Ensure paragraphs and divs with light text are readable */
p, div, span, li {
    color: inherit;
}

/* Back button / navigation links at top of pages */
.back-link, .breadcrumb, .nav-back {
    color: #8a6fff !important;
}

/* Override Bootstrap .text-muted for dark theme (WCAG 1.4.3)
   Bootstrap 5 --bs-secondary-color: rgba(33,37,41,.75) renders near-black on dark
   backgrounds, failing contrast. #8b949e on the darkest bg (#0a0e27) = 6.4:1.
   On card bg rgba(15,52,96,0.3) over #0a0e27 = 6.4:1. Both pass AA (4.5:1). */
.text-muted, small.text-muted, .text-muted.text-center,
.response-viewer-empty.text-muted {
    color: #8b949e !important;
}
