/* ==========================================================================
   CHITTILAPPILLY SQUARE AI CHATBOT WIDGET STYLES
   ========================================================================== */

:root {
    --chat-primary: #1d8da8;
    --chat-secondary: #ff7b54;
    --chat-bg: #ffffff;
    --chat-header-bg: linear-gradient(135deg, #1d8da8 0%, #0369a1 100%);
    --chat-bot-bubble: #f1f5f9;
    --chat-user-bubble: linear-gradient(135deg, #1d8da8 0%, #176b80 100%);
    --chat-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

/* Floating Trigger Button (Stacked above WhatsApp icon at bottom: 40px) */
.chatbot-trigger-btn {
    position: fixed;
    bottom: 115px;
    right: 28px;
    z-index: 999980;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 28px rgba(29, 141, 168, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 24px;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-trigger-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px rgba(29, 141, 168, 0.5);
}

.chatbot-trigger-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #22c55e;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
}

.chatbot-trigger-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--chat-primary);
    opacity: 0.6;
    animation: trigger-pulse 2.2s ease-out infinite;
}

@keyframes trigger-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Tooltip Badge */
.chatbot-tooltip {
    position: fixed;
    bottom: 125px;
    right: 98px;
    z-index: 999975;
    background: #0f172a;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.chatbot-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Main Chat Container Drawer */
.chatbot-container {
    position: fixed;
    bottom: 185px;
    right: 28px;
    z-index: 999990;
    width: 380px;
    max-width: calc(100vw - 36px);
    height: 540px;
    max-height: calc(100vh - 210px);
    background: var(--chat-bg);
    border-radius: 24px;
    box-shadow: var(--chat-shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.92);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: var(--chat-header-bg);
    color: #ffffff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-primary);
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
}

.chatbot-header-info p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Chat Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: message-appear 0.3s ease-out forwards;
}

@keyframes message-appear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.chat-message.bot .chat-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.chat-message.user .chat-bubble {
    background: var(--chat-user-bubble);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(29, 141, 168, 0.25);
}

/* Action Buttons inside Bot Message */
.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, #0369a1 100%);
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    margin-top: 8px;
    margin-right: 4px;
    box-shadow: 0 4px 10px rgba(29, 141, 168, 0.2);
    transition: transform 0.2s ease;
}

.chat-action-btn:hover {
    transform: translateY(-2px);
}

/* Quick Suggestion Chips */
.chatbot-quick-chips {
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chatbot-quick-chips::-webkit-scrollbar {
    display: none;
}

.quick-chip-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s ease;
}

.quick-chip-btn:hover,
.quick-chip-btn.active {
    background: linear-gradient(135deg, var(--chat-primary) 0%, #0369a1 100%);
    color: #ffffff;
    border-color: var(--chat-primary);
    box-shadow: 0 4px 12px rgba(29, 141, 168, 0.25);
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input:focus {
    border-color: var(--chat-primary);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(29, 141, 168, 0.3);
    transition: transform 0.2s ease;
}

.chatbot-send-btn:hover {
    transform: scale(1.08);
}

@media (max-width: 480px) {
    .chatbot-container {
        right: 18px;
        bottom: 170px;
        width: calc(100vw - 36px);
        height: 480px;
    }
    .chatbot-trigger-btn {
        bottom: 105px;
        right: 18px;
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
    .chatbot-tooltip {
        bottom: 112px;
        right: 80px;
        font-size: 12px;
    }
}

/* Typing Indicator Animation */
.typing-bubble {
    padding: 14px 18px !important;
    min-width: 60px;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 18px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-primary);
    opacity: 0.4;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

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

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Disabled State */
.chatbot-input:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Error State */
.chat-bubble.error-bubble {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #991b1b !important;
}

/* Mobile View Support - AI Chatbot on Right Side, WhatsApp on Left Side */
@media (max-width: 992px) {
    .chatbot-trigger-btn {
        bottom: calc(125px + env(safe-area-inset-bottom, 0px)) !important;
        right: 18px !important;
        left: auto !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
    .chatbot-tooltip {
        bottom: calc(133px + env(safe-area-inset-bottom, 0px)) !important;
        right: 78px !important;
        left: auto !important;
        font-size: 11px !important;
        transform: translateX(10px);
    }
    .chatbot-tooltip.visible {
        transform: translateX(0);
    }
    .chatbot-container,
    .chatbot-window {
        right: 15px !important;
        left: auto !important;
        bottom: calc(185px + env(safe-area-inset-bottom, 0px)) !important;
        width: calc(100vw - 30px) !important;
        max-width: 380px !important;
        height: 480px !important;
        transform-origin: bottom right !important;
    }
}

