:root {
    --mint: #d9fff0;
    --header1: #0b7a6a;
    --header2: #075e52;
    --user: #0b6f61;
    --card: #ffffff;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.10);
    --text: #0f172a;
    /* --mint-dark: #c8f7e6; */
}

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

html,
body {
    min-height: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--mint);
    color: var(--text);
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    /* KEY FIX */
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, var(--mint) 0%, var(--mint-dark) 100%);
}

/* Top banner */
.topbar {
    padding: 18px 14px;
}

.topbar-inner {
    max-width: 980px;
    margin: 0 auto;
    background: linear-gradient(90deg, var(--header1), var(--header2));
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.brand img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    padding: 4px;
    object-fit: cover;
}

.brand-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .2px;
    line-height: 1.1;
}

.brand-sub {
    margin-top: 4px;
    font-weight: 400;
    font-size: 13px;
    opacity: .95;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}

.brand-sub a {
    color: #d1fae5;
    text-decoration: underline;
}

.visit-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.28);
    white-space: nowrap;
    transition: transform 120ms ease, background 120ms ease;
}

.visit-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.24);
}

/* Chat area */

.page {
    padding: 18px 14px 180px;
    /* bottom space reserved for fixed composer */
}

.chat-wrap {
    max-width: 980px;
    margin: 0 auto;
}

#chatMessages {
    padding: 14px;
}

/* Message rows */
.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 2px 0;
    animation: slideIn .18s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-row.bot {
    justify-content: flex-start;
}

/* Bot avatar */
.bot-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--header1);
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    margin-top: 2px;
}

.bot-avatar svg {
    width: 50px;
    height: 50px;
    fill: #eafff7;
}

/* User avatar */
.user-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--user);
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    margin-top: 2px;
}

.user-avatar svg {
    width: 22px;
    height: 22px;
    fill: #eafff7;
}

/* Typing indicator (bot) */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    width: fit-content;
    box-shadow: var(--shadow);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9aa3af;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: .2s;
}

.typing-dot:nth-child(3) {
    animation-delay: .4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .5;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Bottom composer fixed */
.composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--mint);
    padding: 14px 14px 10px;
}

.composer-inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* rounded white card */
.composer-card {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .10);

}

#messageInput {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    padding: 12px 8px;
    /* makes it tall like screenshot */
    line-height: 1.2;
}

.composer-card:focus-within {
    border-color: rgba(11, 122, 106, 0.35);
    box-shadow: 0 0 0 4px rgba(11, 122, 106, 0.10), 0 16px 34px rgba(0, 0, 0, .10);
}


#messageInput::placeholder {
    color: #94a3b8;
}

.send-icon-btn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 999px;
    background: var(--header2);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 14px 26px rgba(0, 0, 0, .14);
    transition: transform 120ms ease, opacity 120ms ease;
}

.send-icon-btn:hover {
    transform: translateY(-1px);
}

.send-icon-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.send-icon-btn svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* footer note */
.composer-note {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.shield {
    width: 16px;
    height: 16px;
    display: inline-grid;
    place-items: center;
}

.shield svg {
    width: 16px;
    height: 16px;
    fill: #22c55e;
}

@media (max-width: 600px) {
    .brand-title {
        font-size: 18px;
    }

    .bubble {
        max-width: 86vw;
    }
}

/* =========================
        EXACT WHATSAPP BUBBLES
        paste at END of CSS
        ========================= */

.msg-row {
    margin: 6px 0 !important;
    gap: 8px !important;
}

.bubble {
    display: inline-flex !important;
    align-items: flex-end !important;
    /* text + time align bottom */
    gap: 8px !important;
    width: fit-content !important;
    max-width: 65% !important;
    padding: 6px 10px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    border: none !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
    font-family: 'Poppins', sans-serif !important;
}

/* bot bubble (white) */
.bubble.bot {
    background: #ffffff !important;
    border-top-left-radius: 0px !important;
}

/* user bubble (whatsapp green) */
.bubble.user {
    background: #0b6f61 !important;
    color: #fff !important;
    border-top-right-radius: 0px !important;
    max-width: 45% !important;
}

/* text should wrap nicely */
.bubble-text {
    font-family: 'Poppins', sans-serif !important;
    font-size: 14px;
    font-weight: 400;
    display: inline !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
}

/* time in same row, small */
.bubble-time {
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 11px !important;
    opacity: 0.7 !important;
    font-weight: 400;
    white-space: nowrap !important;
}

/* make "hi" bubble small */
.msg-row.user .bubble {
    max-width: fit-content !important;
}

/* OPTIONAL: slightly smaller avatar like WhatsApp */
.bot-avatar {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    overflow: hidden !important;
}

.user-avatar {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    overflow: hidden !important;
}

/* ===== Template Message Card & Buttons ===== */

/* Wrapper: stacks bubble + button list vertically */
.template-card {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    gap: 3px;
    animation: slideIn .22s ease;
}

/* Bubble inside template keeps its normal shape */
.template-card>.bubble.bot {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px 12px 12px 0 !important;
    padding: 10px 14px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06) !important;
}

/* Buttons grid - 2 columns for many, 1 column for few */
.template-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

/* When 3 or fewer buttons, single column */
.template-buttons.single-col {
    grid-template-columns: 1fr;
}

/* Last button spans full width if odd count */
.template-buttons .tpl-btn.full-width {
    grid-column: 1 / -1;
}

/* Individual option buttons */
.template-buttons .tpl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 12px;
    border: 1.2px solid rgba(11, 122, 106, .10);
    border-radius: 10px;
    background: #ffffff;
    color: #0b7a6a;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition:
        background .18s ease,
        border-color .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.tpl-btn:hover {
    background: #f0fdf9;
    border-color: rgba(11, 122, 106, .25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(11, 122, 106, .10);
}

.tpl-btn:active {
    background: #e6faf3;
    transform: translateY(0);
    box-shadow: none;
}

/* Reply arrow icon */
.tpl-btn .tpl-icon {
    display: inline-flex;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity .15s ease;
}

.tpl-btn:hover .tpl-icon {
    opacity: 1;
}

.tpl-btn .tpl-icon svg {
    width: 13px;
    height: 13px;
    fill: #0b7a6a;
}

/* Clicked state */
.tpl-btn.clicked {
    background: linear-gradient(135deg, #e6faf3 0%, #d1f5ea 100%);
    border-color: rgba(11, 122, 106, .30);
    pointer-events: none;
}

/* Disabled (old) template buttons */
.template-buttons.disabled .tpl-btn {
    pointer-events: none;
    opacity: 0.35;
    color: #9ca3af;
    border-color: rgba(0, 0, 0, .04);
    background: #fafafa;
    transform: none;
    box-shadow: none;
}

.template-buttons.disabled .tpl-btn .tpl-icon svg {
    fill: #9ca3af;
}

@media (max-width: 600px) {
    .template-card {
        max-width: 86vw;
    }
}

/* ===== Checkbox Card Styles ===== */
.checkbox-card {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    gap: 3px;
    animation: slideIn .22s ease;
}

.checkbox-card>.bubble.bot {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px 12px 12px 0 !important;
    padding: 10px 14px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06) !important;
}

.checkbox-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1.2px solid rgba(11, 122, 106, .10);
    border-radius: 10px;
    background: #ffffff;
    color: #0b7a6a;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition:
        background .18s ease,
        border-color .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.checkbox-option:hover {
    background: #f0fdf9;
    border-color: rgba(11, 122, 106, .25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(11, 122, 106, .10);
}

.checkbox-option.checked {
    background: linear-gradient(135deg, #e6faf3 0%, #d1f5ea 100%);
    border-color: rgba(11, 122, 106, .35);
}

/* Custom checkbox toggle */
.cb-toggle {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid rgba(11, 122, 106, .35);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .18s ease, border-color .18s ease;
}

.checkbox-option.checked .cb-toggle {
    background: #0b7a6a;
    border-color: #0b7a6a;
}

.cb-toggle svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    opacity: 0;
    transition: opacity .15s ease;
}

.checkbox-option.checked .cb-toggle svg {
    opacity: 1;
}

/* Submit button */
.cb-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #0b7a6a 0%, #075e52 100%);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    box-shadow: 0 4px 14px rgba(11, 122, 106, .25);
    grid-column: 1 / -1;
}

.cb-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(11, 122, 106, .35);
}

.cb-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(11, 122, 106, .20);
}

.cb-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cb-submit-btn svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* Disabled checkbox state */
.checkbox-options.disabled .checkbox-option {
    pointer-events: none;
    opacity: 0.35;
    color: #9ca3af;
    border-color: rgba(0, 0, 0, .04);
    background: #fafafa;
    transform: none;
    box-shadow: none;
}

.checkbox-options.disabled .checkbox-option.checked {
    opacity: 0.55;
    background: #f0fdf9;
}

.checkbox-options.disabled .cb-submit-btn {
    display: none;
}

@media (max-width: 600px) {
    .checkbox-card {
        max-width: 86vw;
    }
}

/* ===== Chat Image Styles ===== */
.bubble-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.bubble-image:hover {
    transform: scale(1.03);
}

/* 2-column image grid */
.bubble-image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.bubble-image-grid .bubble-image {
    aspect-ratio: 1 / 1;
    min-height: 0;
}

/* When odd number of images, last one spans full width */
.bubble-image-grid .bubble-image.full-width {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
}

/* Single image — no grid, just show it big */
.bubble-image-single .bubble-image {
    max-width: 100%;
    max-height: 320px;
    border-radius: 6px;
    aspect-ratio: auto;
}

/* Make bubble vertical layout when it contains an image */
.bubble.has-image {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    max-width: 420px !important;
    width: fit-content !important;
    padding: 4px !important;
    gap: 4px !important;
}

.bubble.has-image .bubble-text {
    display: block !important;
    padding: 4px 6px 0;
    white-space: pre-wrap !important;
    word-break: break-word !important;
}

.bubble.has-image .bubble-time {
    align-self: flex-end;
    padding: 0 6px 2px;
}

@media (max-width: 600px) {
    .bubble.has-image {
        max-width: 86vw !important;
    }
}

.bot-avatar-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    transform: scale(1.3);
}