/* استایل‌های اصلی ویجت چت بین */

/* متغیرهای CSS */
:root {
    --chatbin-primary: #0085ba;
    --chatbin-secondary: #333333;
    --chatbin-bg: #ffffff;
    --chatbin-border: #e0e0e0;
    --chatbin-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    --chatbin-radius: 12px;
    --chatbin-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ویجت اصلی */
.chatbin-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: rtl;
}

/* دکمه باز/بسته کردن */
.chatbin-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbin-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--chatbin-shadow);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chatbin-transition);
    position: relative;
    overflow: hidden;
}

.chatbin-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
}

.chatbin-toggle:active {
    transform: scale(0.95);
}

.chatbin-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.chatbin-toggle:hover::before {
    width: 120px;
    height: 120px;
}

.chatbin-icon-open,
.chatbin-icon-close {
    transition: var(--chatbin-transition);
    position: absolute;
}

.chatbin-icon-close {
    opacity: 0;
    transform: rotate(90deg);
}

.chatbin-widget.chatbin-active .chatbin-icon-open {
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbin-widget.chatbin-active .chatbin-icon-close {
    opacity: 1;
    transform: rotate(0);
}

/* پنجره چت */
.chatbin-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--chatbin-bg);
    border-radius: var(--chatbin-radius);
    box-shadow: var(--chatbin-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--chatbin-transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbin-widget.chatbin-active .chatbin-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* هدر چت */
.chatbin-header {
    background: var(--chatbin-primary);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

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

.chatbin-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbin-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbin-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.chatbin-status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: chatbin-pulse 2s infinite;
}

@keyframes chatbin-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.chatbin-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--chatbin-transition);
}

.chatbin-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* محتوای چت */
.chatbin-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbin-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.chatbin-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbin-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbin-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chatbin-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* پیام‌ها */
.chatbin-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: chatbin-message-in 0.3s ease-out;
}

@keyframes chatbin-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbin-message-user {
    flex-direction: row-reverse;
}

.chatbin-message-avatar {
    width: 36px;
    height: 36px;
    background: var(--chatbin-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.chatbin-message-user .chatbin-message-avatar {
    background: var(--chatbin-secondary);
}

.chatbin-message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 70%;
}

.chatbin-message-bubble {
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--chatbin-secondary);
    word-wrap: break-word;
}

.chatbin-message-user .chatbin-message-bubble {
    background: var(--chatbin-primary);
    color: white;
    border-top-left-radius: 18px;
    border-top-right-radius: 4px;
}

/* دکمه‌های سریع */
.chatbin-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chatbin-quick-btn {
    background: white;
    border: 1px solid var(--chatbin-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--chatbin-transition);
    color: var(--chatbin-secondary);
}

.chatbin-quick-btn:hover {
    background: var(--chatbin-primary);
    color: white;
    border-color: var(--chatbin-primary);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* فوتر چت */
.chatbin-footer {
    border-top: 1px solid var(--chatbin-border);
    padding: 16px;
    background: #fafafa;
}

.chatbin-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chatbin-input {
    flex: 1;
    border: 1px solid var(--chatbin-border);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    outline: none;
    transition: var(--chatbin-transition);
    background: white;
}

.chatbin-input:focus {
    border-color: var(--chatbin-primary);
    box-shadow: 0 0 0 3px rgba(0, 133, 186, 0.1);
}

.chatbin-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbin-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chatbin-transition);
}

.chatbin-send:hover {
    background: var(--chatbin-secondary);
    transform: scale(1.1);
}

.chatbin-send:active {
    transform: scale(0.95);
}

/* راه‌های ارتباطی */
.chatbin-contact-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.chatbin-contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    text-decoration: none;
    color: white;
    transition: var(--chatbin-transition);
    text-align: center;
}

.chatbin-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chatbin-telegram {
    background: #0088cc;
}

.chatbin-whatsapp {
    background: #25d366;
}

.chatbin-ticket {
    background: #ff9800;
}

.chatbin-phone {
    background: #4caf50;
}

.chatbin-mobile {
    background: #9c27b0;
}

/* کپی رایت */
.chatbin-powered {
    text-align: center;
    font-size: 11px;
    color: #999;
    padding-top: 8px;
}

.chatbin-powered a {
    color: var(--chatbin-primary);
    text-decoration: none;
    font-weight: 500;
}

.chatbin-powered a:hover {
    text-decoration: underline;
}

/* لودینگ */
.chatbin-loading {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
}

.chatbin-loading-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: chatbin-loading 1.4s infinite ease-in-out both;
}

.chatbin-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.chatbin-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes chatbin-loading {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* رسپانسیو */
@media (max-width: 480px) {
    .chatbin-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbin-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chatbin-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 0;
        border-radius: var(--chatbin-radius) var(--chatbin-radius) 0 0;
    }
    
    .chatbin-header {
        padding: 16px;
    }
    
    .chatbin-header-title {
        font-size: 14px;
    }
    
    .chatbin-messages {
        padding: 16px;
    }
    
    .chatbin-message-bubble {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* انیمیشن ورود برای مدال راه‌های ارتباطی */
.chatbin-contact-methods.chatbin-show {
    animation: chatbin-slide-up 0.3s ease-out;
}

@keyframes chatbin-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* حالت تایپ کردن */
.chatbin-typing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbin-typing-indicator {
    display: flex;
    gap: 4px;
}

.chatbin-typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: chatbin-typing 1.4s infinite ease-in-out both;
}

.chatbin-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes chatbin-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}
