@charset "UTF-8";
/* ============================================================
   KSC -- Website Assistant (chat widget)
   Self-contained floating widget injected by assets/js/chatbot.js
   on every page. Uses the site's Montserrat / navy-green-white
   palette so it reads as part of the site, not a third-party embed.
   ============================================================ */

/* -- TOGGLE BUTTON -- */
#ksc-bot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--orange);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1400;
    transition: var(--transition);
    /* Ensure it never causes horizontal overflow */
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#ksc-bot-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

#ksc-bot-toggle:active {
    transform: scale(0.96);
}

#ksc-bot-toggle .fa-xmark { display: none; }
#ksc-bot-toggle.is-open .fa-comment-dots { display: none; }
#ksc-bot-toggle.is-open .fa-xmark { display: block; }

/* -- NOTIFICATION DOT -- */
#ksc-bot-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--navy);
    border: 2px solid var(--white);
    pointer-events: none;
}

#ksc-bot-dot[hidden] { display: none; }

/* -- CHAT PANEL -- desktop -- */
#ksc-bot-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 366px;
    max-width: calc(100vw - 48px);
    height: 540px;
    max-height: calc(100dvh - 140px);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1401;
    /* hidden state */
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#ksc-bot-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* -- HEADER -- */
.ksc-bot-header {
    background: var(--navy);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    /* prevents header from being squeezed on tiny screens */
    min-height: 60px;
}

.ksc-bot-header__badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange);
    font-size: 17px;
    flex-shrink: 0;
}

.ksc-bot-header__text {
    flex: 1;
    min-width: 0;
}

.ksc-bot-header__text strong {
    display: block;
    color: var(--white);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ksc-bot-header__text span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.72rem;
}

.ksc-bot-header__text span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--orange);
    flex-shrink: 0;
}

.ksc-bot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    /* larger touch target */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ksc-bot-close:hover { background: rgba(255, 255, 255, 0.2); }
.ksc-bot-close:active { background: rgba(255, 255, 255, 0.3); }

/* -- MESSAGES AREA -- */
.ksc-bot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--cream-dark, #f0f2f8);
    /* smooth momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* -- MESSAGE BUBBLES -- */
.ksc-bot-msg {
    max-width: 86%;
    font-size: 0.84rem;
    line-height: 1.55;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.ksc-bot-msg.bot {
    align-self: flex-start;
    background: var(--white);
    border: 1px solid var(--gray-200, #e4e7f0);
    color: var(--text-dark, #1a2750);
    border-radius: 4px 14px 14px 14px;
    box-shadow: var(--shadow-sm);
}

.ksc-bot-msg.user {
    align-self: flex-end;
    background: var(--navy);
    color: var(--white);
    border-radius: 14px 4px 14px 14px;
}

.ksc-bot-msg strong { font-weight: 700; }

/* -- ACTION BUTTONS (inside messages) -- */
.ksc-bot-actions {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 86%;
}

.ksc-bot-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1.5px solid var(--navy);
    color: var(--navy);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* minimum tap target */
    min-height: 40px;
}

.ksc-bot-action:hover  { background: var(--navy); color: var(--white); }
.ksc-bot-action:active { opacity: 0.85; }

.ksc-bot-action.primary {
    background: var(--orange);
    border-color: var(--orange);
    color: var(--white);
}
.ksc-bot-action.primary:hover  { background: var(--orange-dark, #1e6b2e); border-color: var(--orange-dark, #1e6b2e); }

.ksc-bot-action.whatsapp {
    background: #25D366;
    border-color: #25D366;
    color: var(--white);
}
.ksc-bot-action.whatsapp:hover { filter: brightness(0.92); }

/* -- TYPING INDICATOR -- */
.ksc-bot-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200, #e4e7f0);
    border-radius: 4px 14px 14px 14px;
}

.ksc-bot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-400, #9ba4b5);
    animation: ksc-bot-bounce 1.1s infinite ease-in-out;
}

.ksc-bot-typing span:nth-child(2) { animation-delay: 0.15s; }
.ksc-bot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ksc-bot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-4px); opacity: 1; }
}

/* -- QUICK REPLY CHIPS -- */
.ksc-bot-quickreplies {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--gray-200, #e4e7f0);
    background: var(--white);
    overflow-x: hidden;
}

.ksc-bot-chip {
    border: 1.5px solid var(--gray-200, #e4e7f0);
    background: var(--white);
    color: var(--text-mid, #3d4f7c);
    font-size: 0.76rem;
    font-weight: 700;
    padding: 8px 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.ksc-bot-chip:hover  { border-color: var(--orange); color: var(--orange); }
.ksc-bot-chip:active { opacity: 0.75; }

/* -- INPUT BAR -- */
.ksc-bot-inputbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--gray-200, #e4e7f0);
    background: var(--white);
    /* keep visible above mobile keyboard */
    position: relative;
    z-index: 2;
}

.ksc-bot-inputbar input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid var(--gray-200, #e4e7f0);
    border-radius: 22px;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-dark, #1a2750);
    background: var(--cream-dark, #f0f2f8);
    padding: 10px 16px;
    transition: border-color 0.2s;
    /* iOS prevents zoom on input focus if font-size >= 16px */
    font-size: max(16px, 0.9rem);
}

.ksc-bot-inputbar input:focus {
    border-color: var(--navy);
    background: var(--white);
    outline: none;
}

.ksc-bot-inputbar input::placeholder { color: var(--gray-400, #9ba4b5); }

.ksc-bot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--orange);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ksc-bot-send:hover    { background: var(--orange-dark, #1e6b2e); }
.ksc-bot-send:active   { transform: scale(0.93); }
.ksc-bot-send:disabled { background: var(--gray-200, #e4e7f0); color: var(--gray-400, #9ba4b5); cursor: default; }

/* ------------------------------------------------
   RESPONSIVE - TABLET (481px - 768px)
   Panel slightly narrower, same floating layout
------------------------------------------------ */
@media (max-width: 768px) {
    #ksc-bot-panel {
        right: 16px;
        width: 340px;
        max-width: calc(100vw - 32px);
        bottom: 90px;
        max-height: calc(100dvh - 120px);
    }
}

/* ------------------------------------------------
   RESPONSIVE -- MOBILE (max 480px)
   Panel goes full-width, pinned to bottom,
   clears the toggle button.
   The keyboard pushes content up via dvh units.
------------------------------------------------ */
@media (max-width: 480px) {

    /* Toggle button -- slightly smaller, closer to edge */
    #ksc-bot-toggle {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
        font-size: 20px;
    }

    /* Panel -- full-width sheet, slides up from bottom */
    #ksc-bot-panel {
        /* stretch edge-to-edge with 8px breathing room each side */
        right: 8px;
        left: 8px;
        bottom: 80px;
        width: auto;
        max-width: none;
        /* use dvh so the panel shrinks when mobile keyboard appears */
        height: calc(100dvh - 100px);
        max-height: calc(100dvh - 100px);
        border-radius: 20px;
    }

    /* Taller header for easier tap on small phones */
    .ksc-bot-header {
        padding: 14px 14px;
        min-height: 64px;
    }

    .ksc-bot-header__badge {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .ksc-bot-header__text strong { font-size: 0.9rem; }
    .ksc-bot-header__text span   { font-size: 0.7rem; }

    /* Close button -- bigger touch target */
    .ksc-bot-close {
        width: 38px;
        height: 38px;
    }

    /* Messages area */
    .ksc-bot-messages {
        padding: 12px;
        gap: 10px;
    }

    /* Slightly larger bubbles for readability */
    .ksc-bot-msg {
        font-size: 0.88rem;
        padding: 10px 13px;
        max-width: 90%;
    }

    /* Action buttons -- full-width on mobile for easy tap */
    .ksc-bot-actions {
        max-width: 92%;
        width: 92%;
    }

    .ksc-bot-action {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.82rem;
        min-height: 44px;
    }

    /* Quick replies -- horizontal scroll if many chips */
    .ksc-bot-quickreplies {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px;
        gap: 8px;
        scrollbar-width: none;
    }
    .ksc-bot-quickreplies::-webkit-scrollbar { display: none; }

    .ksc-bot-chip {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 9px 15px;
        font-size: 0.8rem;
        min-height: 40px;
    }

    /* Input bar */
    .ksc-bot-inputbar {
        padding: 10px 12px;
        gap: 8px;
    }

    .ksc-bot-inputbar input {
        font-size: 16px; /* prevents iOS auto-zoom on focus */
        padding: 10px 14px;
    }

    .ksc-bot-send {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    /* Typing dots */
    .ksc-bot-typing { padding: 11px 14px; }
}

/* ------------------------------------------------
   VERY SMALL SCREENS (< 360px, e.g. Galaxy A series)
------------------------------------------------ */
@media (max-width: 360px) {
    #ksc-bot-toggle {
        right: 12px;
        bottom: 12px;
        width: 50px;
        height: 50px;
        font-size: 19px;
    }

    #ksc-bot-panel {
        right: 4px;
        left: 4px;
        bottom: 72px;
        height: calc(100dvh - 88px);
        max-height: calc(100dvh - 88px);
        border-radius: 16px;
    }

    .ksc-bot-msg { font-size: 0.85rem; }
    .ksc-bot-chip { font-size: 0.75rem; padding: 8px 12px; }
}

/* ------------------------------------------------
   LANDSCAPE MOBILE
   Short viewport -- panel must scroll its messages
------------------------------------------------ */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    #ksc-bot-panel {
        right: 8px;
        left: 8px;
        bottom: 70px;
        height: calc(100dvh - 80px);
        max-height: none;
        border-radius: 16px;
    }

    #ksc-bot-toggle {
        bottom: 12px;
        right: 12px;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .ksc-bot-header { min-height: 50px; padding: 10px 14px; }
    .ksc-bot-messages { padding: 8px 12px; gap: 8px; }
    .ksc-bot-msg { font-size: 0.82rem; padding: 8px 12px; }
}