/* Scoped terminal live-chat widget — do not style site-wide elements */
.terminal-chat {
    --tc-bg: #0a0a0a;
    --tc-panel: #0d1110;
    --tc-green: #00ff41;
    --tc-green-dim: #00cc33;
    --tc-green-dark: #008f11;
    --tc-green-glow: rgba(0, 255, 65, 0.45);
    --tc-red: #ff3333;
    --tc-amber: #ffb000;
    --tc-scanline: rgba(0, 0, 0, 0.12);

    background: var(--tc-panel);
    color: var(--tc-green);
    font-family: "Courier New", "Lucida Console", Consolas, monospace;
    font-size: 13px;
    line-height: 1.25;
    min-height: 0;
    box-shadow:
        0 0 20px var(--tc-green-glow),
        inset 0 0 40px rgba(0, 255, 65, 0.03);
}

.terminal-chat .titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 255, 65, 0.06);
    border-bottom: 1px solid var(--tc-green-dark);
    user-select: none;
}

.terminal-chat .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--tc-green-dark);
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.terminal-chat .dot.red {
    background: #ff3333;
    border-color: #ff3333;
}

.terminal-chat .dot.green {
    background: #00ff41;
    border-color: #00ff41;
}

.terminal-chat .dot.green.is-active {
    opacity: 1;
    box-shadow: 0 0 10px var(--tc-green-glow);
    animation: terminal-chat-status-blink 1s step-end infinite;
}

.terminal-chat .dot.red.is-active {
    opacity: 1;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.55);
    animation: terminal-chat-status-blink 1s step-end infinite;
}

.terminal-chat .dot.is-dim {
    opacity: 0.28;
    box-shadow: none;
    animation: none;
}

@keyframes terminal-chat-status-blink {
    50% {
        opacity: 0.25;
    }
}

.terminal-chat .connecting-state {
    display: block;
    width: 100%;
    padding: 0.35rem 0;
    text-align: left;
}

.terminal-chat .connecting-label {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
    white-space: normal;
    color: var(--tc-green);
    text-shadow: 0 0 6px var(--tc-green-glow);
    line-height: 1.25;
}

.terminal-chat .connecting-dots {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    vertical-align: bottom;
    animation: terminal-chat-connecting-dots 2s steps(11, end) infinite;
}

.terminal-chat .connecting-dots::before {
    content: "..........";
}

@keyframes terminal-chat-connecting-dots {
    to {
        width: 10ch;
    }
}

.terminal-chat .titlebar-text {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--tc-green-dim);
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.terminal-chat .titlebar-close {
    display: inline-flex;
    height: 1.75rem;
    width: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    color: var(--tc-green-dim);
    font-size: 1.1rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.terminal-chat .titlebar-close:hover {
    background: rgba(255, 51, 51, 0.2);
    color: var(--tc-red);
}

.terminal-chat .screen {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 0.75rem 0.85rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.terminal-chat .screen::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        var(--tc-scanline) 0px,
        var(--tc-scanline) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.35;
    z-index: 0;
}

.terminal-chat .screen > * {
    position: relative;
    z-index: 1;
}

.terminal-chat .screen::-webkit-scrollbar,
.terminal-chat .terminal-chat-screen::-webkit-scrollbar {
    width: 8px;
}

.terminal-chat .screen::-webkit-scrollbar-track,
.terminal-chat .terminal-chat-screen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.35);
}

.terminal-chat .screen::-webkit-scrollbar-thumb,
.terminal-chat .terminal-chat-screen::-webkit-scrollbar-thumb {
    background: var(--tc-green-dark);
    border-radius: 3px;
    border: 1px solid rgba(0, 255, 65, 0.25);
}

.terminal-chat .screen::-webkit-scrollbar-thumb:hover,
.terminal-chat .terminal-chat-screen::-webkit-scrollbar-thumb:hover {
    background: var(--tc-green-dim);
}

.terminal-chat .screen,
.terminal-chat .terminal-chat-screen {
    scrollbar-width: thin;
    scrollbar-color: var(--tc-green-dark) rgba(0, 0, 0, 0.35);
}

.terminal-chat .line {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow: 0 0 6px var(--tc-green-glow);
    margin: 0 0 0.15rem;
    line-height: 1.25;
    padding: 0;
}

.terminal-chat .line.dim {
    color: var(--tc-green-dark);
    text-shadow: none;
}

.terminal-chat .line.bright {
    color: var(--tc-green);
}

.terminal-chat .line.error {
    color: var(--tc-red);
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.5);
}

.terminal-chat .line.warn {
    color: var(--tc-amber);
    text-shadow: 0 0 6px rgba(255, 176, 0, 0.4);
}

.terminal-chat .line.success {
    color: var(--tc-green);
}

.terminal-chat .prechat-status {
    margin-bottom: 0.55rem;
}

.terminal-chat .prechat-form {
    margin-top: 0.15rem;
}

.terminal-chat .field {
    margin-bottom: 0.4rem;
}

.terminal-chat .field label {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--tc-green-dark);
    text-transform: uppercase;
}

.terminal-chat .field input,
.terminal-chat .field textarea {
    display: block;
    width: 100%;
    border: 1px solid var(--tc-green-dark);
    border-radius: 0.25rem;
    background-color: #0a0a0a !important;
    background-image: none !important;
    color: var(--tc-green) !important;
    -webkit-text-fill-color: var(--tc-green);
    font: inherit;
    font-size: 12px;
    padding: 0.35rem 0.5rem;
    box-shadow: inset 0 0 12px rgba(0, 255, 65, 0.04);
    outline: none;
    caret-color: var(--tc-green);
    color-scheme: dark;
}

.terminal-chat .field input::placeholder,
.terminal-chat .field textarea::placeholder {
    color: var(--tc-green-dark);
    -webkit-text-fill-color: var(--tc-green-dark);
    opacity: 0.8;
}

.terminal-chat .field input:focus,
.terminal-chat .field textarea:focus {
    border-color: var(--tc-green-dim);
    background-color: #0a0a0a !important;
    box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.25);
}

.terminal-chat .field input:-webkit-autofill,
.terminal-chat .field input:-webkit-autofill:hover,
.terminal-chat .field input:-webkit-autofill:focus,
.terminal-chat .field input:-webkit-autofill:active,
.terminal-chat .field textarea:-webkit-autofill,
.terminal-chat .field textarea:-webkit-autofill:hover,
.terminal-chat .field textarea:-webkit-autofill:focus,
.terminal-chat .field textarea:-webkit-autofill:active {
    -webkit-text-fill-color: var(--tc-green) !important;
    caret-color: var(--tc-green);
    box-shadow: 0 0 0 1000px #0a0a0a inset !important;
    transition: background-color 99999s ease-out 0s;
}

.terminal-chat .field-error {
    margin-top: 0.25rem;
    font-size: 11px;
    color: var(--tc-red);
}

.terminal-chat .alert {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--tc-green-dark);
    border-radius: 0.25rem;
    font-size: 12px;
}

.terminal-chat .alert.success {
    border-color: var(--tc-green-dim);
    color: var(--tc-green);
    background: rgba(0, 255, 65, 0.06);
}

.terminal-chat .alert.error {
    border-color: var(--tc-red);
    color: var(--tc-red);
    background: rgba(255, 51, 51, 0.08);
}

.terminal-chat .submit-btn {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    margin-top: 0.15rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--tc-green-dim);
    border-radius: 0.25rem;
    background: rgba(0, 255, 65, 0.12);
    color: var(--tc-green);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.terminal-chat .submit-btn:hover:not(:disabled) {
    background: rgba(0, 255, 65, 0.22);
    box-shadow: 0 0 12px var(--tc-green-glow);
}

.terminal-chat .submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.terminal-chat .terminal-chat-screen {
    max-height: 10rem;
    overflow-y: auto;
    margin-bottom: 0.5rem;
    padding-right: 0.25rem;
    line-height: 1.25;
}

.terminal-chat .prompt-line {
    position: relative;
    border-top: 1px solid var(--tc-green-dark);
    padding-top: 0.65rem;
    cursor: text;
}

.terminal-chat .prompt-echo-line {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    min-height: 1.35em;
    max-height: 5.4em;
    overflow-y: auto;
    color: var(--tc-green);
    text-shadow: 0 0 6px var(--tc-green-glow);
    pointer-events: none;
}

.terminal-chat .prompt-user {
    color: var(--tc-green);
    text-shadow: 0 0 8px var(--tc-green-glow);
}

.terminal-chat .prompt-symbol {
    color: var(--tc-green);
    margin-right: 0.5rem;
}

.terminal-chat .prompt-typed {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.terminal-chat .input-area,
.terminal-chat .input-area:focus,
.terminal-chat .input-area:focus-visible,
.terminal-chat .input-area:active {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0.65rem 0 0;
    resize: none;
    overflow: hidden;
    outline: none !important;
    outline-offset: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    background-image: none !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    caret-color: transparent !important;
    font: inherit;
    line-height: 1.35;
    appearance: none;
    -webkit-appearance: none;
    color-scheme: dark;
    z-index: 2;
}

.terminal-chat .input-area:-webkit-autofill,
.terminal-chat .input-area:-webkit-autofill:hover,
.terminal-chat .input-area:-webkit-autofill:focus {
    -webkit-text-fill-color: transparent !important;
    caret-color: transparent !important;
    box-shadow: 0 0 0 1000px #0d1110 inset !important;
    transition: background-color 99999s ease-out 0s;
}

.terminal-chat .cursor {
    display: inline-block;
    width: 0.6ch;
    min-width: 8px;
    height: 1.05em;
    margin-left: 1px;
    background: var(--tc-green);
    vertical-align: text-bottom;
    box-shadow: 0 0 10px var(--tc-green-glow);
    animation: terminal-chat-blink 1s step-end infinite;
    pointer-events: none;
}

@keyframes terminal-chat-blink {
    50% {
        opacity: 0;
    }
}

.terminal-chat .statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 14px;
    font-size: 10px;
    color: var(--tc-green-dark);
    border-top: 1px solid var(--tc-green-dark);
    background: rgba(0, 255, 65, 0.04);
    letter-spacing: 0.08em;
}

.terminal-chat .statusbar .status-online {
    color: var(--tc-green-dim);
}

.terminal-chat .statusbar .status-offline {
    color: var(--tc-amber);
}

.terminal-chat .statusbar .status-connecting {
    color: var(--tc-green-dim);
}

/* Floating live-chat root */
.live-chat-root {
    transition: bottom 0.15s ease-out;
}

.live-chat-root[x-cloak],
.live-chat-root [x-cloak] {
    display: none !important;
}
.terminal-chat-fab {
    display: inline-flex;
    height: 3.5rem;
    width: 3.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    border: 1px solid var(--tc-green-dark, #008f11);
    background: #0d1110;
    color: #00ff41;
    font-family: "Courier New", Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    box-shadow: 0 0 16px rgba(0, 255, 65, 0.35);
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.terminal-chat-fab:hover {
    background: #111a14;
    box-shadow: 0 0 22px rgba(0, 255, 65, 0.5);
}

.terminal-chat-fab:focus {
    outline: none;
    box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 4px #00ff41;
}

.terminal-chat-fab.is-pulsing {
    animation: terminal-chat-fab-pulse 1.5s ease-in-out infinite;
}

.terminal-chat-fab-prompt {
    display: inline-flex;
    align-items: baseline;
    line-height: 1;
}

.terminal-chat-fab-cursor {
    display: inline-block;
    animation: terminal-chat-fab-blink 1s step-end infinite;
}

@keyframes terminal-chat-fab-blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes terminal-chat-fab-pulse {
    0%,
    100% {
        box-shadow: 0 0 16px rgba(0, 255, 65, 0.35);
    }
    50% {
        box-shadow: 0 0 28px rgba(0, 255, 65, 0.65);
    }
}

/* Teaser popup (terminal-themed) */
.terminal-chat-teaser {
    background: #0d1110;
    border: 1px solid #008f11;
    color: #00ff41;
    font-family: "Courier New", Consolas, monospace;
    box-shadow: 0 0 18px rgba(0, 255, 65, 0.3);
}

.terminal-chat-teaser .teaser-title {
    font-size: 13px;
    font-weight: 600;
    color: #00ff41;
}

.terminal-chat-teaser .teaser-body {
    font-size: 11px;
    color: #00cc33;
    line-height: 1.45;
}

.terminal-chat-teaser .teaser-cta {
    font-size: 11px;
    font-weight: 600;
    color: #00ff41;
    letter-spacing: 0.04em;
}

.terminal-chat-teaser .teaser-cta:hover {
    color: #00cc33;
}

.terminal-chat-teaser .teaser-dot {
    position: relative;
    display: flex;
    height: 0.75rem;
    width: 0.75rem;
}

.terminal-chat-teaser .teaser-dot span {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: #00ff41;
}

.terminal-chat-teaser .teaser-dot span.ping {
    animation: terminal-chat-ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.75;
}

@keyframes terminal-chat-ping {
    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}
