:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    
    /* Chart Colors */
    --color-running: #10b981;
    --color-pending: #f59e0b;
    --color-succeeded: #94a3b8;
    --color-failed: #ef4444;
    --color-unused: rgba(148, 163, 184, 0.2);
    --color-node: rgba(30, 41, 59, 0.9);

    --gradient-1: rgba(59, 130, 246, 0.15);
    --gradient-2: rgba(139, 92, 246, 0.15);
}

/* Neon Theme */
:root[data-theme="neon"] {
    --bg-color: #000000;
    --text-main: #00ff00;
    --text-muted: #008800;
    --accent: #ff00ff;
    --accent-hover: #ff66ff;
    --glass-bg: rgba(0, 20, 0, 0.8);
    --glass-border: rgba(0, 255, 0, 0.5);
    
    --color-running: #00ff00;
    --color-pending: #ffff00;
    --color-succeeded: #00ffff;
    --color-failed: #ff0000;
    --color-unused: rgba(0, 255, 0, 0.2);
    --color-node: rgba(20, 20, 20, 0.9);
    
    --gradient-1: rgba(0, 255, 0, 0.2);
    --gradient-2: rgba(255, 0, 255, 0.2);
}

/* Light Theme */
:root[data-theme="light"] {
    --bg-color: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.12);
    
    --color-running: #059669;
    --color-pending: #d97706;
    --color-succeeded: #64748b;
    --color-failed: #dc2626;
    --color-unused: rgba(100, 116, 139, 0.2);
    --color-node: rgba(241, 245, 249, 0.9);
    
    --gradient-1: rgba(37, 99, 235, 0.1);
    --gradient-2: rgba(147, 51, 234, 0.1);
}

/* Gray Theme */
:root[data-theme="gray"] {
    --bg-color: #4b5563;
    --text-main: #f9fafb;
    --text-muted: #d1d5db;
    --accent: #9ca3af;
    --accent-hover: #d1d5db;
    --glass-bg: rgba(55, 65, 81, 0.75);
    --glass-border: rgba(255, 255, 255, 0.2);
    
    --color-running: #6ee7b7;
    --color-pending: #fcd34d;
    --color-succeeded: #e5e7eb;
    --color-failed: #fca5a5;
    --color-unused: rgba(209, 213, 219, 0.2);
    --color-node: rgba(55, 65, 81, 0.9);
    
    --gradient-1: rgba(156, 163, 175, 0.2);
    --gradient-2: rgba(209, 213, 219, 0.2);
}

/* Black and White Theme */
:root[data-theme="bw"] {
    --bg-color: #ffffff;
    --text-main: #000000;
    --text-muted: #333333;
    --accent: #000000;
    --accent-hover: #555555;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.3);
    
    --color-running: #666666;
    --color-pending: #999999;
    --color-succeeded: #cccccc;
    --color-failed: #000000;
    --color-unused: rgba(0, 0, 0, 0.1);
    --color-node: rgba(240, 240, 240, 0.9);
    
    --gradient-1: rgba(0, 0, 0, 0.05);
    --gradient-2: rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, var(--gradient-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--gradient-2) 0px, transparent 50%);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.25rem;
    gap: 1rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.75rem;
    z-index: 20;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent);
}

.logo-icon {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-3d {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 0.375rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    display: flex;
    align-items: center;
}

.search-input {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease;
    width: 220px;
}

.search-input:focus {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.toggle-container {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.theme-selector {
    display: flex;
    align-items: center;
}

.theme-select {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease;
}

.theme-select:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
}

.theme-select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
}

.icon-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
    border-color: var(--accent);
}

.main-content {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 1rem;
    overflow: hidden;
}

.loading {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    z-index: 30;
    transition: opacity 0.3s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.chart-container {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.chart-container:active {
    cursor: grabbing;
}

.navigation-hint {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 10;
}

.navigation-hint kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    padding: 0.1rem 0.35rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
}

.legend-panel {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem 1.1rem;
    font-size: 0.775rem;
    z-index: 10;
    pointer-events: none;
}

.version-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    z-index: 10;
    pointer-events: none;
    letter-spacing: 0.05em;
}

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

.legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
}

.legend-dot.running { background-color: var(--color-running); box-shadow: 0 0 6px var(--color-running); }
.legend-dot.pending { background-color: var(--color-pending); box-shadow: 0 0 6px var(--color-pending); }
.legend-dot.succeeded { background-color: var(--color-succeeded); box-shadow: 0 0 6px var(--color-succeeded); }
.legend-dot.failed { background-color: var(--color-failed); box-shadow: 0 0 6px var(--color-failed); }
.legend-dot.unused { background-color: #64748b; opacity: 0.5; }

.legend-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.25rem 0;
}

.legend-note {
    font-size: 0.725rem;
    color: var(--accent);
}

.tooltip {
    position: absolute;
    padding: 1rem;
    pointer-events: none;
    z-index: 100;
    font-size: 0.85rem;
    transition: opacity 0.2s ease, transform 0.1s ease;
    min-width: 250px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.tooltip.hidden {
    opacity: 0;
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    word-break: break-all;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    gap: 1rem;
}

.tooltip-label {
    color: var(--text-muted);
}

.tooltip-value {
    font-weight: 600;
    color: var(--text-main);
}

body.ui-hidden .header,
body.ui-hidden .legend-panel,
body.ui-hidden .navigation-hint,
body.ui-hidden .version-overlay {
    opacity: 0;
    pointer-events: none;
}

.header, .legend-panel, .navigation-hint, .version-overlay {
    transition: opacity 0.3s ease;
}
