/**
 * NSF Theme Utilities
 * Common theme classes used across all pages
 * Externalized from inline styles for CSP compliance
 */

/* ==========================================================================
   Base Theme
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F5FBFC;
}

/* ==========================================================================
   NSF Color Utilities
   ========================================================================== */

/* Background colors */
.bg-nsf-navy { background-color: #112E51; }
.bg-nsf-blue { background-color: #0071BC; }
.bg-nsf-blue-dark { background-color: #004d80; } /* WCAG AA compliant (7.4:1) */

/* Text colors */
.text-nsf-blue { color: #0071BC; }
.text-nsf-navy { color: #112E51; }

/* Status colors */
.text-status-red { color: #E31C3D; }
.text-status-green { color: #2E8540; }
.text-status-blue { color: #0071BC; }

/* ==========================================================================
   Light Theme Overrides
   ========================================================================== */

/* Main content headings - dark text */
main h1, main h2, main h3,
section h1, section h2, section h3 {
    color: #112E51 !important;
}

/* Header headings - white text on dark background */
header h1, header h2, header h3,
.bg-nsf-navy h1, .bg-nsf-navy h2, .bg-nsf-navy h3 {
    color: #FFFFFF !important;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

input:focus {
    border-color: #0071BC !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 113, 188, 0.2);
}

/* ==========================================================================
   Custom Scrollbar (Light Theme)
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F1F1F1;
}

::-webkit-scrollbar-thumb {
    background: #AEB0B5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5B616B;
}

/* ==========================================================================
   Analytics Dashboard Specific
   ========================================================================== */

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    text-align: center;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1e40af;
}

.metric-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Security alert styles */
.alert-high { background: #fef2f2; border-left: 4px solid #dc2626; }
.alert-medium { background: #fffbeb; border-left: 4px solid #f59e0b; }
.alert-low { background: #f0fdf4; border-left: 4px solid #22c55e; }

.severity-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.severity-high { background: #dc2626; color: white; }
.severity-medium { background: #f59e0b; color: white; }
.severity-low { background: #22c55e; color: white; }

/* Table styles */
.table-container { overflow-x: auto; }

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-container th,
.table-container td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.table-container th {
    background: #f9fafb;
    font-weight: 600;
}

.table-container tr:hover {
    background: #f9fafb;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #6b7280;
}

/* Active nav link */
nav a.active {
    border-bottom: 2px solid #1e40af;
    color: #1e40af;
}

/* ==========================================================================
   Org Hierarchy Specific
   ========================================================================== */

.tree-node {
    border-left: 2px solid #e5e7eb;
    margin-left: 1rem;
    padding-left: 1rem;
}

.tree-node:hover {
    background-color: rgba(0, 113, 188, 0.05);
}

.node-header {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.node-header:hover {
    background-color: rgba(0, 113, 188, 0.1);
}

.node-expanded > .node-header {
    background-color: rgba(0, 113, 188, 0.05);
}

/* ==========================================================================
   Assessment Page Specific
   ========================================================================== */

/* Header and footer text on dark background */
header p, footer p, footer strong {
    color: #9BDAF1 !important; /* NSF cyan light */
}

header p.text-white, footer p.text-white, footer strong.text-white,
header span.text-white, footer span.text-white {
    color: #FFFFFF !important;
}

/* Header links and navigation on navy background */
header a, header nav a {
    color: #9BDAF1 !important;
}

header a:hover, header nav a:hover {
    color: #FFFFFF !important;
}

header a[href*="logout"] {
    color: #FFFFFF !important;
}

/* Border colors */
.border-nsf-blue { border-color: #0071BC; }
.border-status-red { border-color: #E31C3D; }

/* Tab styles */
.tab-button {
    transition: all 0.2s ease;
    background-color: #FFFFFF;
    border-color: #AEB0B5;
    color: #323A45;
}

.tab-button.active {
    background-color: #0071BC;
    color: #FFFFFF;
    border-color: #0071BC;
}

.tab-button:not(.active):hover {
    background-color: #F1F1F1;
    border-color: #0071BC;
}

.tab-button:disabled {
    background-color: #F1F1F1;
    color: #AEB0B5;
    cursor: not-allowed;
}

/* Input styles for light theme */
input[type="text"],
input[type="number"],
textarea,
select {
    background-color: #FFFFFF;
    border-color: #AEB0B5;
    color: #212121;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: #0071BC;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 113, 188, 0.2);
}

/* Radio and checkbox styles */
input[type="radio"],
input[type="checkbox"] {
    accent-color: #0071BC;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #F1F1F1;
}

/* Auto-save indicator */
.save-indicator {
    transition: opacity 0.3s ease;
}

/* Loading spinner */
.spinner {
    border: 2px solid #AEB0B5;
    border-top-color: #0071BC;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Citation tag styles */
.citation-tag {
    background-color: #F1F1F1;
    border: 1px solid #AEB0B5;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #323A45;
}

.citation-tag button {
    color: #5B616B;
    transition: color 0.2s;
}

.citation-tag button:hover {
    color: #E31C3D;
}

/* Progress indicator */
.progress-bar {
    transition: width 0.3s ease;
}

/* ==========================================================================
   Citations Page Specific
   ========================================================================== */

.citation-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.citation-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #112E51;
    margin-bottom: 0.5rem;
}

.citation-meta {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
}

.citation-meta a {
    color: #0071BC;
    text-decoration: none;
}

.citation-meta a:hover {
    text-decoration: underline;
}

.citation-key {
    font-family: monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}
