:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary-color: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.5);
    --accent-color: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --node-bg: rgba(15, 23, 42, 0.8);
    --resource-color: #eab308;
    --resource-glow: rgba(234, 179, 8, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    overflow: hidden;
}

.app-container {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 15px var(--primary-glow);
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.system-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.parameter-control label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.parameter-control input[type="range"] {
    width: 200px;
    accent-color: var(--primary-color);
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.1);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: rgba(234, 179, 8, 0.15);
    color: var(--resource-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Global Pool Visualizer */
.pool-visualizer {
    flex: 1;
    position: relative;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 12px;
    overflow-y: auto;
}

.resource-bubble {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #fde047, var(--resource-color));
    border-radius: 50%;
    box-shadow: 0 0 15px var(--resource-glow), inset -2px -2px 6px rgba(0,0,0,0.3);
    animation: float 3s ease-in-out infinite alternate;
    position: relative;
    cursor: default;
    transition: all 0.3s ease;
    z-index: 10;
}

.resource-bubble::after {
    content: 'Idle';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--resource-color);
    opacity: 0;
    transition: opacity 0.2s;
}

.resource-bubble:hover::after {
    opacity: 1;
}

@keyframes float {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-8px) scale(1.05); }
}

/* Nodes Container */
.nodes-container {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    overflow-y: auto;
    position: relative;
}

.impact-node {
    background: var(--node-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.impact-node:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 5px 20px rgba(56, 189, 248, 0.2);
}

.node-icon {
    font-size: 2rem;
    color: var(--text-muted);
    transition: color 0.4s;
}

.impact-node.high-impact .node-icon {
    color: var(--primary-color);
    text-shadow: 0 0 15px var(--primary-glow);
}

.node-name {
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
}

.node-needs {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.node-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.node-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Animations for transferring resources */
.resource-transferring {
    position: fixed;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 20px #fff, 0 0 40px var(--primary-glow);
    z-index: 100;
    pointer-events: none;
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Footer / Logs */
.console-panel {
    height: 180px;
    display: flex;
    flex-direction: column;
}

.console-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(0,0,0,0.2);
}

.console-header h3 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--primary-color);
}

.console-logs {
    flex: 1;
    padding: 15px 20px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    color: var(--text-muted);
    animation: fadeIn 0.3s ease;
}

.log-entry.system { color: var(--primary-color); }
.log-entry.transfer { color: var(--accent-color); }
.log-entry.alert { color: var(--resource-color); }

.log-entry .timestamp {
    color: #64748b;
    margin-right: 10px;
}

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

/* Buttons and Controls */
.action-btn {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: var(--primary-color);
    color: #0f172a;
    box-shadow: 0 0 15px var(--primary-glow);
}

.auto-distribute-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Custom Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border: 1px solid var(--panel-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .4s;
}

input:checked + .slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Scrollbar customized */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}
