@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(22, 30, 46, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --accent-teal: #10b981;
    --accent-amber: #f59e0b;
    --accent-cyan: #06b6d4;
    --accent-rose: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #34d399 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    height: calc(100vh - 80px);
}

.panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.section-group {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.section-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-row label {
    font-size: 0.825rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.input-row label span.val {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-main);
    font-weight: 500;
}

input[type="range"] {
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    cursor: pointer;
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.canvas-container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.775rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #070a12;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn, .primary-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.8rem 1.8rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45), 0 0 15px rgba(16, 185, 129, 0.2);
}

.btn:hover, .primary-btn:hover {
    transform: translateY(-2px) scale(1.03);
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.6), 0 0 25px rgba(52, 211, 153, 0.4);
}

.btn:active, .primary-btn:active {
    transform: translateY(1px) scale(0.98);
}

.summary-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
}

/* Loading Overlay and Spinner Styles for P2D Simulation */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(16, 185, 129, 0.15);
    border-top-color: #10b981;
    border-right-color: #34d399;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-bottom: 1.2rem;
}

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

.loading-text {
    color: #f8fafc;
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    animation: pulseText 1.5s ease-in-out infinite;
}

.loading-subtext {
    color: #94a3b8;
    font-size: 0.825rem;
    margin-top: 0.4rem;
}

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

/* All-in-One Scrollable Dashboard Card Styles */
.dashboard-card {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
}

.card-body {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.plot-card-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.interactive-canvas {
    width: 100%;
    height: 320px;
    background: #070a12;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: block;
}
