#gcw-chat-bubble {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    background: #5b21b6;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 10000;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.5s ease, border-radius 0.5s ease, padding 0.5s ease, background 0.3s ease;
}

#gcw-chat-bubble .gcw-bubble-icon {
    font-size: 30px;
    flex-shrink: 0;
}

#gcw-chat-bubble .gcw-bubble-text {
    max-width: 0;
    overflow: hidden;
    margin-left: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    color: white !important;
    transition: max-width 0.6s ease 0.1s, margin-left 0.5s ease 0.1s;
}

#gcw-chat-bubble:hover,
#gcw-chat-bubble.show-text {
    width: 232px;
    border-radius: 30px;
    padding: 0 18px;
    justify-content: flex-start;
    background: #5b21b6;
}

#gcw-chat-bubble:hover .gcw-bubble-text,
#gcw-chat-bubble.show-text .gcw-bubble-text {
    max-width: 188px;
    margin-left: 14px;
}

/* Rest of the stylesheet remains exactly as before */
#gcw-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 620px;
    background: #0C2084;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    transition: all 0.3s;
}

@media (max-height: 700px) {
    #gcw-chat-container {
        height: 90vh;
    }
}

.gcw-hidden {
    display: none !important;
}

#gcw-chat-header {
    background: rgba(217, 217, 217, 0.2);
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    position: relative;
}

#gcw-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #c4b5fd;
    color: #312e81;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

#gcw-close:hover {
    transform: translateY(-50%) scale(1.1);
}

#gcw-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    overscroll-behavior: contain; /* stop scroll chaining to the page */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.gcw-message {
    margin: 12px 8px;
    padding: 12px 18px;
    border-radius: 24px;
    max-width: 80%;
    width: fit-content;
    word-wrap: break-word;
    font-size: 14px;
    animation: fadeIn 0.5s forwards;
}

.gcw-message.user {
    background: rgba(72, 0, 255, 0.5);
    color: white;
    margin-left: auto;
}

.gcw-message.bot {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.gcw-message img {
    max-width: 200px;
    border-radius: 12px;
    margin: 8px 0;
    display: block;
}

#gcw-suggestions {
    display: flex;
    gap: 10px;
    padding: 15px 15px 5px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

#gcw-suggestions::-webkit-scrollbar {
    display: none;
}

.gcw-suggestion {
    background: rgba(166, 98, 255, 0.3);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.gcw-suggestion:hover {
    transform: scale(1.05);
}

.gcw-suggestion:active {
    transform: scale(0.95);
}

.gcw-calendly-btn {
    background: rgba(166, 98, 255, 0.6);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    margin: 5px 15px;
    align-self: flex-start;
    transition: all 0.2s;
}

.gcw-calendly-btn:hover {
    transform: scale(1.05);
    background: rgba(166, 98, 255, 0.8);
}

.gcw-calendly-btn:active {
    transform: scale(0.95);
}

.gcw-learn-more-btn {
    background: rgba(0, 102, 255, 0.6);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    margin: 5px 15px;
    align-self: flex-start;
    transition: all 0.2s;
}

.gcw-learn-more-btn:hover {
    transform: scale(1.05);
    background: rgba(0, 102, 255, 0.8);
}

.gcw-learn-more-btn:active {
    transform: scale(0.95);
}

#gcw-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px;
}

.gcw-input-wrapper {
    position: relative;
    flex: 1;
    background: rgba(217, 217, 217, 0.4);
    border-radius: 30px;
    height: 38px;
    display: flex;
    align-items: center;
}

#gcw-user-input {
    width: 100%;
    height: 100%;
    padding: 0 80px 0 16px;
    background: transparent;
    color: white;
    border: none;
    font-size: 13px;
    outline: none;
    line-height: 38px;
    box-sizing: border-box;
}

#gcw-user-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

#gcw-attach-btn,
#gcw-voice-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

#gcw-attach-btn svg,
#gcw-voice-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#gcw-attach-btn {
    right: 48px;
}

#gcw-voice-btn {
    right: 16px;
}

#gcw-attach-btn:hover,
#gcw-voice-btn:hover {
    opacity: 0.7;
}

#gcw-voice-btn.recording {
    color: #ff4d4d;
}

#gcw-voice-btn.recording svg {
    animation: pulse 1.5s infinite;
}

#gcw-send-btn {
    background: white;
    color: #5b21b6;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#gcw-send-btn:hover {
    transform: scale(1.1);
}

#gcw-send-btn:active {
    transform: scale(0.9);
}

/* Pending image previews – smaller thumbnail */
#gcw-pending-preview {
    display: none;
    padding: 0 15px 8px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

#gcw-pending-preview.visible {
    display: flex;
}

.gcw-preview-item {
    position: relative;
}

.gcw-preview-item img {
    max-width: 70px;
    border-radius: 12px;
    display: block;
}

.gcw-preview-item button {
    position: absolute;
    top: -6px;
    right: -6px;
    background: white;
    color: black;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Mobile optimization – balanced, centered sheet (narrower, shorter, bubble visible below) */
@media (max-width: 768px) {
    #gcw-chat-container {
        width: calc(100% - 32px) !important;
        height: min(78vh, calc(100dvh - 120px)) !important;
        max-height: min(78vh, calc(100dvh - 120px)) !important;
        bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        border-radius: 24px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    }

    /* Larger close button on mobile for easy tap */
    #gcw-close {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }

    /* Prevent background page scroll when chat is open */
    body.gcw-chat-mobile-open {
        overflow: hidden;
    }
}

@media (max-width: 400px) {
    #gcw-chat-bubble:hover,
    #gcw-chat-bubble.show-text {
        width: 60px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }

    #gcw-chat-bubble:hover .gcw-bubble-text,
    #gcw-chat-bubble.show-text .gcw-bubble-text {
        max-width: 0;
        margin-left: 0;
    }

    #gcw-chat-container {
        width: calc(100% - 20px) !important;
        border-radius: 20px !important;
    }
}

/* Prevent iOS auto-zoom on chatbot input (font >=16px) */
@media (max-width: 768px) {
    .gcw-input-wrapper {
        height: 44px;
    }

    #gcw-user-input {
        font-size: 16px !important; /* prevents zoom trigger */
        line-height: 44px !important;
        padding: 0 80px 0 16px !important;
    }

    #gcw-user-input::placeholder {
        font-size: 16px !important;
        opacity: 0.8; /* keeps it visible but subtle */
    }

    /* Optional: extra insurance – reset viewport scale on blur */
    #gcw-user-input:focus {
        outline: none;
    }
}

/* Premium window — brand blue, purple, white */
#gcw-chat-bubble {
    background: linear-gradient(160deg, #14308f, #0c2084);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 40px rgba(4, 8, 28, 0.45), 0 0 28px rgba(77, 124, 255, 0.28);
    width: 56px;
    height: 56px;
    font-family: Outfit, Inter, system-ui, sans-serif;
}

#gcw-chat-bubble .gcw-bubble-icon {
    font-size: 0;
    width: 28px;
    height: 28px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    display: grid;
    place-items: center;
    color: #f7f8ff;
}

#gcw-chat-bubble .gcw-bubble-icon svg {
    width: 26px;
    height: 26px;
    display: block;
}

#gcw-chat-bubble:hover,
#gcw-chat-bubble.show-text {
    background: linear-gradient(160deg, #1a3cad, #0c2084);
    border-color: rgba(255, 255, 255, 0.6);
}

#gcw-chat-container {
    width: min(392px, calc(100% - 28px));
    height: min(620px, calc(100dvh - 128px));
    background: rgba(8, 12, 36, 0.94);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(168, 188, 255, 0.28);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(2, 4, 18, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-family: Inter, system-ui, sans-serif;
}

#gcw-chat-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: Outfit, Inter, sans-serif;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.72rem;
    padding: 18px 52px 18px 20px;
    text-align: left;
    color: #f5f7ff;
}

#gcw-close {
    background: transparent;
    color: #f5f7ff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: 400;
}

.gcw-message {
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.gcw-message.bot {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(245, 247, 255, 0.94);
}

.gcw-message.user {
    background: rgba(77, 124, 255, 0.28);
    color: #f7f8ff;
}

.gcw-suggestion,
.gcw-calendly-btn,
.gcw-learn-more-btn {
    background: transparent;
    border: 1px solid rgba(183, 164, 255, 0.45);
    color: #f5f7ff;
    border-radius: 999px;
}

.gcw-input-wrapper {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    height: 46px;
}

#gcw-send-btn {
    background: linear-gradient(160deg, #3d6bff, #0c2084 55%, #6d4ad8);
    color: #f7f8ff;
}

@media (max-width: 640px) {
    #gcw-chat-container {
        right: 14px;
        left: auto;
        width: min(360px, calc(100% - 28px));
        height: min(560px, calc(100dvh - 110px));
        bottom: 84px;
        border-radius: 20px;
    }

    #gcw-chat-bubble {
        width: 54px;
        height: 54px;
    }

    #gcw-chat-container {
        width: min(380px, calc(100% - 36px)) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        border-radius: 22px !important;
    }
}