@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Quicksand:wght@300;400;500;600;700&display=swap');

.theme-toggle {
    position: absolute;
    top: 30px;
    right: 30px;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.theme-toggle:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Light mode. */
:root.light-mode {
    --bg-color: #f8fafc;
    --sidebar-color: #e2e8f0;
    --accent-color: #0891b2;
    --highlight-color: #eab308;
    --text-color: #1e293b;
    --text-dark: #64748b;
    --danger-color: #dc2626;
    --surface-color: #e2e8f0;
    --glass-bg: rgba(226, 232, 240, 0.7);
}

/* Light mode: General. */
:root.light-mode .current-graph-container,
:root.light-mode .llm-response {
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Light mode: Sidebar. */
:root.light-mode .indicator-dot {
    background: rgba(0, 0, 0, 0.1);
}

:root.light-mode .indicator-dot.active {
    background: rgba(0, 0, 0, 0.4);
}

:root.light-mode .sidebar {
    background: radial-gradient(circle at top right, var(--sidebar-color), var(--bg-color));
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

:root.light-mode .sidebar-item {
    background-color: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

:root.light-mode .sidebar-thumbnail {
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

:root.light-mode .sidebar-item:hover,
:root.light-mode .sidebar-item.active {
    background-color: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.3);
}

:root.light-mode .current-subsidebar-container:not(:last-child)::after {
    background-color: #e0e0e0;
}

/* Light mode: Body. */
:root.light-mode body {
    background: radial-gradient(circle at top right, #e2e8f0, #f8fafc);
}

/* Light mode: Slider */
:root.light-mode .delay-slider {
    background: rgba(0, 0, 0, 0.2);
}

:root.light-mode .delay-input {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

:root.light-mode .delay-control {
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Light mode: Control section. */
:root.light-mode .controls button {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Light mode: Frame section. */
:root.light-mode .frame-counter {
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Dark mode. */
:root {
    --bg-color: #0f172a;
    --sidebar-color: #1e293b;
    --accent-color: #06b6d4;
    --highlight-color: #f1c232;
    --text-color: #e2e8f0;
    --text-dark: #475569;
    --danger-color: #ef4444;
    --surface-color: #1e293b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--surface-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Quicksand', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    background: radial-gradient(circle at top right, var(--sidebar-color), var(--bg-color));
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Dark mode: Sidebar Navigation. */
.sidebar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px;
}

.sidebar-navigation button {
    width: 45px;
    height: 45px;
    border: none;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
}

.sidebar-navigation button:hover {
    color: var(--accent-color);
}

.sidebar-indicator {
    display: flex;
    gap: 8px;
    align-items: center;
}

.indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.indicator-dot.active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.3);
}


/* Dark mode: Sidebar. */
.sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background-color: var(--sidebar-color);
    color: var(--text-color);
    background: radial-gradient(circle at top right, var(--sidebar-color), var(--bg-color));
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sidebar h2 {
    font-family: 'Space Mono', monospace;
    letter-spacing: 1px;
    font-weight: 700;
    position: relative;
}

.sidebar-item {
    padding: 15px;
    margin: 10px 0;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
}

.sidebar-item.active {
    background-color: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.sidebar-thumbnail {
    width: 100%;
    height: 120px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark mode: General. */
.main-content {
    flex: 1;
    padding: 30px;
    margin-left: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

h1 {
    font-family: 'Space Mono', monospace;
    color: var(--text-color);
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    font-size: 2.2rem;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--accent-color);
    vertical-align: super;
    margin-left: 5px;
}

.current-graph-container {
    width: 100%;
    height: 500px;
    min-height: 300px;
    background-color: rgba(255, 255, 255, 0.03);
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
}

.current-subgraph-container {
    flex: 1;
    min-height: 0;
    border: 1px solid #ccc;
}

.current-sidebar-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    padding: 8px;
    gap: 16px;
}

.current-subsidebar-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.current-subsidebar-container:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.05);
}

.llm-response {
    width: 100%;
    height: 120px;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-color);
    resize: vertical;
    font-family: 'Space Mono', monospace;
    line-height: 1.5;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-bottom: 20px;
}

/* Dark mode: Status. */
.status {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: var(--glass-bg);
    color: var(--text-color);
    font-weight: 500;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark mode: Controls. */
.controls {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--glass-bg);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.controls button {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls button:hover:not(:disabled) {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.controls button:disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-dark);
    cursor: not-allowed;
}

.controls button.danger {
    background-color: rgba(239, 68, 68, 0.2);
}

.controls button.danger:hover:not(:disabled) {
    background-color: var(--danger-color);
}

/* Dark mode: Slider. */
.delay-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.delay-slider {
    width: 100px;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    border-radius: 3px;
}

.delay-input {
    width: 60px;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    text-align: center;
    font-family: 'Space Mono', monospace;
}

/* Dark mode: Frame. */
.frame-counter {
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border-radius: 25px;
    padding: 8px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    text-align: center;
}

/* Responsive design */
@media (max-width: 992px) {
    body {
        flex-direction: column;
        overflow: auto;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: 300px;
    }

    .main-content {
        margin-left: 0;
        height: auto;
        min-height: calc(100vh - 300px);
    }

    .current-graph-container {
        height: 400px;
    }

    .controls {
        justify-content: center;
    }

    .delay-control {
        margin: 10px 0;
        width: 100%;
        justify-content: center;
    }
}

/* Mobile optimizations */
@media (max-width: 576px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .delay-control {
        margin: 10px 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .current-graph-container {
        height: 300px;
    }

    .main-content {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* Animation for transitions in the display. */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.graph-fade {
    animation: fadeIn 0.5s ease-out;
}

/* Animation for transitions in the sidebar. */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-item-new {
    animation: fadeSlideIn 0.5s ease-out forwards;
}

@keyframes fadeSlideOut {
    from {
        opacity: 1;
        transform: translateX(0px);
    }

    to {
        opacity: 0;
        transform: translateX(-15px);
    }
}

.sidebar-item-remove {
    animation: fadeSlideOut 0.5s ease-out forwards;
}