/* ویجت چت پشتیبانی ابر باران - طراحی مدرن */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

.abrbaran-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Vazirmatn', 'IRANSans', -apple-system, BlinkMacSystemFont, sans-serif;
    direction: rtl;
}

/* دکمه چت با انیمیشن موج */
.abrbaran-chat-button {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 255, 204, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.abrbaran-chat-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s;
}

.abrbaran-chat-button:hover::before {
    transform: translate(-50%, -50%) scale(2);
}

.abrbaran-chat-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 255, 204, 0.5);
    border-radius: 25px;
}

.abrbaran-chat-button svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
    z-index: 1;
    position: relative;
}

/* انیمیشن پالس */
.abrbaran-chat-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 30px;
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    z-index: -1;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* پنجره چت - طراحی مدرن */
.abrbaran-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 400px;
    height: 600px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.abrbaran-chat-window.active {
    display: flex;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* هدر چت - طراحی گرادیانت زیبا */
.abrbaran-chat-header {
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    color: #ffffff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(6, 130, 124, 0.2);
}

.abrbaran-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.abrbaran-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.abrbaran-chat-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
}

.abrbaran-chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.abrbaran-chat-title h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.abrbaran-chat-title span {
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.abrbaran-online-indicator {
    width: 8px;
    height: 8px;
    background: #4cff50;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(76, 255, 80, 0.3);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(76, 255, 80, 0.3);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(76, 255, 80, 0.1);
    }
}

/* دکمه بستن - طراحی واضح با ضربدر */
.abrbaran-chat-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.abrbaran-chat-close:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: rotate(90deg) scale(1.1);
    border-color: #ffffff;
}

.abrbaran-chat-close::before,
.abrbaran-chat-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #ffffff;
    transition: background 0.3s;
}

.abrbaran-chat-close:hover::before,
.abrbaran-chat-close:hover::after {
    background: #06827c;
}

.abrbaran-chat-close::before {
    transform: rotate(45deg);
}

.abrbaran-chat-close::after {
    transform: rotate(-45deg);
}

.abrbaran-chat-close svg {
    display: none; /* مخفی کردن SVG قدیمی */
}

/* فرم ورود - طراحی مینیمال */
.abrbaran-chat-login {
    padding: 35px 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
}

.abrbaran-chat-login h4 {
    color: #06827c;
    margin-bottom: 25px;
    text-align: center;
    font-size: 19px;
    font-weight: 600;
    position: relative;
}

.abrbaran-chat-login h4::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #00ffcc, #06827c);
    border-radius: 2px;
}

.abrbaran-form-group {
    margin-bottom: 20px;
    position: relative;
}

.abrbaran-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.abrbaran-form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    background: #ffffff;
}

.abrbaran-form-group input:focus {
    outline: none;
    border-color: #00ffcc;
    box-shadow: 0 0 0 4px rgba(0, 255, 204, 0.1);
    transform: translateY(-2px);
}

.abrbaran-form-group input:focus + label {
    color: #06827c;
}

.abrbaran-chat-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
}

.abrbaran-chat-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    transition: transform 0.5s;
}

.abrbaran-chat-submit:hover::before {
    transform: translate(-50%, -50%) scale(2);
}

.abrbaran-chat-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 255, 204, 0.3);
}

/* ناحیه چت - با اسکرول بهینه */
.abrbaran-chat-area {
    flex: 1;
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.abrbaran-chat-area.active {
    display: flex;
}

/* ناحیه پیام‌ها - مهم: با ارتفاع ثابت و اسکرول */
.abrbaran-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto !important;
    overflow-x: hidden;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    position: relative;
    scroll-behavior: smooth;
}

/* حل مشکل ارتفاع و اسکرول */
.abrbaran-chat-area.active .abrbaran-chat-messages {
    height: calc(100% - 140px); /* کم کردن ارتفاع input area و typing */
    max-height: 400px;
    min-height: 300px;
}

/* پیام‌ها - طراحی مدرن با سایه */
.abrbaran-message {
    margin-bottom: 16px;
    display: flex;
    animation: messageSlide 0.3s ease-out;
    position: relative;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.abrbaran-message.user {
    justify-content: flex-start;
}

.abrbaran-message.bot {
    justify-content: flex-end;
}

.abrbaran-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.abrbaran-message.user .abrbaran-message-content {
    background: #ffffff;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-right-radius: 6px;
    margin-right: 8px;
}

.abrbaran-message.bot .abrbaran-message-content {
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    color: #ffffff;
    border-bottom-left-radius: 6px;
    margin-left: 8px;
    box-shadow: 0 3px 12px rgba(0, 255, 204, 0.25);
}

/* نشانگر دنباله پیام */
.abrbaran-message.user .abrbaran-message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid #ffffff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.abrbaran-message.bot .abrbaran-message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -6px;
    width: 0;
    height: 0;
    border-right: 6px solid #06827c;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.abrbaran-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
}

/* انیمیشن تایپینگ */
.abrbaran-typing {
    padding: 12px 20px;
    display: none;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

.abrbaran-typing.active {
    display: flex;
    align-items: center;
    gap: 8px;
}

.abrbaran-typing-dots {
    display: flex;
    gap: 4px;
}

.abrbaran-typing-dots span {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.abrbaran-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.abrbaran-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.abrbaran-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ناحیه ارسال پیام */
.abrbaran-chat-input-area {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.abrbaran-chat-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.abrbaran-call-request {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.1) 0%, rgba(6, 130, 124, 0.1) 100%);
    color: #06827c;
    border: 2px solid #06827c;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.abrbaran-call-request:hover {
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 204, 0.3);
}

.abrbaran-chat-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.abrbaran-chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e8e8e8;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.abrbaran-chat-input:focus {
    outline: none;
    border-color: #00ffcc;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 255, 204, 0.1);
}

.abrbaran-chat-send {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.abrbaran-chat-send::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    transition: transform 0.5s;
}

.abrbaran-chat-send:hover::before {
    transform: translate(-50%, -50%) scale(2);
}

.abrbaran-chat-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0, 255, 204, 0.4);
}

.abrbaran-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.abrbaran-chat-send svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
    transform: rotate(-45deg);
}

/* اسکرول بار سفارشی */
.abrbaran-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.abrbaran-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.abrbaran-chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00ffcc 0%, #06827c 100%);
    border-radius: 10px;
}

.abrbaran-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #06827c;
}

/* فایرفاکس */
.abrbaran-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #06827c #f1f1f1;
}

/* دکمه اسکرول به پایین */
.abrbaran-scroll-bottom {
    position: absolute;
    bottom: 145px;
    right: 25px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 2px solid #00ffcc;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.abrbaran-scroll-bottom:hover {
    background: linear-gradient(135deg, #00ffcc 0%, #06827c 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 204, 0.3);
}

.abrbaran-scroll-bottom svg {
    width: 20px;
    height: 20px;
    fill: #06827c;
}

.abrbaran-scroll-bottom:hover svg {
    fill: #ffffff;
    animation: arrowBounce 0.6s ease-in-out;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* پیام‌های سیستم */
.abrbaran-system-message {
    text-align: center;
    padding: 12px;
    margin: 12px 0;
}

.abrbaran-system-message span {
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.15) 0%, rgba(6, 130, 124, 0.15) 100%);
    color: #06827c;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(6, 130, 124, 0.2);
}

/* نوتیفیکیشن بج */
.abrbaran-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #ff5252 0%, #ff1744 100%);
    color: #ffffff;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 23, 68, 0.4);
    animation: badgePopIn 0.3s ease-out;
}

@keyframes badgePopIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* پیام خطا */
.abrbaran-error-message {
    background: linear-gradient(135deg, #ff5252 0%, #ff1744 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(255, 23, 68, 0.3);
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ریسپانسیو موبایل */
@media (max-width: 480px) {
    .abrbaran-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        position: fixed;
        max-height: 100vh;
    }
    
    .abrbaran-chat-button {
        width: 60px;
        height: 60px;
        bottom: 15px;
        right: 15px;
    }
    
    .abrbaran-chat-area.active .abrbaran-chat-messages {
        height: calc(100vh - 220px);
        max-height: calc(100vh - 220px);
    }
    
    .abrbaran-chat-close {
        width: 40px;
        height: 40px;
    }
    
    .abrbaran-chat-close::before,
    .abrbaran-chat-close::after {
        width: 20px;
    }
}

/* انیمیشن ورود برای موبایل */
@media (max-width: 480px) {
    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}