.full-height {
    height: 100vh;
}

.full-height > * {
    /* Keep content within bounds */
}

[data-bs-theme="dark"] {
    --bs-primary: #8B0000;
}

:root, [data-bs-theme="light"] {
    --bs-primary: #8B0000;
    --bs-primary-rgb: 139, 0, 0;
}

.crt-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: 
        repeating-linear-gradient(to bottom, #8B0000 0%, #8B0000 1px, transparent 1px, transparent 2px);
    background-size: 100% 100%;
    z-index: -1;
    animation: move-line 10s linear infinite, crt-flicker 0.1s infinite;
}

@keyframes crt-flicker {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

@keyframes move-line {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

.animate-bg {
    position: relative;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #8B0000;
    --bs-btn-border-color: #8B0000;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #760000;
    --bs-btn-hover-border-color: #760000;
    --bs-btn-focus-shadow-rgb: 139, 0, 0;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #760000;
    --bs-btn-active-border-color: #760000;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #8B0000;
    --bs-btn-disabled-border-color: #8B0000;
}

/* Blazor error overlay — hidden by default, shown via inline style when Blazor sets display: block */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

#blazor-error-ui[style*="display"] {
    display: flex;
}

.chat-message {
    max-width: 75%;
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--bs-font-sans-serif);


    table {
        td, th{
            padding-left: 0.5rem;
            padding-right: 0.5rem;

            &:not(:last-child) {
                border-right: 1px solid;
            }
        }

        thead {
            tr:last-child {
                border-bottom: 1px solid;
            }
        }

        tbody {
            td {
                padding-top: 0.25rem;
                padding-bottom: 0.25rem;
                border-bottom: 1px solid #e9ecef50;
            }
        }
    }
}

.chat-message.user {
    margin-left: 5rem;
    background-color: #343a40;
    color: #f8f9fa;
    border-bottom-right-radius: 2px;
    font-size: 12px;
}

.chat-message.assistant {
    margin-right: 5rem;
    background-color: #2f3437;
    color: #e9ecef;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(130, 137, 145, 0.25);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.chat-content {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 10px;
    line-height: 1.2;
}

.chat-content p {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.chat-content ol,
.chat-content ul {
    line-height: 1;
    margin-bottom: 0.25rem;
}

.chat-content h1,
.chat-content h2,
.chat-content h3,
.chat-content h4,
.chat-content h5 {
    margin-bottom: 0;
}

.chat-content h1 {
    font-size: 20px;
    font-weight: 1000;
}

.chat-content h2 {
    font-size: 18px;
    font-weight: 850;
}

.chat-content h3 {
    font-size: 16px;
    font-weight: 700;
}

.chat-content h4 {
    font-size: 14px;
    font-weight: 550;
}

.chat-content h5 {
    font-size: 12px;
    font-weight: 500;
}

.thinking-block {
    margin-bottom: 0.75rem;
}

.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #adb5bd;
    cursor: pointer;
    user-select: none;
}

.thinking-toggle i {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.thinking-body {
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background-color: rgba(133, 143, 158, 0.1);
    border-left: 3px solid #adb5bd;
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #adb5bd;
    white-space: pre-wrap;
    word-break: break-word;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* Bounded flex containers so only #chat-window scrolls. basis 0 locks each
   item to the space left by its siblings, so nothing grows past the viewport. */
.layout-main {
    flex: 1 1 0;
    min-height: 0;
}

.home-panel {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
}

#chat-window {
    flex: 1 1 0;
    min-height: 0;
    font-size: 0.5rem;
}

/* Mobile: keep the send button clear of the browser's bottom chrome. */
@media (max-width: 767.98px) {
    .chat-input-area {
        margin-bottom: 6rem;
    }
}