/* Treaty Intelligence Dashboard - Dark Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-card-hover: #222233;
    --bg-input: #1e1e2e;
    --border: #2a2a3a;
    --border-hover: #3a3a5a;
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555570;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-dim: rgba(99, 102, 241, 0.15);
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.15);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.15);
    --cyan: #06b6d4;
    --purple: #a855f7;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
}

.search-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13px;
    width: 280px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box:focus { border-color: var(--accent); }

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.tab:hover { color: var(--text-secondary); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Main content */
.main { padding: 24px 32px; max-width: 1400px; margin: 0 auto; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-art { background: var(--accent-dim); color: var(--accent); }
.badge-epd { background: var(--green-dim); color: var(--green); }
.badge-strategic { background: var(--amber-dim); color: var(--amber); }
.badge-framework { background: var(--blue-dim); color: var(--blue); }

.badge-hardest { background: var(--red-dim); color: var(--red); }
.badge-hard { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.badge-medium { background: var(--amber-dim); color: var(--amber); }
.badge-soft-hard { background: var(--blue-dim); color: var(--blue); }
.badge-soft { background: var(--green-dim); color: var(--green); }
.badge-na { background: rgba(100,100,100,0.15); color: #888; }

.badge-strong { background: var(--red-dim); color: var(--red); }
.badge-aspirational { background: var(--amber-dim); color: var(--amber); }
.badge-weak { background: var(--green-dim); color: var(--green); }
.badge-none { background: rgba(100,100,100,0.1); color: #666; }

/* Info rows in cards */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { font-weight: 500; text-align: right; max-width: 60%; }

/* Feature dots */
.features {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    title: attr(data-tooltip);
}

.feature-dot.off { background: var(--border); }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 16px 0;
}

.data-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 60px;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}

.data-table tr:hover td { background: var(--bg-card-hover); }

/* Charts container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Bar chart (CSS-based) */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    width: 140px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: fit-content;
}

/* Spectrum */
.spectrum {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.spectrum-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
}

.spectrum-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.spectrum-country {
    width: 160px;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.spectrum-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.spectrum-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.spectrum-detail {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 400px;
}

.spectrum-icons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

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

.icon-badge.active {
    background: var(--accent-dim);
    color: var(--accent);
}

/* Prediction card */
.prediction-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
}

.prediction-card h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--accent);
}

.prediction-text {
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.prediction-section {
    margin: 12px 0;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.prediction-section h4 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.prediction-section p, .prediction-section li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.prediction-section ul { padding-left: 18px; }

/* Topic selector */
.topic-selector {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    max-width: 500px;
    outline: none;
    cursor: pointer;
    margin-bottom: 20px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.topic-selector option { background: var(--bg-card); }

/* Detail modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
    overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

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

/* Feature matrix */
.feature-matrix {
    overflow-x: auto;
    margin: 16px 0;
}

.feature-matrix table { font-size: 12px; }
.feature-matrix th { font-size: 10px; padding: 6px 8px; }
.feature-matrix td { padding: 6px 8px; text-align: center; }

.dot-yes {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}

.dot-no {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
}

/* Section title */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .main { padding: 16px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .cards-grid { grid-template-columns: 1fr; }
    .header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .search-box { width: 100%; }
    .tabs { padding: 0 16px; }
}
