:root {
    --logicum-side-chat-min-width: 380px;
    --logicum-side-chat-width: 380px;
}

/* Keep the divider and the main content in the same geometry while resizing. */
.side-chat-panel {
    width: var(--logicum-side-chat-width) !important;
    min-width: var(--logicum-side-chat-min-width) !important;
    max-width: max(var(--logicum-side-chat-min-width), 33.333vw) !important;
    overflow: visible !important;
}

.main-content.side-chat-open {
    margin-right: var(--logicum-side-chat-width) !important;
}

.side-chat-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -9px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    cursor: col-resize;
    touch-action: none;
}

.side-chat-resize-handle::before {
    content: "";
    display: block;
    width: 2px;
    height: 42px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-secondary) 38%, transparent);
    opacity: 0;
    transform: scaleY(0.82);
    transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.side-chat-resize-handle:hover::before,
.side-chat-resize-handle:focus-visible::before,
body.side-chat-resizing .side-chat-resize-handle::before {
    background: var(--accent-color, #7c6ef5);
    opacity: 0.82;
    transform: scaleY(1);
}

.side-chat-resize-handle:focus-visible {
    outline: none;
}

body.side-chat-resizing,
body.side-chat-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.side-chat-resizing .main-content.side-chat-open {
    transition: none !important;
}

body.light-mode .side-chat-resize-handle::before {
    background: color-mix(in srgb, var(--text-secondary) 45%, transparent);
}

body.light-mode .side-chat-resize-handle:hover::before,
body.light-mode .side-chat-resize-handle:focus-visible::before,
body.light-mode.side-chat-resizing .side-chat-resize-handle::before {
    background: var(--accent-color, #7c6ef5);
}

@media (max-width: 768px) {
    .side-chat-panel {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .main-content.side-chat-open {
        margin-right: 0 !important;
    }

    .side-chat-resize-handle {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .side-chat-resize-handle::before {
        transition: none !important;
    }
}
