:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #6366f1;
    /* Indigo */
    --accent-glow: rgba(99, 102, 241, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 20%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

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

/* Glassmorphism Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand i,
.brand svg {
    color: var(--accent);
}

.github-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-left: auto;
    /* Push to right if desirable, or just small margin */
}

.github-link:hover {
    color: var(--text-primary);
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px var(--accent-glow));
}

.github-link i,
.github-link svg {
    width: 20px;
    height: 20px;
    color: inherit;
    /* Override the specific .brand i color rule above */
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
}

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

.tab-content.hidden {
    display: none;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
}

/* Inputs */
textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    gap: 0.5rem;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 1rem;
}

.search-box i {
    color: var(--text-secondary);
    width: 18px;
}

/* Buttons */
.primary-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    width: 100%;
}

.primary-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

.secondary-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    width: 120px;
    white-space: nowrap;
}

.secondary-btn:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Toggle */
.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.toggle input {
    display: none;
}

.slider {
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

input:checked+.slider {
    background: var(--accent);
}

input:checked+.slider::before {
    transform: translateX(16px);
}

/* Mini Toggle for Overlay */
.mini-toggle {
    font-size: 0.75rem;
    gap: 0.35rem;
}

.mini-toggle .slider {
    width: 28px;
    height: 16px;
}

.mini-toggle .slider::before {
    width: 12px;
    height: 12px;
}

.mini-toggle input:checked+.slider::before {
    transform: translateX(12px);
}

/* Status & Results */
.status-msg {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.status-msg.success {
    color: var(--success);
}

.status-msg.error {
    color: var(--danger);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid var(--glass-border);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    background: linear-gradient(90deg, var(--accent), #818cf8);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.indeterminate {
    width: 40%;
    animation: indeterminate 1.5s infinite linear;
}


@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(250%);
    }
}

.results-area {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    min-height: 200px;
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    margin-top: 3rem;
    font-style: italic;
}

.result-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--accent);
}

.result-relation {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.result-text {
    line-height: 1.4;
}



/* Main Content */
.main-content {
    flex: 1;
    position: relative;
}

#network-container {
    width: 100%;
    height: 100%;
}

.overlay-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: var(--glass-bg);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* New Answer Box */
.answer-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #f8fafc;
    line-height: 1.5;
}

/* View Switcher (Segmented Control) */
.view-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.view-switcher input {
    display: none;
}

.view-switcher label {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
}

.view-switcher label:hover {
    color: var(--text-primary);
}

.view-switcher input:checked+label {
    background: var(--accent);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Control Groups (Settings) */
.control-group {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-row label {
    font-size: 0.9rem;
    font-weight: 600;
}

.label-row span {
    font-size: 0.8rem;
    color: var(--accent);
    font-family: monospace;
}

.toggle-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* Premium Range Input */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}


input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.1s;
}


input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 400px;
    padding: 2rem;
}

.loading-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loading-content p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.spin {
    color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loading-dots {
    font-size: 2rem;
    color: var(--accent);
}

.loading-dots span {
    animation: dots 1.5s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dots {

    0%,
    20% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

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