/* Trump Corruption Network - Styles */

:root {
    /* Professional Legal Theme - Navy, Burgundy, Gold */
    --bg-primary: #0f1419;          /* Deep navy background */
    --bg-secondary: #1a2332;        /* Slightly lighter navy */
    --bg-tertiary: #243447;         /* Medium navy */
    --text-primary: #f5f5f0;        /* Off-white for readability */
    --text-secondary: #c9d1d9;      /* Light gray */
    --text-muted: #8b949e;          /* Muted gray */
    
    /* Accent colors - trustworthy, professional */
    --accent-navy: #1e3a5f;         /* Deep navy blue */
    --accent-burgundy: #8b2635;     /* Deep burgundy/maroon */
    --accent-gold: #d4af37;         /* Professional gold */
    --accent-slate: #475569;        /* Slate gray */
    --accent-teal: #0d7377;         /* Trustworthy teal */
    
    /* Semantic colors */
    --color-legal: #8b2635;         /* Burgundy for legal issues */
    --color-financial: #d4af37;     /* Gold for financial */
    --color-political: #1e3a5f;     /* Navy for political */
    --color-personal: #6b4e71;      /* Muted purple */
    --color-business: #0d7377;      /* Teal for business */
    --color-international: #2e5266; /* Steel blue */
    --color-ethical: #8b7355;       /* Bronze/brown */
    
    --border-color: #30363d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--accent-burgundy), var(--accent-navy));
}

.sidebar-header h1 {
    font-size: 22px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 300;
}

/* Search */
.search-box {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

#search-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.search-results {
    position: absolute;
    top: 70px;
    left: 20px;
    right: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.search-results.visible {
    display: block;
}

.search-result-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Queries Section */
.queries-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    flex: 1;
}

.queries-section h2 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.queries-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.query-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.query-item:hover {
    background: var(--bg-primary);
    border-color: var(--accent-gold);
    transform: translateX(4px);
}

.query-item.active {
    background: var(--accent-navy);
    border-color: var(--accent-gold);
}

.query-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.query-icon {
    font-size: 18px;
}

.query-name {
    font-weight: 600;
    font-size: 14px;
}

.query-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Query Categories */
.query-category {
    margin-bottom: 4px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.category-header:hover {
    background: var(--bg-primary);
    border-color: var(--accent-gold);
}

.category-header.expanded {
    background: var(--bg-primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.category-icon {
    font-size: 16px;
}

.category-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.category-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 10px;
}

.category-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.category-queries {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.query-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.query-item:hover {
    background: var(--bg-primary);
    border-color: var(--accent-gold);
    transform: translateX(2px);
}

.query-item.active {
    background: var(--accent-navy);
    border-color: var(--accent-gold);
}

.query-item.active .query-name,
.query-item.active .query-description {
    color: white;
}

.query-item .query-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.query-info {
    flex: 1;
    min-width: 0;
}

.query-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.params-badge {
    font-size: 10px;
    opacity: 0.7;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    animation: slideUp 0.3s;
}

.modal-large {
    max-width: 900px;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Parameter Form */
.param-field {
    margin-bottom: 16px;
}

.param-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.param-field input,
.param-field select {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.param-field input:focus,
.param-field select:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Results Display */
.results-count {
    padding: 10px;
    background: var(--accent-teal);
    color: white;
    border-radius: 4px;
    margin-bottom: 16px;
    font-weight: 600;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.result-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.result-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.result-meta .badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.result-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.result-details {
    font-size: 12px;
    color: var(--text-muted);
}

.result-details strong {
    color: var(--text-primary);
}

.results-data pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.4;
}

.results-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 10px;
}

/* Stats Section */
.stats-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.stats-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
}

.stat-value {
    font-weight: 600;
    color: var(--accent-gold);
}

/* Legend */
.legend-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.legend-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

/* Controls */
.controls-section {
    padding: 20px;
}

.controls-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-navy), var(--accent-burgundy));
    color: white;
    border: none;
    width: 100%;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 100%;
    margin-bottom: 8px;
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--accent-gold);
}

.btn-icon {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-gold);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.graph-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.graph-header h2 {
    font-size: 20px;
}

.graph-controls {
    display: flex;
    gap: 8px;
}

/* Graph Container */
.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#graph-container svg {
    width: 100%;
    height: 100%;
}

/* Loading */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 26, 0.95);
    z-index: 999;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip */
.tooltip {
    position: absolute;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    max-width: 300px;
    box-shadow: var(--shadow);
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--accent-gold);
}

.tooltip-info {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tooltip-info div {
    margin-bottom: 4px;
}

.tooltip-link {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--accent-gold);
}

/* Node Styles (for D3) */
.node {
    cursor: pointer;
    transition: all 0.2s;
}

.node:hover {
    stroke-width: 3px !important;
}

.node.person {
    fill: var(--accent-burgundy);
}

.node.organization {
    fill: var(--accent-navy);
}

.node.law {
    fill: var(--accent-gold);
}

.node.core {
    fill: var(--accent-teal);
    stroke: #fff;
    stroke-width: 2px;
}

.node-label {
    font-size: 11px;
    fill: var(--text-primary);
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Link Styles */
.link {
    stroke: var(--border-color);
    stroke-opacity: 0.6;
    fill: none;
}

.link.highlighted {
    stroke: var(--accent-gold);
    stroke-opacity: 1;
    stroke-width: 2px;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}
