/*!
 * Online Chat Component Styles
 * File: assets/css/components/online-chat.css
 * Package: Caragps
 */

/* دکمه چت آنلاین - استایل‌های پایه */
.online-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'IRANSansX', 'Vazir', 'Tahoma', Arial, sans-serif;
    direction: rtl;
}

/* دکمه اصلی چت */
.chat-main-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

/* انیمیشن پالس حلقه‌ای */
.chat-main-btn::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid rgba(37, 211, 102, 0.6);
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
    opacity: 0.8;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* حالت‌های تعاملی دکمه اصلی */
.chat-main-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
}

.chat-main-btn:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

/* نشانگر پیام جدید */
.chat-notification {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #FF4444 0%, #CC0000 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    animation: bounce 1s ease-in-out infinite;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* منوی چت */
.chat-menu {
    position: absolute;
    bottom: 75px;
    right: 0;
    background: white;
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 300px;
    max-width: 350px;
    backdrop-filter: blur(20px);
}

/* حالت فعال منوی چت */
.online-chat.active .chat-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* انیمیشن ورودی تدریجی گزینه‌ها */
.online-chat.active .chat-option {
    animation: slideInUp 0.5s ease-out forwards;
}

.online-chat.active .chat-option:nth-child(1) { animation-delay: 0.1s; }
.online-chat.active .chat-option:nth-child(2) { animation-delay: 0.2s; }
.online-chat.active .chat-option:nth-child(3) { animation-delay: 0.3s; }
.online-chat.active .chat-option:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* هدر منو */
.chat-header {
    text-align: center;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E8EBF0;
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 2px;
}

.chat-header h4 {
    color: #1C1C2A;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.chat-header p {
    color: #64748B;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

/* گزینه‌های چت */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chat-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    border-radius: 16px;
    text-decoration: none;
    color: #334155;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

/* اثر نورانی هنگام هاور */
.chat-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.chat-option:hover::before {
    left: 100%;
}

/* حالت‌های تعاملی گزینه‌ها */
.chat-option:hover {
    transform: translateY(-3px) translateX(3px);
    border-color: rgba(37, 211, 102, 0.3);
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.05) 0%, rgba(18, 140, 126, 0.05) 100%);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.chat-option:active {
    transform: translateY(-1px) translateX(1px);
    transition: all 0.1s ease;
}

/* آیکون‌های گزینه‌ها */
.chat-option-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* رنگ‌های مخصوص هر پلتفرم */
.chat-option.whatsapp .chat-option-icon {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.chat-option.telegram .chat-option-icon {
    background: linear-gradient(135deg, #0088cc 0%, #005577 100%);
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
}

.chat-option.phone .chat-option-icon {
    background: linear-gradient(135deg, #007BFF 0%, #0056B3 100%);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.chat-option.email .chat-option-icon {
    background: linear-gradient(135deg, #EA4335 0%, #C5221F 100%);
    box-shadow: 0 4x 15px rgba(234, 67, 53, 0.3);
}

/* انیمیشن چرخشی آیکون هنگام هاور */
.chat-option-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translate(-50%, -50%);
    animation: rotate-icon 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-option:hover .chat-option-icon::after {
    opacity: 1;
}

@keyframes rotate-icon {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* محتوای گزینه */
.chat-option-content {
    flex: 1;
    min-width: 0;
}

.chat-option-content h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 0.3rem;
    line-height: 1.2;
    transition: color 0.3s ease;
}

.chat-option:hover .chat-option-content h5 {
    color: #0F172A;
}

.chat-option-content p {
    font-size: 0.85rem;
    color: #64748B;
    margin: 0 0 0.4rem 0;
    line-height: 1.4;
    font-weight: 500;
}

/* وضعیت آنلاین/آفلاین */
.online-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #10B981;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}

.status-dot.busy {
    background: #F59E0B;
}

.status-dot.offline {
    background: #EF4444;
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.online-status span {
    color: #059669;
    font-weight: 600;
}

.status-dot.busy + span {
    color: #D97706;
}

.status-dot.offline + span {
    color: #DC2626;
}

/* دکمه بستن */
.chat-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748B;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.chat-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border-color: rgba(239, 68, 68, 0.2);
    transform: rotate(90deg) scale(1.1);
}

/* فوتر منو */
.chat-footer {
    text-align: center;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid #E8EBF0;
}

.chat-footer p {
    font-size: 0.75rem;
    color: #94A3B8;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ریسپانسیو تبلت */
@media (max-width: 1024px) {
    .online-chat {
        bottom: 25px;
        right: 25px;
    }

    .chat-menu {
        min-width: 280px;
        right: -10px;
    }
}

/* ریسپانسیو موبایل */
@media (max-width: 768px) {
    .online-chat {
        bottom: 100px; /* فاصله بیشتر از دکمه بازگشت به بالا */
        right: 20px;
    }

    .chat-main-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .chat-menu {
        min-width: 260px;
        bottom: 65px;
        right: -15px;
        padding: 1rem;
    }

    .chat-option {
        padding: 1rem;
        gap: 0.8rem;
    }

    .chat-option-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .chat-header h4 {
        font-size: 1.2rem;
    }

    .chat-notification {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
}

/* ریسپانسیو موبایل کوچک */
@media (max-width: 480px) {
    .online-chat {
        bottom: 90px;
        right: 15px;
    }

    .chat-menu {
        min-width: 240px;
        right: -25px;
        padding: 0.9rem;
        bottom: 60px;
    }

    .chat-option-content h5 {
        font-size: 1rem;
    }

    .chat-option-content p {
        font-size: 0.8rem;
    }

    .online-status {
        font-size: 0.7rem;
    }

    .status-dot {
        width: 6px;
        height: 6px;
    }
}

/* تم تیره (اختیاری) */
@media (prefers-color-scheme: dark) {
    .chat-menu {
        background: #1E293B;
        border-color: #334155;
    }

    .chat-header h4 {
        color: #F1F5F9;
    }

    .chat-header p {
        color: #94A3B8;
    }

    .chat-option {
        background: linear-gradient(135deg, #2D3748 0%, #1A202C 100%);
        color: #E2E8F0;
    }

    .chat-option:hover {
        background: linear-gradient(135deg, rgba(37, 211, 102, 0.1) 0%, rgba(18, 140, 126, 0.1) 100%);
    }

    .chat-option-content h5 {
        color: #F7FAFC;
    }

    .chat-option-content p {
        color: #A0AEC0;
    }

    .chat-footer p {
        color: #718096;
    }

    .chat-close {
        background: rgba(255, 255, 255, 0.1);
        color: #A0AEC0;
    }
}

/* بهینه‌سازی عملکرد */
.online-chat * {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* اسکرول بار سفارشی برای منوهای طولانی */
.chat-options::-webkit-scrollbar {
    width: 4px;
}

.chat-options::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

.chat-options::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.chat-options::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* افکت‌های ویژه هنگام بارگذاری */
.chat-option.loading .chat-option-icon {
    animation: rotate-loading 1s linear infinite;
}

@keyframes rotate-loading {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* پشتیبانی از موشن کمتر */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

