/**
 * Woo AI Product Q&A - Frontend Stylesheet
 */

:root {
    --woo-ai-primary: #2563eb;
    --woo-ai-primary-hover: #1d4ed8;
    --woo-ai-header-bg: #0f172a;
    --woo-ai-bot-bg: #ffffff;
    --woo-ai-bot-border: #e2e8f0;
    --woo-ai-text-main: #1e293b;
    --woo-ai-text-muted: #64748b;
    --woo-ai-bg-panel: #f8fafc;
    --woo-ai-radius: 12px;
}

.woo-ai-chat-box,
.woo-ai-qa-container {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--woo-ai-bot-border);
    border-radius: var(--woo-ai-radius);
    overflow: hidden;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    box-sizing: border-box;
}

.woo-ai-chat-box *,
.woo-ai-qa-container * {
    box-sizing: border-box;
}

/* هدر چت */
.woo-ai-chat-header {
    background: var(--woo-ai-header-bg);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    user-select: none;
}

.woo-ai-chat-header .woo-ai-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s;
}

.woo-ai-chat-header .woo-ai-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* محوطه کپچای ریاضی */
.woo-ai-captcha-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    background: var(--woo-ai-bg-panel);
    text-align: center;
}

.woo-ai-captcha-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--woo-ai-text-main);
    margin: 0;
}

.woo-ai-captcha-question {
    font-size: 24px;
    font-weight: 800;
    color: var(--woo-ai-primary);
    background: #eff6ff;
    border: 2px dashed #93c5fd;
    padding: 8px 24px;
    border-radius: 10px;
    direction: ltr;
    display: inline-block;
    letter-spacing: 3px;
    user-select: none;
}

.woo-ai-captcha-form-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 260px;
    justify-content: center;
}

.woo-ai-captcha-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    outline: none;
    direction: ltr;
    background: #ffffff;
}

.woo-ai-captcha-input:focus {
    border-color: var(--woo-ai-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.woo-ai-captcha-btn {
    background: var(--woo-ai-primary);
    color: #ffffff;
    border: none;
    padding: 0 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s;
}

.woo-ai-captcha-btn:hover {
    background: var(--woo-ai-primary-hover);
}

.woo-ai-captcha-error {
    color: #dc2626;
    font-size: 12px;
    font-weight: 500;
}

/* پیام‌ها و اسکرول‌بار */
.woo-ai-chat-body,
.woo-ai-qa-messages {
    flex: 1;
    padding: 16px;
    background: var(--woo-ai-bg-panel);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.woo-ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.woo-ai-chat-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

/* حباب‌های گفتگو */
.woo-ai-msg {
    max-width: 82%;
    padding: 11px 15px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}

.woo-ai-msg.bot {
    background: var(--woo-ai-bot-bg);
    color: var(--woo-ai-text-main);
    border: 1px solid var(--woo-ai-bot-border);
    border-radius: 14px 14px 14px 3px;
    align-self: flex-start;
}

.woo-ai-msg.user {
    background: var(--woo-ai-primary);
    color: #ffffff;
    border-radius: 14px 14px 3px 14px;
    align-self: flex-end;
}

.woo-ai-msg.loading {
    color: var(--woo-ai-text-muted);
    font-style: italic;
    background: #f1f5f9;
}

.woo-ai-msg.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    align-self: center;
}

/* فرم ارسال پیام */
.woo-ai-chat-footer {
    display: flex;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid var(--woo-ai-bot-border);
    gap: 8px;
    align-items: center;
}

.woo-ai-chat-footer input[type="text"] {
    flex: 1;
    padding: 11px 14px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
}

.woo-ai-chat-footer input[type="text"]:focus {
    border-color: var(--woo-ai-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.woo-ai-chat-footer button {
    background: var(--woo-ai-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    height: 42px;
    cursor: pointer;
    font-weight: 600;
}

/* ویجت شناور */
#woo-ai-floating-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999999;
}

#woo-ai-trigger-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--woo-ai-primary);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.38);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#woo-ai-window {
    position: absolute;
    bottom: 74px;
    left: 0;
    z-index: 999999;
}

.woo-ai-chat-box.popup {
    width: 380px;
    height: 530px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}
/* رفع تداخل استایل دکمه بستن با قالب سایت */
.woo-ai-chat-header button.woo-ai-close-btn,
.woo-ai-chat-header #woo-ai-close-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-size: 26px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 4px !important;
    margin: 0 !important;
    min-width: auto !important;
    height: auto !important;
}

.woo-ai-chat-header button.woo-ai-close-btn:hover {
    color: #ef4444 !important;
}

/* نمایش واضح کادر سوال ریاضی */
.woo-ai-captcha-question {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #2563eb !important;
    background: #eff6ff !important;
    border: 2px dashed #93c5fd !important;
    padding: 8px 20px !important;
    border-radius: 10px !important;
    direction: ltr !important;
    display: inline-block !important;
    letter-spacing: 2px !important;
}
.woo-ai-chat-box.embedded {
    height: 420px;
    margin: 15px 0;
}

.woo-ai-chat-box.fullpage {
    width: 100%;
    height: 75vh;
    min-height: 520px;
    margin: 25px 0;
}

@media (max-width: 600px) {
    #woo-ai-floating-widget {
        bottom: 16px;
        left: 16px;
    }
    .woo-ai-chat-box.popup {
        width: calc(100vw - 32px);
        height: 78vh;
    }
}
