:root {
    --bg-main: #130F1E;
    --bg-panel: rgba(108, 92, 231, 0.05);
    --bg-panel-hover: rgba(108, 92, 231, 0.1);
    --border-color: rgba(108, 92, 231, 0.2);
    --primary: #6C5CE7;
    --secondary: #A29BFE;
    --accent: #FD79A8;
    --text-main: #FFFFFF;
    --text-muted: #A09DB0;
    --border-radius: 12px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 320px;
    background: rgba(19, 15, 30, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    z-index: 10;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

header p { color: var(--text-muted); font-size: 0.9rem; }

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem 1rem;
    text-align: center;
    background: var(--bg-panel);
    transition: var(--transition);
}
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--bg-panel-hover);
}
.upload-zone svg { color: var(--primary); margin-bottom: 0.5rem; }
.upload-text { margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-muted); }

.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #FFF; }
.btn-primary:hover { background: var(--secondary); }
.btn-secondary { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-panel-hover); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: rgba(108, 92, 231, 0.1); }

/* Filters */
.filters { display: flex; flex-direction: column; gap: 1rem; }
input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
}
input[type="text"]:focus { outline: none; border-color: var(--primary); }
.toggles { display: flex; flex-direction: column; gap: 0.5rem; }
.toggle-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: var(--text-muted); cursor: pointer;
}

/* Stats */
.stats-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.stat-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}
.stat-box:nth-child(3) { grid-column: span 2; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.text-accent { color: var(--accent) !important; }

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(108, 92, 231, 0.05) 0%, transparent 70%);
}
.tree-container {
    width: 100%;
    height: 100%;
    cursor: grab;
}
.tree-container:active { cursor: grabbing; }
.empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

/* SVG D3 Styles */
.node circle {
    fill: var(--bg-main);
    stroke: var(--primary);
    stroke-width: 2px;
    transition: var(--transition);
}
.node text {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    fill: var(--text-muted);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.node:hover circle { fill: var(--primary); transform: scale(1.2); }
.node:hover text { fill: var(--text-main); font-weight: 600; }
.node.recent circle { stroke: var(--secondary); fill: rgba(162, 155, 254, 0.2); }
.node.broken circle { stroke: var(--accent); fill: rgba(253, 121, 168, 0.2); }
.node.filtered-out { opacity: 0.1; }

.link {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 1.5px;
}

/* Details Panel */
.details-panel {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    background: rgba(19, 15, 30, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 20;
}
.close-btn {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer;
}
.close-btn:hover { color: var(--text-main); }
.details-panel h3 { font-size: 1rem; word-break: break-all; margin-bottom: 1rem; color: var(--primary); padding-right: 1.5rem; }
.dt-info { font-size: 0.9rem; margin-bottom: 0.5rem; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.25rem; }
.dt-info strong { color: var(--text-muted); font-weight: normal; }

/* Custom zoom controls */
.zoom-controls { position: absolute; top: 2rem; right: 2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.zoom-btn { background: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-main); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: var(--transition); }
.zoom-btn:hover { background: var(--primary); }
