/* ── Bubble ───────────────────────────────────────────────────────────────── */
#transcell-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #0F2A44;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease;
    animation: pulseBubble 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

#transcell-chat-bubble svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

#transcell-chat-bubble:hover {
    background: #1A8A7D;
    transform: scale(1.08);
    animation: none;
}

#transcell-chat-bubble:hover svg {
    transform: rotate(-10deg) scale(1.1);
}

@keyframes pulseBubble {
    0% {
        box-shadow: 0 0 0 0 rgba(15, 42, 68, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(15, 42, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(15, 42, 68, 0);
    }
}

/* ── Chat window ─────────────────────────────────────────────────────────── */
#transcell-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#transcell-chat-header {
    background: #0F2A44;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    flex-shrink: 0;
}

#transcell-chat-close {
    background: none;
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* ── Messages ────────────────────────────────────────────────────────────── */
#transcell-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafb;
}

.transcell-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.transcell-chat-msg.user {
    background: #E8792B;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.transcell-chat-msg.bot {
    background: #fff;
    color: #0F2A44;
    border: 1px solid #e5e9ed;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* ── Form & disclaimer ───────────────────────────────────────────────────── */
#transcell-chat-form {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

#transcell-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

#transcell-chat-form button {
    margin-left: 8px;
    padding: 10px 16px;
    background: #E8792B;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#transcell-chat-form button:hover {
    background: #d56b22;
}

#transcell-chat-disclaimer {
    padding: 8px 16px;
    font-size: 11px;
    color: #6a7280;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    background: #fff;
    flex-shrink: 0;
}

#transcell-chat-disclaimer a {
    color: #0F2A44;
}

/* ── Typing indicator ────────────────────────────────────────────────────── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #0F2A44;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
    opacity: 0.7;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Intro / welcome panel ───────────────────────────────────────────────── */
/* FIX #4: Use flex (not absolute) so it participates in the column flow.    */
/* JS hides #transcell-chat-messages when intro is visible and vice-versa.   */
.transcell-chat-intro {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: none;
    /* hidden by default — JS adds is-visible */
    background: #f8fafb;
    padding: 20px;
}

.transcell-chat-intro.is-visible {
    display: flex;
    flex-direction: column;
}

.transcell-chat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e9ed;
}

.transcell-chat-intro-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.transcell-chat-logo {
    max-width: 40px !important;
    height: auto !important;
}

.transcell-chat-brand {
    font-weight: 600;
    color: #17395c;
    font-size: 16px;
}

.transcell-chat-title {
    font-size: 20px;
    font-weight: bold;
    color: #17395c;
    margin: 0 0 10px 0;
}

.transcell-chat-description {
    color: #6a7280;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

/* ── Starter buttons ─────────────────────────────────────────────────────── */
.transcell-chat-starters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transcell-chat-starter {
    background: #f0f4f8;
    border: 1px solid #dce4ec;
    color: #17395c;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.transcell-chat-starter:hover {
    background: #e1e9f1;
    border-color: #cdd8e4;
    transform: translateY(-1px);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #transcell-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
    }
}