:root {
    --bg-color: #050510;
    --text-color: #e0e0e0;
    --accent-color: #00ffff;
    --glass-bg: rgba(20, 20, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

#graph-container {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    /* Let clicks pass through to graph */
}

/* Enable pointer events for UI elements */
#search-container,
#info-panel {
    pointer-events: auto;
}

#search-container {
    position: absolute;
    top: 80px;
    left: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    /* Align items vertically */
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

#search-input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 16px;
    width: 200px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#search-input:focus {
    width: 300px;
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

#search-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

#search-btn:hover {
    transform: scale(1.05);
}

/* View Toggle Switch */
#view-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    background: var(--glass-bg);
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

#link-filters {
    display: flex;
    gap: 15px;
    margin-left: 10px;
    background: var(--glass-bg);
    padding: 5px 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    align-items: center;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.filter-option input {
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 500;
}


.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

#info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    bottom: 20px;
    width: 350px;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#info-panel.hidden {
    transform: translateX(120%);
}

#panel-title {
    margin-top: 0;
    color: var(--accent-color);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

#panel-content {
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    /* Preserve newlines from dictionary */
}

#close-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    left: auto;
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    pointer-events: none;
}

#legend-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: auto;
    min-width: 150px;
    pointer-events: auto;
    z-index: 10;
}

#legend-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 5px;
}

.legend-section {
    margin-bottom: 12px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section h4 {
    margin: 0 0 5px 0;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #ccc;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255,255,255,0.2);
}

.color-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 400px;
    text-align: center;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.modal-content h2 {
    color: var(--accent-color);
    margin-top: 0;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: #ff4444;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: transform 0.2s;
}

.btn-danger:hover {
    background: #cc0000;
    transform: scale(1.05);
}