/* Chat Widget CSS */
.hc-chat-widget {
    position: fixed;
    bottom: 160px !important;
    right: 20px !important;
    z-index: 99999;
    font-family: 'Open Sans', sans-serif;
}

/* Chat Launcher Button */
.hc-launcher {
    width: auto;
    padding: 0 20px;
    height: 55px;
    background-color: #21a366;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(33, 163, 102, 0.4);
    position: relative;
    transition: transform 0.2s ease;
}

/* Force Quick Enquiry to stay above Chat */
.quick-enquiry-float-btn {
    bottom: 230px !important;
    z-index: 99990 !important;
}

.hc-launcher:hover {
    transform: scale(1.05);
}

.hc-launcher img {
    width: 30px;
    height: auto;
    filter: brightness(0) invert(1);
}

.hc-launcher::after {
    display: none;
}

.hc-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #f03e3e;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Tooltip Popup */
.hc-tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hc-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.hc-tooltip h4 {
    color: #179373;
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hc-tooltip p {
    color: #333;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 16px 0;
    font-weight: 600;
}

.hc-tooltip-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hc-btn-start {
    background-color: #21a366;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.hc-btn-start:hover {
    background-color: #1b8a56;
    color: white;
}

.hc-btn-not-now {
    color: #999;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

.hc-btn-not-now:hover {
    color: #666;
}

/* Main Chat Window */
.hc-chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 360px;
    height: 600px;
    max-height: calc(100vh - 100px);
    background: #f8f6f0;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Pattern for background */
    background-image: radial-gradient(#d5d5d5 1px, transparent 1px);
    background-size: 20px 20px;
}

.hc-chat-window.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.hc-chat-header {
    background-color: #0c6a49;
    /* Subtle plus pattern overlay could be added here */
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.hc-btn-back {
    color: white;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}

.hc-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    background: #509e82;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hc-avatar-wrap i {
    font-size: 18px;
}

.hc-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #25d366;
    border-radius: 50%;
    border: 2px solid #0c6a49;
}

.hc-header-info {
    display: flex;
    flex-direction: column;
}

.hc-header-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.hc-header-status {
    font-size: 12px;
    color: #a4d8c2;
}

.hc-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hc-header-right button, .hc-header-right a {
    color: white;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
}

/* Chat Body (Lead Form) */
.hc-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Hide scrollbar for aesthetics */
.hc-chat-body::-webkit-scrollbar {
    width: 4px;
}
.hc-chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.hc-lead-form-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-top: 10px;
    display: block; /* Hidden initially or shown based on state */
}

.hc-lead-text {
    font-size: 14px;
    color: #555;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.hc-input-group {
    margin-bottom: 15px;
}

.hc-input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.hc-input-group input:focus {
    border-color: #21a366;
}

.hc-btn-continue {
    width: 100%;
    background-color: #21a366;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.hc-btn-continue:hover {
    background-color: #1b8a56;
}

/* Chat Messages */
.hc-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
    /* hide by default until lead is captured */
    display: none; 
}

.hc-message-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

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

.hc-bot-avatar {
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
    color: #0c6a49;
}

.hc-message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
    word-wrap: break-word;
}

.hc-bot .hc-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hc-user .hc-message-bubble {
    background: #d1f5d3;
    color: #111;
    border-bottom-right-radius: 4px;
}

.hc-quick-actions {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-top: 10px;
    width: 85%;
    margin-left: 36px;
}

.hc-quick-actions p {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.hc-action-btns {
    display: flex;
    gap: 10px;
}

.hc-btn-action {
    flex: 1;
    background: #21a366;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

/* Footer Input */
.hc-chat-footer {
    background: white;
    padding: 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    display: none; /* hidden until lead captured */
}

.hc-btn-emoji {
    color: #f5b041;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

.hc-chat-input-wrapper {
    flex: 1;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 8px 15px;
}

.hc-chat-input-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
}

.hc-btn-send {
    width: 36px;
    height: 36px;
    background: #21a366;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hc-btn-send i {
    margin-left: -2px; /* optical alignment */
}

/* Mobile Adjustments */
@media (max-width: 767px) {
    .hc-chat-widget {
        bottom: 75px; /* Above mobile sticky bar and whatsapp */
        right: 15px;
    }
    
    .hc-tooltip {
        width: 280px;
        right: 0;
    }

    .hc-chat-window {
        position: fixed;
        bottom: 75px; /* Aligned with the launcher */
        right: 15px;
        width: calc(100vw - 30px);
        height: calc(100vh - 140px);
        max-height: 550px;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    }
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
@media (max-width: 767px) { 
    .hc-chat-widget { bottom: 90px !important; right: 15px !important; } 
    .quick-enquiry-float-btn { bottom: 145px !important; right: 15px !important; padding: 9px 18px !important; font-size: 12px !important; }
    .hc-launcher { height: 42px !important; padding: 0 14px !important; border-radius: 22px !important; }
    .hc-launcher span { font-size: 13px !important; }
    .hc-launcher i { font-size: 18px !important; margin-right: 5px !important; }
    .hc-badge { top: -4px !important; right: -4px !important; width: 18px !important; height: 18px !important; font-size: 10px !important; }
}
