:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-highlight: #ffffff;

    --accent-warning: #d2a8ff;
    /* Soft Purple */
    --accent-severe: #ff7b72;
    /* Alert Red */
    --accent-safe: #56d364;
    /* Shield Green */
    --accent-neutral: #58a6ff;
    /* Info Blue */
    --accent-hover: rgba(255, 255, 255, 0.05);

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    color: var(--text-highlight);
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header & Nav */
.app-header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.branding {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-neutral);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.app-header h1 {
    font-size: 2.5rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.app-nav {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.35rem;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    color: var(--text-highlight);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: rgba(40, 48, 60, 0.8);
    border: 1px solid var(--panel-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: var(--text-highlight);
    font-weight: 600;
}

/* Main View Logic */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- View 1: Impact Map --- */
#view-map {
    position: relative;
    display: flex;
    gap: 2rem;
    min-height: 600px;
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#interactive-map {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16/9;
}

#interactive-map svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.state-path {
    fill: #21262d;
    stroke: var(--panel-border);
    stroke-width: 1;
    transition: all 0.3s ease;
    cursor: pointer;
}

.state-path:hover {
    fill: #30363d;
    stroke: var(--text-secondary);
}

/* Map Data States */
.state-severe {
    fill: rgba(255, 123, 114, 0.2);
    stroke: var(--accent-severe);
}

.state-severe:hover {
    fill: rgba(255, 123, 114, 0.4);
}

.state-shield {
    fill: rgba(86, 211, 100, 0.15);
    stroke: var(--accent-safe);
}

.state-shield:hover {
    fill: rgba(86, 211, 100, 0.3);
}

.state-warning {
    fill: rgba(210, 168, 255, 0.2);
    stroke: var(--accent-warning);
}

.state-warning:hover {
    fill: rgba(210, 168, 255, 0.4);
}


.map-legend {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.color-box.severe-ban {
    background: var(--accent-severe);
}

.color-box.shield-law {
    border: 1px solid var(--accent-safe);
    background: rgba(86, 211, 100, 0.2);
}

#state-panel {
    width: 350px;
    padding: 2rem;
    position: relative;
    height: fit-content;
}

#state-panel.hidden {
    display: none;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-highlight);
}

#panel-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.panel-section {
    margin-top: 1.5rem;
}

.panel-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.panel-section p {
    font-size: 0.95rem;
    color: var(--text-primary);
}


/* --- View 2: Surrogate Dashboard --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.metric-card {
    padding: 2rem 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.metric-value {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
}

/* Card Specific Coloring */
.metric-card.critical .metric-value {
    color: var(--accent-severe);
}

.metric-card.warning .metric-value {
    color: var(--accent-warning);
}

.metric-card.alert .metric-value {
    color: #ffab70;
}

.metric-card.severe .metric-value {
    color: #f0883e;
}


.metric-context {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dashboard-chart {
    padding: 2.5rem;
}

.dashboard-chart h3 {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1rem;
}

/* Simple Timeline implementation */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    padding-left: 20px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--panel-border);
}

.timeline-item {
    position: relative;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid transparent;
    margin-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--text-secondary);
}

.timeline-item.collapse::before {
    border-color: var(--accent-severe);
}

.timeline-item.innovation::before {
    border-color: var(--accent-safe);
}

.timeline-item.collapse {
    border-left: 3px solid var(--accent-severe);
}

.timeline-item.innovation {
    border-left: 3px solid var(--accent-safe);
}

.timeline-item .year {
    position: absolute;
    top: -12px;
    left: 1rem;
    background: var(--bg-color);
    padding: 0 0.5rem;
    font-size: 0.8rem;
    color: var(--accent-neutral);
    font-weight: bold;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
}

.timeline-content h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* --- View 3: Defensive Playbook --- */
.playbook-header {
    margin-bottom: 2rem;
}

.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-item {
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-highlight);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    text-align: left;
    transition: background 0.3s ease;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.accordion-header .icon {
    font-size: 1.5rem;
    color: var(--accent-neutral);
    transition: transform 0.3s ease;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 1.5rem;
}

.accordion-item.open .accordion-content {
    max-height: 500px;
    /* Arbitrary large number */
    padding-bottom: 1.5rem;
}

.accordion-item.open .accordion-header .icon {
    transform: rotate(45deg);
}

.accordion-content p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.accordion-content p:last-child {
    margin-bottom: 0;
}

.accordion-content strong {
    color: var(--accent-neutral);
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--panel-border);
}