/* ==========================================================================
   Kruti Group - AI Virtual Assistant Chatbot Styles
   ========================================================================== */

#kruti-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

/* Floating Launcher Button */
.kruti-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f37021 0%, #d4560a 100%);
    box-shadow: 0 8px 24px rgba(243, 112, 33, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    border: 2px solid #ffffff;
}

.kruti-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(243, 112, 33, 0.55);
}

.kruti-chat-launcher i {
    color: #ffffff;
    font-size: 26px;
    transition: transform 0.3s ease;
}

.kruti-chat-launcher .icon-close {
    display: none;
    font-size: 22px;
}

.kruti-chat-launcher.is-active {
    background: #1b2a47;
    box-shadow: 0 8px 24px rgba(27, 42, 71, 0.45);
}

.kruti-chat-launcher.is-active .icon-chat {
    display: none;
}

.kruti-chat-launcher.is-active .icon-close {
    display: block;
}

/* Online Pulse Dot */
.kruti-online-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #28a745;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.kruti-online-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #28a745;
    animation: kruti-pulse 2s infinite;
}

@keyframes kruti-pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }

    70% {
        transform: scale(2.2);
        opacity: 0;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Launcher Tooltip */
.kruti-launcher-tooltip {
    position: absolute;
    right: 74px;
    background: #ffffff;
    color: #1b2a47;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid #eef0f3;
}

.kruti-launcher-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #ffffff;
}

/* Chat Box Window */
.kruti-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 90px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.kruti-chat-window.is-open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* Header */
.kruti-chat-header {
    background: linear-gradient(135deg, #1b2a47 0%, #293f66 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-bottom: 2px solid #f37021;
}

.kruti-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kruti-bot-avatar {
    width: 42px;
    height: 42px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.kruti-bot-avatar img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.kruti-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.kruti-header-info .kruti-status {
    font-size: 11px;
    color: #8fe1a2;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.kruti-status-dot {
    width: 7px;
    height: 7px;
    background: #28a745;
    border-radius: 50%;
    display: inline-block;
}

.kruti-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.kruti-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.kruti-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Dedicated prominent Close/Cut Button (✕) */
.kruti-action-btn.kruti-close-btn {
    background: rgba(231, 76, 60, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
}

.kruti-action-btn.kruti-close-btn:hover,
.kruti-action-btn.kruti-close-btn:active {
    background: #e74c3c;
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
}

/* Quick Contact Strip in Header */
.kruti-contact-strip {
    background: #f8f9fa;
    padding: 8px 16px;
    border-bottom: 1px solid #eef0f3;
    display: flex;
    justify-content: space-around;
    font-size: 12px;
}

.kruti-contact-strip a {
    color: #1b2a47;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.kruti-contact-strip a.wa-link {
    color: #25d366;
}

.kruti-contact-strip a:hover {
    color: #f37021;
}

/* Message Feed Body */
.kruti-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    background: #fbfcfd;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.kruti-message-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 90%;
}

.kruti-message-group.bot {
    align-self: flex-start;
    max-width: 95%;
}

.kruti-message-group.user {
    align-self: flex-end;
    max-width: 86%;
}

.kruti-bubble {
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kruti-message-group.bot .kruti-bubble {
    background: #ffffff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    border: 1px solid #e9edf1;
}

.kruti-message-group.user .kruti-bubble {
    background: linear-gradient(135deg, #f37021 0%, #e25d0c 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.kruti-msg-time {
    font-size: 10px;
    color: #8c9ba5;
    margin-top: 2px;
}

.kruti-message-group.user .kruti-msg-time {
    align-self: flex-end;
}

.kruti-message-group.bot .kruti-msg-time {
    align-self: flex-start;
}

/* Bot Rich Content Styles */
.kruti-bubble p {
    margin: 0 0 6px 0;
}

.kruti-bubble p:last-child {
    margin-bottom: 0;
}

.kruti-bubble ul {
    margin: 4px 0 6px 16px;
    padding: 0;
    list-style-type: disc;
}

.kruti-bubble li {
    margin-bottom: 3px;
}

.kruti-bubble a {
    color: #f37021;
    font-weight: 600;
    text-decoration: underline;
}

.kruti-highlight {
    color: #1b2a47;
    font-weight: 700;
}

/* Quick Suggestion Chips */
.kruti-chip-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.kruti-chip {
    background: #ffffff;
    color: #1b2a47;
    border: 1px solid #d5dde5;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kruti-chip:hover {
    background: #f37021;
    color: #ffffff;
    border-color: #f37021;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(243, 112, 33, 0.25);
}

/* Typing Indicator Animation */
.kruti-typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e9edf1;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

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

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

@keyframes kruti-bounce {

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

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

/* In-Chat Inquiry Form */
.kruti-lead-form {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.kruti-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

@media (max-width: 480px) {
    .kruti-form-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.kruti-lead-form input,
.kruti-lead-form textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kruti-lead-form textarea {
    min-height: 44px;
    max-height: 64px;
    resize: none;
}

.kruti-lead-form input:focus,
.kruti-lead-form textarea:focus {
    border-color: #f37021;
    box-shadow: 0 0 0 2px rgba(243, 112, 33, 0.15);
}

.kruti-lead-form button {
    background: linear-gradient(135deg, #f37021 0%, #e05e10 100%);
    color: #ffffff;
    border: none;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.kruti-lead-form button:hover {
    background: #d4560a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 112, 33, 0.3);
}

/* Chat Input Footer */
.kruti-chat-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kruti-input-box {
    flex: 1;
    position: relative;
}

.kruti-input-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d5dde5;
    border-radius: 24px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.kruti-input-box input:focus {
    border-color: #f37021;
    box-shadow: 0 0 0 3px rgba(243, 112, 33, 0.12);
}

.kruti-send-btn {
    width: 40px;
    height: 40px;
    background: #f37021;
    border: none;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    flex-shrink: 0;
}

.kruti-send-btn:hover {
    background: #d4560a;
    transform: scale(1.05);
}

.kruti-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Chat Watermark */
.kruti-chat-watermark {
    text-align: center;
    font-size: 10px;
    color: #a0aec0;
    padding: 4px 0 6px 0;
    background: #ffffff;
}

/* Mobile & Desktop Backdrop Overlay */
.kruti-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.55);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.kruti-chat-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Mobile Responsiveness (Phones & Small Tablets) */
@media (max-width: 767px) {
    #kruti-chatbot-container {
        bottom: 16px;
        right: 16px;
    }

    .kruti-chat-launcher {
        width: 52px;
        height: 52px;
    }

    .kruti-chat-launcher i {
        font-size: 22px;
    }

    .kruti-launcher-tooltip {
        display: none !important;
    }

    /* Floating Card Sheet on Mobile with plenty of breathability */
    .kruti-chat-window {
        position: fixed !important;
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: 440px !important;
        margin: 0 auto !important;
        height: min(580px, calc(100vh - 20px)) !important;
        max-height: calc(100vh - 20px) !important;
        border-radius: 18px !important;
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5) !important;
        z-index: 1000000 !important;
        transform-origin: bottom center !important;
    }

    .kruti-chat-header {
        padding: 12px 14px;
    }

    .kruti-bot-avatar {
        width: 36px;
        height: 36px;
    }

    .kruti-header-info h4 {
        font-size: 15px;
    }

    .kruti-action-btn {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    /* Highlighted, easily tappable Cut / Close Button */
    .kruti-action-btn.kruti-close-btn {
        width: 38px;
        height: 38px;
        font-size: 18px;
        background: rgba(231, 76, 60, 0.6);
        border: 1.5px solid #ffffff;
    }

    .kruti-contact-strip {
        padding: 6px 12px;
        font-size: 11px;
    }

    .kruti-chat-body {
        padding: 10px 12px;
        gap: 8px;
    }

    .kruti-message-group.bot {
        max-width: 98% !important;
    }

    .kruti-bubble {
        padding: 9px 12px !important;
        font-size: 13px !important;
        line-height: 1.4 !important;
    }

    .kruti-chip {
        padding: 4px 9px !important;
        font-size: 11px !important;
    }

    .kruti-chat-footer {
        padding: 8px 12px;
    }

    /* Prevent iOS Safari auto-zooming on input focus */
    .kruti-input-box input,
    .kruti-lead-form input,
    .kruti-lead-form textarea {
        font-size: 16px !important;
    }

    .kruti-input-box input {
        padding: 8px 14px;
    }

    .kruti-send-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Position Scroll-to-Top button (.go-top) on the Bottom-Left
   ========================================================================== */
.button-go-top .go-top,
.go-top,
a.go-top {
    position: fixed !important;
    left: 24px !important;
    right: auto !important;
    bottom: 24px !important;
    width: 44px !important;
    height: 44px !important;
    z-index: 99999 !important;
    background-color: #18ba60 !important;
    box-shadow: 0 4px 14px rgba(24, 186, 96, 0.45) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    border: 2px solid #ffffff !important;
    text-align: center !important;
    line-height: 44px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.button-go-top .go-top i,
.go-top i,
a.go-top i {
    font-size: 16px !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.button-go-top .go-top:hover,
.go-top:hover,
a.go-top:hover {
    background-color: #128a47 !important;
    transform: translateY(-3px) scale(1.06) !important;
    box-shadow: 0 6px 18px rgba(24, 186, 96, 0.6) !important;
}

@media (max-width: 480px) {
    .button-go-top .go-top,
    .go-top,
    a.go-top {
        left: 16px !important;
        right: auto !important;
        bottom: 16px !important;
    }
}