/* WP Chatbot Builder - Frontend Styles */

/* Container */
#wp-chatbot-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#wp-chatbot-container.wp-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

#wp-chatbot-container.wp-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Bubble */
.wp-chatbot-bubble {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.wp-chatbot-bubble.wp-chatbot-bubble-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.wp-chatbot-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wp-chatbot-bubble-text {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

/* Chat Button */
.wp-chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: #0084ff;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.wp-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wp-chatbot-button-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.wp-chatbot-icon-close {
    display: none;
    position: absolute;
}

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

.wp-chatbot-button.active .wp-chatbot-icon-close {
    display: block;
}

/* Chat Window */
.wp-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.wp-chatbot-window.wp-chatbot-window-open {
    display: flex;
    animation: wp-chatbot-slideUp 0.3s ease;
}

@keyframes wp-chatbot-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.wp-chatbot-header {
    background: linear-gradient(135deg, #0084ff 0%, #0066cc 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.wp-chatbot-avatar svg {
    width: 24px;
    height: 24px;
}

.wp-chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wp-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.wp-chatbot-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.wp-chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
}

.wp-chatbot-minimize svg {
    width: 20px;
    height: 20px;
}

/* Messages Area */
.wp-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}

.wp-chatbot-message-wrapper {
    margin-bottom: 16px;
}

.wp-chatbot-message {
    display: inline-block;
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    animation: wp-chatbot-fadeIn 0.3s ease;
}

@keyframes wp-chatbot-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-chatbot-message-bot {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.wp-chatbot-message-user {
    background: #0084ff;
    color: white;
    float: right;
    border-bottom-right-radius: 4px;
}

.wp-chatbot-message-user-wrapper {
    text-align: right;
}

/* Buttons in messages */
.wp-chatbot-buttons {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wp-chatbot-option-button {
    background: white;
    border: 2px solid #0084ff;
    color: #0084ff;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.wp-chatbot-option-button:hover {
    background: #0084ff;
    color: white !important;
    border-color: #0084ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 132, 255, 0.3);
}

/* Typing indicator */
.wp-chatbot-typing {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.wp-chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: wp-chatbot-typing 1.4s infinite;
}

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

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

@keyframes wp-chatbot-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.wp-chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.wp-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wp-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.wp-chatbot-input:focus {
    border-color: #0084ff;
}

.wp-chatbot-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #0084ff;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wp-chatbot-send-button:hover {
    background: #0066cc;
    transform: scale(1.05);
}

.wp-chatbot-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wp-chatbot-send-button svg {
    width: 20px;
    height: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .wp-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 20px;
    }

    #wp-chatbot-container.wp-chatbot-bottom-left .wp-chatbot-window {
        left: 20px;
        right: auto;
    }
}

/* Scrollbar styling - Minimal and elegant */
.wp-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.wp-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wp-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.wp-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar */
.wp-chatbot-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* RTL Support for Hebrew and Arabic */
html[dir="rtl"] .wp-chatbot-message,
html[dir="rtl"] .wp-chatbot-input,
html[dir="rtl"] .wp-chatbot-option-button {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .wp-chatbot-input-wrapper {
    flex-direction: row-reverse;
}

html[dir="rtl"] .wp-chatbot-message-bot {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}

html[dir="rtl"] .wp-chatbot-message-user {
    float: left;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}
