:root {
    /* Neon Cyan Dark Palette */
    --primary: #00CEC9;
    --primary-hover: #00b5b1;
    --secondary: #81ECEC;
    --accent: #E17055;
    --bg-dark: #0A1A1A;
    --bg-panel: #112A2A;
    --bg-input: #081414;
    --border: #1C4040;
    --border-focus: #00CEC9;

    --text-main: #F3F4F6;
    --text-muted: #8DBFBF;

    --error: #FF7675;
    --success: #55E6C1;
    --info: #74B9FF;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 200ms ease;

    /* Graph Node Colors */
    --node-service: #00CEC9;
    --node-network: #81ECEC;
    --node-volume: #E17055;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    /* Glassmorphism ambient glow */
    background-image:
        radial-gradient(circle at 10% 10%, rgba(0, 206, 201, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(225, 112, 85, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--bg-dark);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(0, 206, 201, 0.2);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.app-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-right: auto;
}

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

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

/* Editor */
.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

textarea {
    background: var(--bg-input);
    border: none;
    color: var(--secondary);
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    width: 100%;
    flex: 1;
    resize: none;
    outline: none;
}

textarea:focus {
    box-shadow: inset 0 0 0 1px var(--border-focus);
}

textarea::placeholder {
    color: rgba(141, 191, 191, 0.3);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.success {
    background: rgba(85, 230, 193, 0.1);
    color: var(--success);
    border: 1px solid rgba(85, 230, 193, 0.3);
}

.badge.error {
    background: rgba(255, 118, 117, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 118, 117, 0.3);
}

/* Visualization Controls */
.viz-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.toggle-control input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.toggle-control:hover .control-label {
    color: var(--text-main);
}

/* Network Canvas */
.viz-panel {
    position: relative;
}

.network-container {
    flex: 1;
    min-height: 300px;
    background: var(--bg-input);
    outline: none;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

/* Detail Sidebar */
.detail-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: rgba(17, 42, 42, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    transform: translateX(0);
    transition: transform var(--transition);
    z-index: 20;
}

.detail-sidebar.hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-content {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.detail-list li {
    font-size: 0.85rem;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Buttons */
.btn {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn.primary {
    background: var(--primary);
    color: var(--bg-dark);
}

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 10px rgba(0, 206, 201, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
}

.btn.outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    height: 32px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}

.icon-btn:hover {
    color: var(--primary);
    background: rgba(0, 206, 201, 0.1);
    border-color: rgba(0, 206, 201, 0.2);
}

.icon-btn.sm {
    width: 28px;
    height: 28px;
}

/* Utils */
.hidden {
    display: none !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--success);
    color: var(--bg-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(85, 230, 193, 0.3);
    z-index: 100;
    transition: all 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.toast.error {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.3);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Overrides for vis-network tooltip */
div.vis-tooltip {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .app-container {
        height: auto;
        display: block;
    }

    .editor-panel {
        margin-bottom: 1.5rem;
        max-height: 400px;
    }

    .viz-panel {
        min-height: 600px;
    }
}