/* ============================================================
   ALLROUND SOLUTIONS — CHAT WIDGET
   ============================================================ */

/* Round Chat Button */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--green, #1e3b2f);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(30, 59, 47, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 9998;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(30, 59, 47, 0.45);
}
.chat-button .chat-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--green, #1e3b2f);
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    white-space: nowrap;
}
.chat-button .badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}
.chat-button .badge-dot.show { display: block; }

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}
.chat-window.open { display: flex; }

/* Header */
.chat-header {
    background: var(--green, #1e3b2f);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.chat-header-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}
.chat-header-text span {
    font-size: 0.72rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-header-text .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4cd964;
    display: inline-block;
}
.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.chat-close:hover { opacity: 1; }

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f7f4ef;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb {
    background: #d9d0c5;
    border-radius: 3px;
}

/* Message Bubbles */
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-wrap: break-word;
    animation: msgIn 0.25s ease;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot {
    background: #fff;
    color: #2b2b2b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-msg.user {
    background: var(--green, #1e3b2f);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg.agent {
    background: #e7ede9;
    color: #1e3b2f;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #c9d6cf;
}
.chat-msg .msg-time {
    display: block;
    font-size: 0.66rem;
    opacity: 0.55;
    margin-top: 4px;
}

/* Quick Reply Buttons */
.chat-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px;
    background: #f7f4ef;
    flex-shrink: 0;
    max-height: 200px;
    overflow-y: auto;
}
.chat-quick-btn {
    background: #fff;
    border: 1px solid #e3ddd4;
    color: #1e3b2f;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chat-quick-btn:hover {
    border-color: var(--green, #1e3b2f);
    background: #f0f4f1;
    transform: translateX(2px);
}
.chat-quick-btn.whatsapp {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}
.chat-quick-btn.whatsapp:hover {
    background: #20bd5a;
    border-color: #20bd5a;
}
.chat-quick-btn.agent {
    background: var(--green, #1e3b2f);
    color: #fff;
    border-color: var(--green, #1e3b2f);
}
.chat-quick-btn.agent:hover {
    background: #2a5a47;
    border-color: #2a5a47;
}

/* Input Area */
.chat-input-area {
    display: none;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e3ddd4;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.chat-input-area.active { display: flex; }
.chat-input {
    flex: 1;
    border: 1px solid #e3ddd4;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--green, #1e3b2f); }
.chat-send {
    background: var(--green, #1e3b2f);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: background 0.2s;
    flex-shrink: 0;
}
.chat-send:hover { background: #2a5a47; }

/* Agent Notice */
.chat-agent-notice {
    background: #fff3cd;
    color: #856404;
    padding: 10px 16px;
    font-size: 0.78rem;
    text-align: center;
    border-bottom: 1px solid #ffeaa7;
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 96px;
        height: calc(100vh - 120px);
        max-height: none;
    }
    .chat-button {
        bottom: 16px;
        right: 16px;
        width: 58px;
        height: 58px;
        font-size: 1.3rem;
    }
}