* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
}

/* ویجت چت */
.chat-widget {
    position: fixed;
    bottom: 65px;
    right: 6px;
    width: 51px;
    height: 51px;
    background: #FFFFFF;
    border: 1px solid #FFFFFF;
    border-radius: 15px;
    padding: 2px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(44, 29, 59, 0.2);
    animation: gentleBounce 2.5s ease-in-out infinite, colorShift 4s ease-in-out infinite;
}

.chat-widget:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 8px 35px rgba(44, 29, 59, 0.4), 0 0 0 15px rgba(44, 29, 59, 0.1);
    animation-play-state: paused;
    border-color: #6B3A7A;
}

.chat-widget img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
}

/* انیمیشن جدید و جذاب */
@keyframes gentleBounce {
    0%, 100% {
        transform: translateY(0px) scale(1);
        box-shadow: 0 4px 20px rgba(44, 29, 59, 0.2);
    }
    50% {
        transform: translateY(-5px) scale(1.02);
        box-shadow: 0 8px 25px rgba(44, 29, 59, 0.3);
    }
}

/* انیمیشن چرخش ملایم */
@keyframes subtleRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* انیمیشن تغییر رنگ */
@keyframes colorShift {
    0% {
        border-color: #2C1D3B;
        box-shadow: 0 4px 20px rgba(44, 29, 59, 0.2);
    }
    25% {
        border-color: #4A2C5A;
        box-shadow: 0 4px 20px rgba(74, 44, 90, 0.25);
    }
    50% {
        border-color: #6B3A7A;
        box-shadow: 0 4px 20px rgba(107, 58, 122, 0.3);
    }
    75% {
        border-color: #4A2C5A;
        box-shadow: 0 4px 20px rgba(74, 44, 90, 0.25);
    }
    100% {
        border-color: #2C1D3B;
        box-shadow: 0 4px 20px rgba(44, 29, 59, 0.2);
    }
}

/* تولتیپ */
.tooltip {
    position: absolute;
    bottom: 55px;
    right: 0;
    background: #2C1D3B;
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid #FFFFFF;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 5px solid transparent;
    border-top-color: #2C1D3B;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* پس‌زمینه بلور */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* چت‌باکس */
.chat-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 400px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* هدر چت */
.chat-header {
    background: linear-gradient(135deg, #2C1D3B 0%, #4A2C5A 50%, #6B3A7A 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 4px 20px rgba(44, 29, 59, 0.3);
}

.chat-header .header-buttons {
    flex: 0 0 auto;
}

.chat-header .title-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.chat-header .spacer {
    flex: 0 0 auto;
    width: 0;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    border-radius: 20px 20px 0 0;
}

.chat-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 3s infinite;
    border-radius: 20px 20px 0 0;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.chat-header h3 {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex: 1;
    margin: 0;
    color: white; /* رنگ سفید برای عنوان */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header .status-indicator {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
    margin-left: 8px;
}

/* دکمه‌های هدر */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.email-button, .telegram-button, .whatsapp-button, .close-button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 18px;
    font-weight: bold;
    z-index: 99;
}

.email-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.telegram-button:hover {
    background: #0088cc;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.4);
}

.whatsapp-button:hover {
    background: #25D366;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.email-button svg, .telegram-button svg, .whatsapp-button svg {
    transition: all 0.3s ease;
}

.email-button:hover svg, .telegram-button:hover svg, .whatsapp-button:hover svg {
    transform: scale(1.1);
}

@keyframes pulse-green {
    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);
    }
}

/* محتوای چت */
.chat-content {
    flex: 1;
    padding: 5px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px; /* فاصله استاندارد 3px بین پیام‌ها */
}

.message {
    padding: 12px 16px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
    text-align: justify;
    line-height: 1.6;
}

.bot-message {
    background: #EEEEEE;
    color: #333;
    align-self: flex-start;
    border-bottom-right-radius: 5px;
}

.user-message {
    background: #2C1D3B;
    color: white;
    align-self: flex-end;
    border-bottom-left-radius: 5px;
}

/* نوار تایپ */
.chat-input-container {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
}

.chat-input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    direction: rtl;
    background: white;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: #2C1D3B;
    box-shadow: 0 0 0 3px rgba(44, 29, 59, 0.1);
}

.chat-input::placeholder {
    color: #999;
    text-align: right;
}

/* فرم لید */
.lead-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 30px;
}

.lead-form.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.lead-form h3 {
    color: #2C1D3B;
    margin-bottom: 20px;
    text-align: center;
    font-size: 18px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    direction: rtl;
}

.form-group input:focus {
    border-color: #2C1D3B;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #2C1D3B;
    color: white;
}

.btn-primary:hover {
    background: #4A2C5A;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* لینک‌ها */
a {
    color: #2C1D3B;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    text-decoration: underline;
}

/* هانی پات */
.honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

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

.chat-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-content::-webkit-scrollbar-thumb {
    background: #2C1D3B;
    border-radius: 3px;
}

/* سوالات پرتکرار */
.quick-questions {
    margin: 15px 0;
    padding: 0 5px;
}

.quick-questions-title {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #2C1D3B;
    text-align: center;
}

.quick-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.quick-question-btn {
    background: white; /* پس‌زمینه سفید */
    color: #333; /* متن تیره */
    border: 1px solid #2C1D3B; /* بردر بنفش */
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(44, 29, 59, 0.1);
    white-space: nowrap;
}

.quick-question-btn:hover {
    background: #2C1D3B; /* پس‌زمینه بنفش در هور */
    color: white; /* متن سفید در هور */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 29, 59, 0.3);
}

.quick-question-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(44, 29, 59, 0.2);
}

/* انیمیشن برای مخفی کردن سوالات */
.quick-questions.hidden {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

/* سوالات مرتبط */
.related-questions {
    margin: 15px 0;
    padding: 0 5px;
    animation: slideInUp 0.5s ease;
}

.related-questions-title {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #2C1D3B;
    text-align: center;
}

.related-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.related-question-btn {
    background: white; /* پس‌زمینه سفید */
    color: #333; /* متن تیره */
    border: 1px solid #2C1D3B; /* بردر بنفش */
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74, 44, 90, 0.1);
    white-space: nowrap;
}

.related-question-btn:hover {
    background: #2C1D3B; /* پس‌زمینه بنفش در هور */
    color: white; /* متن سفید در هور */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 44, 90, 0.3);
}

.related-question-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 44, 90, 0.2);
}

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

/* ریسپانسیو */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100% - 48px); /* 24px از هر طرف */
        height: calc(100% - 48px); /* 24px از هر طرف */
        max-width: none;
        max-height: none;
    }

    .chat-header {
        padding: 15px 20px;
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }

    .chat-header .title-section {
        justify-content: flex-start;
        margin-left: 10px;
        gap: 10px;
        align-items: center;
    }

    .chat-header h3 {
        font-size: 18px;
        margin: 0;
        color: white; /* رنگ سفید برای عنوان */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
    }

    .chat-header .status-indicator { margin-left: 0; }

    .header-buttons {
        gap: 8px;
        justify-content: flex-end;
    }

    .email-button, .telegram-button, .whatsapp-button, .close-button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .email-button svg, .telegram-button svg, .whatsapp-button svg {
        width: 18px;
        height: 18px;
    }

    .chat-content {
        padding: 10px;
        max-height: calc(100% - 120px);
    }

    .message {
        padding: 14px 18px;
        font-size: 15px;
        line-height: 1.6;
    }

    .chat-input-container {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }

    .chat-input {
        font-size: 16px;
        padding: 14px 18px;
    }

    .send-button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    .email-form {
        min-width: 300px;
        padding: 20px;
        margin: 10px;
    }

    .email-form-content h3 {
        font-size: 16px;
    }

    .email-form-content p {
        font-size: 13px;
    }

    .email-form-content input {
        font-size: 16px;
        padding: 10px;
    }

    .email-form-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .email-form-buttons button {
        width: 100%;
        padding: 12px;
    }

    .lead-form {
        width: 95%;
        padding: 20px;
    }

    .lead-form h3 {
        font-size: 18px;
    }

    .lead-form input {
        font-size: 16px;
        padding: 12px;
    }

    .lead-form-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .lead-form-buttons button {
        width: 100%;
        padding: 12px;
    }

    .quick-questions {
        margin: 10px 0;
    }

    .quick-questions-title {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .quick-questions-list {
        gap: 6px;
    }

    .quick-question-btn {
        padding: 8px 12px;
        font-size: 12px;
        background: white; /* پس‌زمینه سفید */
        color: #333; /* متن تیره */
        border: 1px solid #2C1D3B; /* بردر بنفش */
    }

    .related-questions {
        margin: 10px 0;
    }

    .related-questions-title {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .related-questions-list {
        gap: 6px;
    }

    .related-question-btn {
        padding: 8px 12px;
        font-size: 12px;
        background: white; /* پس‌زمینه سفید */
        color: #333; /* متن تیره */
        border: 1px solid #2C1D3B; /* بردر بنفش */
    }
    
    .chat-widget {
        width: 47px;
        height: 47px;
    }
    
    .chat-widget img {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: calc(100% - 32px); /* 16px از هر طرف */
        height: calc(100% - 32px); /* 16px از هر طرف */
    }

    .chat-header {
        padding: 12px 15px;
        flex-direction: row;
        gap: 6px;
        align-items: center;
    }

    .chat-header .title-section {
        justify-content: flex-start;
        margin-left: 8px;
        gap: 8px;
        align-items: center;
    }

    .chat-header h3 {
        font-size: 16px;
        color: white; /* رنگ سفید برای عنوان */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
    }

    .chat-header .status-indicator { margin-left: 0; }

    .header-buttons {
        gap: 6px;
        justify-content: flex-end;
    }

    .email-button, .telegram-button, .whatsapp-button, .close-button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .email-button svg, .telegram-button svg, .whatsapp-button svg {
        width: 14px;
        height: 14px;
    }

    .message {
        padding: 12px 15px;
        font-size: 14px;
    }

    .chat-input {
        font-size: 16px;
        padding: 12px 15px;
    }

    .send-button {
        padding: 10px;
        font-size: 14px;
    }

    .quick-questions {
        margin: 8px 0;
    }

    .quick-questions-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .quick-questions-list {
        gap: 4px;
    }

    .quick-question-btn {
        padding: 6px 10px;
        font-size: 11px;
        background: white; /* پس‌زمینه سفید */
        color: #333; /* متن تیره */
        border: 1px solid #2C1D3B; /* بردر بنفش */
    }

    .related-questions {
        margin: 8px 0;
    }

    .related-questions-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .related-questions-list {
        gap: 4px;
    }

    .related-question-btn {
        padding: 6px 10px;
        font-size: 11px;
        background: white; /* پس‌زمینه سفید */
        color: #333; /* متن تیره */
        border: 1px solid #2C1D3B; /* بردر بنفش */
    }
}

/* انیمیشن تایپ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #EEEEEE;
    border-radius: 15px;
    max-width: 80px;
    align-self: flex-start;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #2C1D3B;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* انیمیشن لودینگ استاندارد */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 15px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2C1D3B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #2C1D3B;
    font-size: 14px;
    font-weight: 500;
}