﻿body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100vh;
    touch-action: none;
}

.chat-fab {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #aebc80 0%, #8fa360 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(174, 188, 128, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

    .chat-fab:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(174, 188, 128, 0.6);
    }

    .chat-fab svg {
        width: 35px;
        height: 35px;
        fill: white;
    }

    .chat-fab .notification-badge {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 20px;
        height: 20px;
        background: #e74c3c;
        border-radius: 50%;
        color: white;
        font-size: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: pulse 2s infinite;
    }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* چت باکس */
.chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    backdrop-filter: blur(5px);
    overflow: hidden;
    touch-action: none;
}

    .chat-modal.active {
        display: flex;
        justify-content: center;
        align-items: center;
        animation: fadeIn 0.3s ease;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.chat-container {
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 85vh;
    background: white;
    margin: 20px;
    display: flex;
    flex-direction: column;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* هدر چت */
.chat-header {
    background: linear-gradient(135deg, #aebc80 0%, #8fa360 100%);
    color: white;
    padding: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 15px rgba(174, 188, 128, 0.2);
    flex-shrink: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
}

.header-text p {
    font-size: 10px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #3a463d;
    margin-bottom: 0;
}

.online-status {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

    .header-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: translateY(-2px);
    }

/* منطقه پیام‌ها */
.messages-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px;
    background: linear-gradient(to bottom, #f8faf5, #ffffff);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* تاریخ روز */
.date-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

    .date-divider span {
        background: #e8f5e9;
        color: #6b7c4e;
        padding: 5px 15px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
    }

/* پیام‌ها */
.message {
    margin-bottom: 20px;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.message.pharmacy {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 10px;
    font-size: 12px;
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message-avatar {
    width: 35px;
    height: 35px;
    background: #aebc80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    max-width: 65%;
}

.message-bubble {
    padding: 10px 15px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 12px;
}

.message.pharmacy .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e8f5e9;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #aebc80 0%, #9dac6f 100%);
    color: white;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 8px rgba(174, 188, 128, 0.3);
}

.message-time {
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message.user .message-time {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.9);
}

.message.pharmacy .message-time {
    color: #666;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    padding: 0 30px 20px;
    align-items: center;
    gap: 10px;
}

    .typing-indicator.active {
        display: flex;
    }

.typing-bubble {
    background: white;
    border: 1px solid #e8f5e9;
    padding: 15px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #aebc80;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

    .typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick replies */
.quick-replies {
    padding: 8px 15px;
    background: #f8faf5;
    border-top: 1px solid #e8f5e9;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #aebc80;
    color: #6b7c4e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

    .quick-reply-btn:hover {
        background: #aebc80;
        color: white;
        transform: translateY(-2px);
    }

/* Input area */
.input-area {
    background: white;
    border-top: 1px solid #e8f5e9;
    flex-shrink: 0;
}

.input-container {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    align-items: stretch;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    padding: 9px 10px;
    border: 2px solid #e8f5e9;
    border-radius: 25px;
    font-size: 15px;
    resize: none;
    transition: all 0.3s;
    font-family: inherit;
    background: #fafafa;
    max-height: 120px;
}

    .message-input:focus {
        outline: none;
        border-color: #aebc80;
        background: white;
        box-shadow: 0 0 0 4px rgba(174, 188, 128, 0.1);
    }

    .message-input::placeholder {
        color: #999;
    }

.attach-btn {
    width: 45px;
    height: 45px;
    background: #f0f4ea;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7c4e;
    transition: all 0.3s;
    flex-shrink: 0;
}

    .attach-btn:hover {
        background: #e8f5e9;
        transform: scale(1.1);
    }

.send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #aebc80 0%, #8fa360 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(174, 188, 128, 0.3);
    flex-shrink: 0;
}

    .send-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(174, 188, 128, 0.5);
    }

    .send-btn:active {
        transform: scale(0.95);
    }

/* File upload area */
.file-upload-area {
    display: none;
    padding: 15px;
    background: #f8faf5;
    border-radius: 15px;
    margin: 0 12px 10px;
    border: 2px dashed #aebc80;
}

    .file-upload-area.active {
        display: block;
    }

/* Scrollbar */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #aebc80;
    border-radius: 3px;
}

    .messages-area::-webkit-scrollbar-thumb:hover {
        background: #8fa360;
    }

.quick-replies::-webkit-scrollbar {
    height: 4px;
}

.quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.quick-replies::-webkit-scrollbar-thumb {
    background: #aebc80;
    border-radius: 2px;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .chat-modal.active {
        align-items: stretch;
    }

    .chat-container {
        margin: 0;
        border-radius: 0;
        max-height: 100%;
        height: 100%;
        max-width: 100%;
    }

    .message-content {
        max-width: 80%;
    }

    .chat-fab {
        bottom: 20px;
        left: 20px;
        width: 60px;
        height: 60px;
    }

        .chat-fab svg {
            width: 30px;
            height: 30px;
        }
}

/* دمو - محتوای صفحه */
.demo-content {
    padding: 40px 20px;
    text-align: center;
    min-height: 150vh;
}

    .demo-content h1 {
        color: #aebc80;
        margin-bottom: 20px;
    }

    .demo-content p {
        color: #666;
        margin-bottom: 30px;
        line-height: 1.8;
    }
