/* Public styles for Chatbot Pro */
#cbp-widget-root {
    position: fixed;
    z-index: 999999;
    font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
}

/* Positions */
.cbp-position-bottom-right {
    bottom: 20px;
    right: 20px;
}
.cbp-position-bottom-left {
    bottom: 20px;
    left: 20px;
}
.cbp-position-top-right {
    top: 20px;
    right: 20px;
}
.cbp-position-top-left {
    top: 20px;
    left: 20px;
}

/* Launcher button */
.cbp-launcher {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4f46e5;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
    animation: cbp-pop-in 0.45s ease-out;
}

.cbp-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.4);
}

.cbp-launcher-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

.cbp-launcher-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, #ffffff, rgba(255,255,255,0.1));
}

.cbp-launcher-icon svg {
    width: 18px;
    height: 18px;
}

/* Chat window */
.cbp-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    left: auto;
    width: 360px;
    max-width: 92vw;
    max-height: 520px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: cbp-window-in 0.25s ease-out;
}

.cbp-chat-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(79,70,229,1), rgba(56,189,248,1));
    color: #fff;
}

.cbp-chat-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cbp-chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cbp-chat-avatar svg {
    width: 20px;
    height: 20px;
}

.cbp-chat-header-text {
    display: flex;
    flex-direction: column;
}

.cbp-chat-title {
    font-size: 13px;
    font-weight: 700;
}

.cbp-chat-subtitle {
    font-size: 11px;
    opacity: 0.9;
}

.cbp-chat-close {
    background: transparent;
    border: none;
    color: #e5e7eb;
    cursor: pointer;
    padding: 4px;
}

/* Messages */
.cbp-chat-body {
    padding: 10px 12px;
    background: #f3f4f6;
    flex: 1;
    overflow-y: auto;
}

.cbp-message {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

.cbp-message-meta {
    font-size: 10px;
    margin-bottom: 3px;
    color: #6b7280;
}

.cbp-message-text {
    border-radius: 14px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cbp-message-user {
    align-items: flex-end;
    margin-left: 0;
    margin-right: auto;
}

.cbp-message-user .cbp-message-text {
    background: #4f46e5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cbp-message-bot {
    align-items: flex-start;
}

.cbp-message-bot .cbp-message-text {
    background: #ffffff;
    color: #111827;
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.cbp-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cbp-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #9ca3af;
    animation: cbp-typing 1s infinite ease-in-out;
}

.cbp-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}
.cbp-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

/* Footer input */
.cbp-chat-footer {
    border-top: 1px solid #e5e7eb;
    padding: 8px 10px;
    background: #ffffff;
}

.cbp-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.cbp-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    font-size: 16px; /* مهم برای جلوگیری از زوم ناخواسته در موبایل (iOS) */
    resize: none;
    max-height: 80px;
}

.cbp-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4f46e5;
    color: #fff;
}

.cbp-send-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Status & errors */
.cbp-status-bar {
    font-size: 11px;
    color: #6b7280;
    padding: 4px 10px 6px;
}

.cbp-status-error {
    color: #b91c1c;
}

/* Sizes */
.cbp-size-small .cbp-chat-window {
    width: 300px;
    max-height: 420px;
}

.cbp-size-medium .cbp-chat-window {
    width: 360px;
    max-height: 520px;
}

.cbp-size-large .cbp-chat-window {
    width: 420px;
    max-height: 580px;
}

/* Dark mode */
.cbp-dark .cbp-chat-window {
    background: #020617;
    color: #e5e7eb;
    box-shadow: 0 24px 70px rgba(0,0,0,0.85);
}

.cbp-dark .cbp-chat-body {
    background: #020617;
}

.cbp-dark .cbp-message-bot .cbp-message-text {
    background: #111827;
    color: #e5e7eb;
}

.cbp-dark .cbp-message-user .cbp-message-text {
    background: #4f46e5;
}

.cbp-dark .cbp-chat-footer {
    background: #020617;
    border-color: #111827;
}

.cbp-dark .cbp-input {
    background: #020617;
    color: #e5e7eb;
    border-color: #1f2937;
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .cbp-chat-window {
        bottom: 80px;
        right: 0;
        left: auto;
        width: calc(100vw - 24px);
        max-height: 80vh;
    }
}

/* Animations */
@keyframes cbp-pop-in {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes cbp-window-in {
    0% { transform: translateY(20px) scale(0.96); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cbp-typing {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-3px); opacity: 1; }
}

/* Iran block overlay */
.cbp-iran-block {
    font-size: 12px;
    color: #b91c1c;
    background: #fee2e2;
    border-radius: 10px;
    padding: 6px 10px;
    margin: 4px 10px 8px;
}


/* Small credit text */
.cbp-chat-credit {
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.6;
    text-align: center;
    direction: rtl;
}
.cbp-chat-credit a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.5);
}


.cbp-launcher-icon img.cbp-icon-image,
.cbp-chat-avatar img.cbp-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}



/* Pre-chat form */
.cbp-prechat {
    margin: 4px 0 6px;
    padding: 6px 8px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(56, 189, 248, 0.04));
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.cbp-prechat-title {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #0f172a;
}

.cbp-prechat-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #ffffff;
    font-size: 16px; /* مهم برای جلوگیری از زوم ناخواسته در موبایل */
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.cbp-prechat-input::placeholder {
    color: #9ca3af;
}

.cbp-prechat-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.22);
    background-color: #ffffff;
}

.cbp-prechat-buttons {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.cbp-prechat-submit,
.cbp-prechat-skip {
    flex: 1;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 8px;
}

.cbp-prechat-submit {
    background: #4f46e5;
    color: #fff;
}

.cbp-prechat-skip {
    background: rgba(148, 163, 184, 0.15);
    color: #475569;
}
/* Disable input when pre-chat is required */
.cbp-input-wrap.cbp-input-disabled {
    opacity: 0.5;
    pointer-events: none;
}


/* Override credit visibility for customizable text */
.cbp-chat-credit {
    display: none;
}
.cbp-chat-credit.cbp-chat-credit-custom {
    display: block;
}
