﻿/* WKA Chatbot â€” tawk.to Style, Fully Responsive */

/* =============================================
   TOGGLE BUTTON â€” Fixed bottom-right
   ============================================= */
#wka-bot-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E8A000, #C47F00);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    outline: none;
    font-size: 0;
    /* hide inline text */
}

#wka-bot-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

/* Icon inside button â€” two states */
#wka-bot-btn .icon-open,
#wka-bot-btn .icon-close {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.3s ease;
    line-height: 1;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wka-bot-btn .icon-open {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

#wka-bot-btn .icon-close {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
    font-size: 20px;
    color: #fff;
    font-style: normal;
}

#wka-bot-btn.open .icon-open {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

#wka-bot-btn.open .icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Notification badge */
#wka-bot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4136;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: none;
}

/* =============================================
   CHAT WINDOW â€” Independently position:fixed
   tawk.to style: appears above/beside button
   ============================================= */
#wka-bot-win {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 999998;
    width: 370px;
    /* Tall panel like tawk.to â€” spans most of viewport height */
    height: calc(100vh - 110px);
    max-height: 680px;
    min-height: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#wka-bot-win.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* =============================================
   HEADER â€” tawk.to crimson bar
   ============================================= */
.wka-bot-head {
    background: linear-gradient(135deg, #E8A000, #C47F00);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-height: 64px;
}

/* Avatar circle */
.wka-bot-head .wka-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 13px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    position: relative;
}

/* Online dot */
.wka-bot-head .wka-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    background: #2dcc70;
    border: 2px solid #E8A000;
    border-radius: 50%;
}

/* Name + status */
.wka-bot-head .wka-head-info {
    flex: 1;
    min-width: 0;
}

.wka-bot-head .wka-head-info .wka-agent-name {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wka-bot-head .wka-head-info .wka-status {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.wka-bot-head .wka-head-info .wka-status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #2dcc70;
    border-radius: 50%;
    flex-shrink: 0;
    animation: wka-pulse 2s ease-in-out infinite;
}

@keyframes wka-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Close button in header */
.wka-bot-head .wka-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    outline: none;
}

.wka-bot-head .wka-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* =============================================
   PRE-CHAT INFO BANNER (tawk.to style)
   ============================================= */
.wka-prechat-banner {
    background: linear-gradient(150deg, #8f1b3a, #C47F00);
    padding: 12px 16px 16px;
    flex-shrink: 0;
}

.wka-prechat-banner p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* =============================================
   MESSAGES AREA
   ============================================= */
.wka-bot-chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}

.wka-bot-chat::-webkit-scrollbar {
    width: 4px;
}

.wka-bot-chat::-webkit-scrollbar-track {
    background: transparent;
}

.wka-bot-chat::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Individual message bubble */
.wka-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    animation: wka-msg-in 0.25s ease;
    position: relative;
}

@keyframes wka-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot message â€” left aligned (tawk.to agent style) */
.wka-msg.bot {
    background: #fff;
    color: #2c2c2c;
    align-self: flex-start;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* User message â€” right aligned (visitor bubble) */
.wka-msg.user {
    background: #E8A000;
    color: #fff;
    align-self: flex-end;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Typing dots */
.wka-msg.typing {
    background: #fff;
    align-self: flex-start;
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-radius: 18px 18px 18px 4px;
}

.wka-msg.typing .wka-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    margin: 0 2px;
    animation: wka-bounce 1.2s infinite;
}

.wka-msg.typing .wka-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.wka-msg.typing .wka-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wka-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    40% {
        transform: translateY(-7px);
        opacity: 1;
    }
}

/* =============================================
   CONTACT CARD (shown at end of conversation)
   ============================================= */
.wka-contact-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 14px;
    margin-top: 4px;
    align-self: flex-start;
    width: calc(100% - 0px);
    max-width: 100%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.wka-contact-card h4 {
    color: #E8A000;
    font-size: 12.5px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wka-contact-card a,
.wka-contact-card .wka-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.2s;
}

.wka-contact-card a:last-child,
.wka-contact-card .wka-contact-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wka-contact-card a:hover {
    color: #E8A000;
}

.wka-contact-card .wka-ci {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #fdf0f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* =============================================
   INPUT AREA â€” tawk.to style
   ============================================= */
.wka-bot-input-area {
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wka-bot-input-area input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    color: #2c2c2c;
    background: #f7f7f7;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
    min-width: 0;
}

.wka-bot-input-area input:focus {
    border-color: #E8A000;
    background: #fff;
}

.wka-bot-input-area input::placeholder {
    color: #aaa;
}

.wka-bot-input-area button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E8A000;
    border: none;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    outline: none;
}

.wka-bot-input-area button:hover {
    background: #C47F00;
    transform: scale(1.06);
}

.wka-bot-input-area button:active {
    transform: scale(0.96);
}

/* =============================================
   FOOTER BRANDING â€” tawk.to style
   ============================================= */
.wka-bot-footer {
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 6px 12px;
    text-align: center;
    font-size: 11px;
    color: #bbb;
    flex-shrink: 0;
}

.wka-bot-footer a {
    color: #999;
    text-decoration: none;
    font-weight: 600;
}

.wka-bot-footer a:hover {
    color: #E8A000;
}

/* =============================================
   RESPONSIVE â€” TABLET (768px and below)
   ============================================= */
@media (max-width: 768px) {
    #wka-bot-win {
        width: 330px;
        height: 490px;
        bottom: 82px;
        right: 16px;
    }

    #wka-bot-btn {
        bottom: 16px;
        right: 16px;
    }
}

/* =============================================
   RESPONSIVE â€” MOBILE (520px and below)
   Like tawk.to: floating card, NOT full screen.
   The page remains visible behind the widget.
   ============================================= */
@media (max-width: 520px) {
    #wka-bot-btn {
        bottom: 14px;
        right: 14px;
        width: 54px;
        height: 54px;
    }

    #wka-bot-win {
        /* Floating card â€” tawk.to style on mobile */
        position: fixed;
        bottom: 78px;
        right: 10px;
        left: 10px;
        width: auto;
        /* stretch between left:10 and right:10 */
        max-width: 420px;
        height: auto;
        max-height: 72vh;
        /* leaves space for page behind & toggle btn */
        border-radius: 12px;
        transform-origin: bottom right;
    }

    .wka-bot-chat {
        max-height: calc(72vh - 180px);
        /* header + input + footer */
    }

    .wka-bot-head {
        padding: 12px 14px;
    }
}

/* =============================================
   RESPONSIVE â€” VERY SMALL MOBILE (360px)
   ============================================= */
@media (max-width: 360px) {
    #wka-bot-btn {
        bottom: 12px;
        right: 12px;
        width: 50px;
        height: 50px;
    }

    #wka-bot-win {
        bottom: 72px;
        right: 8px;
        left: 8px;
        max-height: 70vh;
    }

    .wka-bot-chat {
        max-height: calc(70vh - 180px);
    }
}
