/* ========================================
   OKPW — Chatbot Styles
   ======================================== */

/* ── Toggle Button ── */
.chat-toggle {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--olive);
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 4px 20px rgba(85, 107, 47, 0.4);
    transition: all 0.4s var(--ease-out-expo);
}
.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(85, 107, 47, 0.5);
}
.chat-toggle.active {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chat-toggle-badge {
    position: absolute;
    top: -4px; right: -4px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #EF4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ── Chat Window ── */
.chat-window {
    position: fixed;
    bottom: 96px; right: 24px;
    width: 380px;
    max-height: 560px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 9997;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s var(--ease-out-expo);
}
.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.chat-header {
    background: var(--charcoal);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--olive);
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 800;
    position: relative;
    overflow: hidden;
}
.chat-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.chat-status-dot {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #22C55E;
    border: 2px solid var(--charcoal);
}
.chat-header-name {
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 700;
}
.chat-header-status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

/* ── Messages ── */
.chat-messages {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    min-height: 280px;
    max-height: 340px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

.chat-msg {
    display: flex;
    margin-bottom: 12px;
    animation: msgSlideIn 0.3s var(--ease-out-expo);
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg--user { justify-content: flex-end; }
.chat-msg--bot { justify-content: flex-start; }

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.6;
}
.chat-bubble--user {
    background: var(--olive);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-bubble--bot {
    background: var(--gray-100);
    color: var(--charcoal);
    border-bottom-left-radius: 4px;
}
.chat-bubble--bot strong {
    color: var(--charcoal);
    font-weight: 700;
}

/* ── Typing indicator ── */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}
.chat-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Quick Replies ── */
.chat-quick-replies {
    padding: 0 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chat-qr {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--olive);
    background: transparent;
    color: var(--olive);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    white-space: nowrap;
}
.chat-qr:hover {
    background: var(--olive);
    color: var(--white);
}

/* ── Input ── */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
    align-items: center;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 24px;
    background: var(--gray-100);
    font-size: 0.875rem;
    color: var(--charcoal);
    border: 1.5px solid transparent;
    transition: border-color 0.3s;
}
.chat-input:focus {
    border-color: var(--olive);
    outline: none;
}
.chat-input::placeholder { color: var(--gray-400); }

.chat-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--olive);
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s var(--ease-out-expo);
}
.chat-send:hover {
    background: var(--olive-light);
    transform: scale(1.05);
}

/* ── Close button inside chat header ── */
.chat-header-close {
    display: flex;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}
.chat-header-close:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Mobile ── */
@media (max-width: 768px) {
    .chat-window {
        bottom: 0; right: 0; left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
    }
    .chat-toggle {
        bottom: 16px; right: 16px;
    }
    .chat-toggle.active {
        z-index: 10000;
        bottom: 16px; right: 16px;
    }
}
