/* ==========================================================================
   SaniSafe Badkamers - Chatbot Widget Styles
   ========================================================================== */

/* Floating Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(122, 102, 82, 0.4);
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(122, 102, 82, 0.5);
}

.chatbot-toggle.active .chatbot-icon-chat {
    display: none;
}

.chatbot-toggle.active .chatbot-icon-close {
    display: block !important;
}

.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: var(--cta);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

.chatbot-badge.hidden {
    display: none;
}

/* Chat Panel */
.chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 9997;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease;
}

.chatbot-panel.open {
    display: flex;
}

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

/* Header */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--gradient-primary);
    color: #fff;
    flex-shrink: 0;
}

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

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

.chatbot-header-info strong {
    display: block;
    font-size: 0.95rem;
}

.chatbot-status {
    font-size: 0.8rem;
    opacity: 0.8;
}

.chatbot-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ADE80;
    border-radius: 50%;
    margin-right: 4px;
}

.chatbot-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px;
    transition: color 0.3s;
}

.chatbot-close:hover {
    color: #fff;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Bot Message */
.chat-msg {
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

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

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

.chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-msg-bot .chat-bubble {
    background: var(--bg-alt);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-msg-user .chat-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 70px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Buttons */
.chat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chat-btn {
    padding: 8px 16px;
    background: var(--bg);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.chat-btn:hover {
    background: var(--primary);
    color: #fff;
}

.chat-btn.selected {
    background: var(--primary);
    color: #fff;
    pointer-events: none;
}

/* Chat Form */
.chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-alt);
    border-radius: 12px;
}

.chat-form input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-form input:focus {
    border-color: var(--primary);
}

.chat-form-submit {
    padding: 10px 20px;
    background: var(--cta);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-form-submit:hover {
    background: var(--cta-hover);
}

/* Chat List */
.chat-list {
    margin-top: 8px;
}

.chat-list li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.85rem;
    color: var(--text-light);
}

.chat-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 10px;
    height: 5px;
    border-left: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(-45deg);
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Urgency Message */
.chat-urgency {
    background: #FFF7ED;
    border: 1px solid #FDBA74;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #9A3412;
    align-self: flex-start;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chatbot-toggle.active {
        display: none;
    }

    .chatbot-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 200000;
        animation: chatSlideUpMobile 0.3s ease;
    }

    @keyframes chatSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .chatbot-panel.open {
        bottom: 0;
    }

    .chatbot-panel.open ~ .floating-actions {
        display: none;
    }
}

/* Dark mode bubble variant (not used but ready) */
.chat-msg-bot .chat-bubble a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

/* Success state in chat */
.chat-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--primary);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    align-self: flex-start;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

.chat-success svg {
    flex-shrink: 0;
}

/* ====== Chatbot Input Bar ====== */
.chatbot-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.chatbot-input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chatbot-input-bar input:focus {
    border-color: #7A6652;
    box-shadow: 0 0 0 3px rgba(122, 102, 82, 0.1);
}

.chatbot-input-bar button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #7A6652;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.chatbot-input-bar button:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ====== Floating Action Buttons ====== */
.floating-actions {
    position: fixed;
    bottom: 24px;
    right: 96px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    z-index: 9998;
    align-items: center;
}

.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.fab-whatsapp {
    background: #25D366;
}

.fab-phone {
    background: #7A6652;
}

@media (max-width: 480px) {
    .floating-actions {
        right: 80px;
        bottom: 20px;
        gap: 8px;
    }
    .fab {
        width: 44px;
        height: 44px;
    }
}
