/* ===== Live Chat Widget ===== */

/* Floating Bubble */
.chat-bubble {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(22, 163, 74, 0.5);
}

.chat-bubble .chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid white;
    display: none;
}

.chat-bubble .chat-badge.show {
    display: flex;
}

@keyframes chatPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.chat-bubble.pulse {
    animation: chatPulse 2s infinite;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 180px;
    left: 30px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chat-header-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

.chat-header-text p {
    font-size: 11px;
    opacity: 0.85;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Body */
.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Name/Email Form */
.chat-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-form h4 {
    font-size: 16px;
    color: #1a1a1a;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

.chat-form p {
    font-size: 13px;
    color: #666;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

.chat-form input {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.chat-form input:focus {
    border-color: #16a34a;
}

.chat-form-btn {
    padding: 12px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: opacity 0.2s;
}

.chat-form-btn:hover {
    opacity: 0.9;
}

.chat-form-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success State */
.chat-success {
    padding: 10px 20px 20px;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8faf5;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Message Bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: chatMsgIn 0.3s ease;
}

@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.visitor {
    align-self: flex-end;
}

.chat-msg.admin {
    align-self: flex-start;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    font-family: 'Poppins', sans-serif;
}

.chat-msg.visitor .chat-msg-bubble {
    background: #16a34a;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg.admin .chat-msg-bubble {
    background: white;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-msg-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-msg.visitor .chat-msg-time {
    text-align: right;
}

/* Typing Indicator */
.chat-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 14px;
    background: white;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-typing.show {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Footer */
.chat-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.chat-footer input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.chat-footer input:focus {
    border-color: #16a34a;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    opacity: 0.9;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-bubble {
        bottom: 90px;
        left: 20px;
        width: 55px;
        height: 55px;
    }
}
