/* ==========================================================================
   Website On-Page AI Chatbot & WhatsApp Widget CSS
   Module: frontend / chatbot-widget
   ========================================================================== */

#solar-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Window Popup */
#solar-chat-window {
    display: none;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 530px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: chatSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#solar-chat-window.active {
    display: flex;
}

/* Chat Header */
#solar-chat-header {
    background: linear-gradient(135deg, var(--primary-dark, #ea580c) 0%, var(--primary, #f97316) 100%);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
}

.solar-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.solar-header-info {
    display: flex;
    flex-direction: column;
}

.solar-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.solar-header-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.solar-header-status {
    font-size: 11px;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.solar-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px #ffffff;
}

.solar-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.solar-wa-switch-link {
    color: #ffffff;
    opacity: 0.85;
    padding: 4px;
    display: flex;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.solar-wa-switch-link:hover {
    opacity: 1;
}

.solar-chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s ease;
}

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

/* Chat Messages Stream */
#solar-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.solar-msg-row-bot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.solar-bot-bubble {
    max-width: 88%;
    padding: 12px 14px;
    background: #ffffff;
    color: #1e293b;
    border-radius: 14px;
    border-bottom-left-radius: 2px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    word-break: break-word;
}

.solar-msg-row-user {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.solar-user-bubble {
    max-width: 82%;
    padding: 10px 14px;
    background: var(--primary, #f97316);
    color: #ffffff;
    border-radius: 14px;
    border-bottom-right-radius: 2px;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    word-break: break-word;
    transition: background 0.3s ease;
}

/* Quick Action Chips */
.solar-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.solar-chip-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.solar-chip-btn:hover {
    background: var(--primary-bg, #fff7ed);
    border-color: var(--primary-border, #fed7aa);
    color: var(--primary-dark, #ea580c);
    transform: translateY(-1px);
}

.solar-chip-btn.highlighted {
    background: var(--primary-bg, #fff7ed);
    border-color: var(--primary-border, #fed7aa);
    color: var(--primary-dark, #ea580c);
    font-weight: 600;
}

/* Typing Indicator */
#solar-typing-indicator {
    display: none;
    padding: 6px 16px;
    background: #f8fafc;
    font-size: 11px;
    color: #64748b;
    align-items: center;
    gap: 6px;
}

#solar-typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: var(--primary, #64748b);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

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

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

/* Chat Input Bar */
#solar-chat-form {
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

#solar-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#solar-chat-input:focus {
    border-color: var(--primary, #f97316);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 249, 115, 22), 0.15);
}

#solar-chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary, #f97316);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb, 249, 115, 22), 0.4);
    transition: all 0.2s ease;
}

#solar-chat-send-btn:hover {
    transform: scale(1.05);
}

/* Floating Toggle Button & Pill */
#solar-chat-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

#solar-chat-pill {
    display: flex;
    align-items: center;
    background: #ffffff;
    color: #1e293b;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    animation: bounceIn 0.8s ease;
}

#solar-chat-pill.hidden {
    display: none !important;
}

.solar-chat-pill-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary, #f97316);
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 1.5s infinite;
}

#solar-chat-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-dark, #ea580c) 0%, var(--primary, #f97316) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(var(--primary-rgb, 249, 115, 22), 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

#solar-chat-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(var(--primary-rgb, 249, 115, 22), 0.6);
}

/* Keyframes */
@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

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

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    #solar-chat-pill {
        display: none !important;
    }
    #solar-chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 90px);
        position: fixed;
        bottom: 80px;
        right: 12px;
    }
}
