/* Variables for easy theming */
:root {
    --wceb-primary: #2563eb;
    /* Royal Blue */
    --wceb-primary-dark: #1e40af;
    /* Dark Blue */
    --wceb-accent: #60a5fa;
    /* Light Blue */
    --wceb-bg: #ffffff;
    --wceb-text: #111827;
    /* Black */
    --wceb-text-light: #6b7280;
    --wceb-light-bg: #f3f4f6;
    --wceb-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --wceb-radius: 20px;
    --wceb-font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    --wceb-gradient: linear-gradient(135deg, #1e3a8a, #2563eb);
    /* Deep Blue Gradient */
    --wceb-safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* Reset & Font Consistency */
#wceb-chat-widget,
#wceb-chat-widget * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

#wceb-chat-widget input,
#wceb-chat-widget button,
#wceb-chat-widget textarea {
    font-family: var(--wceb-font);
}

/* Launcher Button */
#wceb-launcher-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wceb-gradient);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    z-index: 99999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#wceb-launcher-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.5);
}

/* Icon Animation */
.wceb-glass-anim {
    animation: wceb-search-scan 3s ease-in-out infinite;
    transform-origin: 14px 8px;
}

@keyframes wceb-search-scan {

    0%,
    100% {
        transform: rotate(0deg) translateX(0);
    }

    25% {
        transform: rotate(-15deg) translateX(-2px);
    }

    75% {
        transform: rotate(15deg) translateX(2px);
    }
}

/* Chat Widget Container */
#wceb-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 650px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--wceb-radius);
    box-shadow: var(--wceb-shadow);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    font-family: var(--wceb-font);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#wceb-chat-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Header */
#wceb-chat-header {
    background: var(--wceb-gradient);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

#wceb-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#wceb-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Chat Interface */
#wceb-chat-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Messages Area */
#wceb-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    background: var(--wceb-light-bg);
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

#wceb-chat-messages::-webkit-scrollbar {
    width: 5px;
}

#wceb-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.wceb-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    margin-top: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.bot-message {
    background: white;
    color: var(--wceb-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-message {
    background: var(--wceb-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
    border: none;
}

/* Clickable Options (Chips) */
.wceb-clickable-option {
    display: inline-block;
    background: white;
    color: var(--wceb-primary);
    border: 1px solid var(--wceb-primary);
    padding: 6px 14px;
    border-radius: 20px;
    margin: 4px 2px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wceb-clickable-option:hover {
    background: var(--wceb-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

/* Input Area */
#wceb-chat-input-area {
    position: relative;
    bottom: auto;
    flex-shrink: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.03);
}

#wceb-user-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #f3f4f6;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    background: #f9fafb;
}

#wceb-user-input:focus {
    border-color: var(--wceb-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

#wceb-send-btn {
    background: var(--wceb-primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

#wceb-send-btn:hover {
    background: var(--wceb-primary-dark);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
}

#wceb-upload-btn {
    background: #f3f4f6;
    color: var(--wceb-text-light);
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#wceb-upload-btn:hover {
    background: #e5e7eb;
    color: var(--wceb-primary);
}

/* Loading Dots */
.wceb-loading {
    display: flex;
    gap: 5px;
    padding: 12px 18px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    border-bottom-left-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wceb-dot {
    width: 8px;
    height: 8px;
    background: var(--wceb-primary);
    border-radius: 50%;
    opacity: 0.6;
    animation: wceb-bounce 1.4s infinite ease-in-out both;
}

@keyframes wceb-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Start Screen */
#wceb-start-screen {
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    text-align: center;
    background: white;
}

.wceb-intro-text h3 {
    color: var(--wceb-primary);
    font-size: 24px;
    margin-bottom: 10px;
}

#wceb-start-screen input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    font-family: inherit;
    transition: 0.2s;
}

#wceb-start-screen input:focus {
    border-color: var(--wceb-primary);
    outline: none;
}

#wceb-start-chat-btn {
    width: 100%;
    padding: 14px;
    background: var(--wceb-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

#wceb-start-chat-btn:hover {
    transform: translateY(-2px);
}

/* Quick Actions */
.wceb-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.wceb-action-btn {
    background: white;
    border: 1px solid #e5e7eb;
    color: var(--wceb-text);
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    flex: 1 1 auto;
    text-align: center;
}

.wceb-action-btn:hover {
    background: var(--wceb-primary);
    color: white;
    border-color: var(--wceb-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.2);
}

/* Responsive Mobile Styles */
@media (max-width: 480px) {
    #wceb-chat-widget {
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
        display: none;
        flex-direction: column;
    }

    #wceb-chat-widget.active {
        display: flex;
    }

    #wceb-chat-header {
        padding: 15px;
        padding-top: max(15px, env(safe-area-inset-top));
        border-radius: 0;
    }

    #wceb-chat-messages {
        padding: 15px;
        font-size: 15px;
    }

    #wceb-chat-input-area {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        border-top: 1px solid #eee;
    }

    #wceb-user-input {
        font-size: 16px;
    }

    #wceb-launcher-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        background: white;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
        color: var(--wceb-primary);
    }
}