:root {
    /* Royal Purple Palette */
    --bg-base: #0F0A1A;
    --bg-surface: rgba(26, 15, 46, 0.7);
    --bg-surface-solid: #1a0f2e;
    --bg-hover: rgba(108, 92, 231, 0.15);

    --border-light: rgba(108, 92, 231, 0.3);
    --border-subtle: rgba(255, 255, 255, 0.05);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #6C5CE7;
    --primary-hover: #5a4bcf;
    --secondary: #A29BFE;
    --accent: #81ECEC;

    --success: #00b894;
    --error: #d63031;
    --warning: #fdcb6e;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 12px;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glassmorphism */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
}

/* Typography Utils */
.text-sm {
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--secondary);
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.font-bold {
    font-weight: 700;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mono {
    font-family: var(--font-code);
}

.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

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

/* Header */
.app-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.logo strong {
    font-weight: 700;
    color: #FFF;
}

.logo svg {
    color: var(--accent);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.btn-outline:not(:disabled):hover {
    background: var(--bg-hover);
    border-color: var(--secondary);
}

.btn-success {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, 0.4);
}

.btn-success:not(:disabled):hover {
    background: rgba(0, 184, 148, 0.25);
    border-color: var(--success);
}

.btn-error {
    background: rgba(214, 48, 49, 0.15);
    color: var(--error);
    border: 1px solid rgba(214, 48, 49, 0.4);
}

.btn-error:not(:disabled):hover {
    background: rgba(214, 48, 49, 0.25);
    border-color: var(--error);
}

.btn-danger {
    background: var(--error);
    color: #FFF;
}

.btn-danger:not(:disabled):hover {
    opacity: 0.9;
}

.btn-accent {
    background: var(--accent);
    color: #000;
    box-shadow: 0 4px 12px rgba(129, 236, 236, 0.3);
}

.btn-accent:not(:disabled):hover {
    filter: brightness(1.1);
}

/* Workspace Layout */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 1.5rem;
    gap: 1.5rem;
    background:
        radial-gradient(circle at 50% 10%, rgba(108, 92, 231, 0.05) 0%, transparent 60%);
}

/* Panes */
.pane {
    display: flex;
    flex-direction: column;
}

.timeline-pane {
    flex: 1.8;
    min-width: 0;
    gap: 1rem;
    position: relative;
}

.side-pane {
    flex: 1;
    min-width: 320px;
    max-width: 400px;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow-y: auto;
}

/* Banner */
.status-banner {
    padding: 1.5rem 2rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #FFF;
    margin-bottom: 0.25rem;
}

.status-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-box .val {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-code);
    line-height: 1;
}

.stat-box .lbl {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Grid Visualization */
.commit-grid-wrapper {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 2rem;
    overflow-y: auto;
    border: 1px solid #1a0f2e;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.commit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    max-width: 100%;
}

/* Individual Commit Cell */
.commit-node {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-code);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s;
    position: relative;
    cursor: default;
}

/* States */
.commit-node.state-eliminated {
    opacity: 0.15;
    transform: scale(0.9);
    border-color: transparent;
}

.commit-node.state-candidate {
    background: rgba(108, 92, 231, 0.1);
    border-color: rgba(108, 92, 231, 0.5);
    color: #FFF;
}

.commit-node.state-testing {
    background: var(--primary);
    color: #FFF;
    border-color: var(--accent);
    transform: scale(1.2);
    z-index: 5;
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.8);
}

.commit-node.state-good {
    background: rgba(0, 184, 148, 0.8) !important;
    color: #000 !important;
    border-color: var(--success) !important;
    opacity: 1 !important;
}

.commit-node.state-bad {
    background: rgba(214, 48, 49, 0.8) !important;
    color: #FFF !important;
    border-color: var(--error) !important;
    opacity: 1 !important;
}

.commit-node.state-bug {
    background: var(--error) !important;
    color: #FFF !important;
    border-color: #fff !important;
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(214, 48, 49, 1) !important;
    opacity: 1 !important;
    z-index: 10;
}

/* Animation */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(108, 92, 231, 1);
    }

    100% {
        box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
    }
}

.commit-node.state-testing {
    animation: pulseGlow 2s infinite ease-in-out;
}

/* Action Dock Overlay */
.action-dock {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1.5rem 2rem;
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    z-index: 20;
}

.active-commit-info {
    font-size: 1.1rem;
}

.active-commit-info strong {
    color: var(--accent);
    font-size: 1.3rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.divider {
    width: 1px;
    height: 30px;
    background: var(--border-light);
    margin: 0 0.5rem;
}

/* Side Pane Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #FFF;
}

/* Range Slider */
.slider-theme {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    margin-top: 0.5rem;
}

.slider-theme::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid var(--bg-surface-solid);
    box-shadow: 0 0 10px rgba(129, 236, 236, 0.4);
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-info {
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid var(--border-light);
    color: var(--secondary);
}

/* Logs View */
.badge {
    background: rgba(108, 92, 231, 0.2);
    color: var(--secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.log-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.5rem;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}

.log-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.log-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--text-muted);
    font-size: 0.85rem;
}

.log-item.log-bisecting {
    border-left-color: var(--primary);
}

.log-item.log-good {
    border-left-color: var(--success);
}

.log-item.log-bad {
    border-left-color: var(--error);
}

.log-item.log-found {
    border-left-color: var(--accent);
    background: rgba(129, 236, 236, 0.1);
    color: #FFF;
    font-weight: 600;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bar-lbl {
    width: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.bar-track {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.bg-error {
    background: var(--error);
}

.bar-val {
    width: 30px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
}

@media (max-width: 900px) {
    .workspace {
        flex-direction: column;
        overflow-y: auto;
    }

    .side-pane {
        max-width: 100%;
        flex: none;
        height: auto;
    }

    .timeline-pane {
        min-height: 50vh;
    }
}