/* Jayto Chat Styles */

/* Floating Button for Guests */
.jayto-chat-floating-button {
    position: fixed;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: 'Vazir', 'Tahoma', sans-serif;
}

/* Position classes for floating button */
.jayto-chat-floating-button.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.jayto-chat-floating-button.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.jayto-chat-floating-button.position-top-right {
    top: 20px;
    right: 20px;
}

.jayto-chat-floating-button.position-top-left {
    top: 20px;
    left: 20px;
}

.jayto-chat-floating-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Host Button */
.jayto-chat-host-button {
    position: fixed;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    color: white;
    padding: 18px 25px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3), 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Vazir', 'Tahoma', sans-serif;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
}

.jayto-chat-host-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    animation: shimmer 2s ease-in-out infinite;
}

.jayto-chat-host-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

/* Position classes for host button */
.jayto-chat-host-button.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.jayto-chat-host-button.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.jayto-chat-host-button.position-top-right {
    top: 20px;
    right: 20px;
}

.jayto-chat-host-button.position-top-left {
    top: 20px;
    left: 20px;
}

.jayto-chat-host-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 50%, #5a6fd8 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4), 0 6px 15px rgba(0, 0, 0, 0.15);
}

.jayto-chat-host-button:hover::after {
    transform: translateY(0);
}

.jayto-chat-host-button:active {
    transform: translateY(-1px) scale(0.98);
}

.chat-icon {
    font-size: 22px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

.chat-text {
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}

.unread-badge {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
    position: relative;
}

.unread-badge::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

/* Chat Container */
.jayto-chat-container {
    position: fixed;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: 'Vazir', 'Tahoma', sans-serif;
    direction: rtl;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Position classes for chat container */
.jayto-chat-container.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.jayto-chat-container.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.jayto-chat-container.position-top-right {
    top: 20px;
    right: 20px;
}

.jayto-chat-container.position-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    color: white;
    padding: 18px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    animation: shimmer 3s ease-in-out infinite;
}

.chat-title {
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-close-btn:active {
    transform: scale(0.95);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.welcome-message {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    margin: 30px 20px;
    padding: 25px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25), 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInTop 0.5s ease-out;
}

.welcome-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    animation: shimmer 3s ease-in-out infinite;
}

.welcome-message p {
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
}

.welcome-message::after {
    content: '💬';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 40px;
    opacity: 0.1;
    transform: rotate(15deg);
}

/* Message Styles */
.message-wrapper {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-end;
}

.sent-wrapper {
    justify-content: flex-end;
}

.received-wrapper {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: 8px;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message-bubble.sent {
    background: #e3f2fd;
    color: #333;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(227, 242, 253, 0.3);
    border: 1px solid #bbdefb;
}

.message-bubble.received {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 5px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    max-width: 80%;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideInUp 0.3s ease-out;
}

.typing-indicator span {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    direction: rtl;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    position: relative;
}

#jayto-chat-message-input {
    flex: 1;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    font-family: inherit;
    direction: rtl;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    margin-right: 50px;
}

#jayto-chat-message-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

#jayto-chat-send-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    position: absolute;
    left: 15px;
    bottom: 15px;
    overflow: hidden;
}

#jayto-chat-send-btn::after {
    content: '➤';
    font-size: 16px;
    transform: rotate(180deg);
    color: white;
}

#jayto-chat-send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

#jayto-chat-send-btn:hover::before {
    transform: translateY(0);
}

#jayto-chat-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

#jayto-chat-send-btn:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

#jayto-chat-send-btn.sending {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    cursor: not-allowed;
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
    animation: sending-pulse 1s infinite;
}

#jayto-chat-send-btn.sending::after {
    content: '⏳';
    font-size: 14px;
    transform: rotate(0deg);
    animation: sending-spin 1s infinite linear;
}

@keyframes sending-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes sending-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Character counter */
.char-counter {
    position: absolute;
    bottom: 5px;
    left: 10px;
    font-size: 11px;
    color: #999;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 1;
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.error {
    color: #f44336;
}

/* Notifications */
.jayto-chat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    font-family: 'Vazir', 'Tahoma', sans-serif;
    direction: rtl;
    max-width: 350px;
    line-height: 1.5;
    animation: slideInRight 0.3s ease-out;
}

.jayto-chat-notification.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-right: 4px solid #a71e2a;
}

/* In-chat error message */
.chat-error-message {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 10px 15px;
    font-family: 'Vazir', 'Tahoma', sans-serif;
    direction: rtl;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    border-right: 4px solid #a71e2a;
    animation: slideInTop 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Chat warning message */
.chat-warning {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ff9800 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin: 15px;
    font-family: 'Vazir', 'Tahoma', sans-serif;
    direction: rtl;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    animation: slideInTop 0.4s ease-out;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.25), 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-warning::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b35, #f7931e, #ff9800);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.chat-warning .warning-icon {
    font-size: 22px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.chat-warning .warning-message {
    flex: 1;
    text-align: right;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}

.chat-warning .warning-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
}

.chat-warning .warning-close::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.chat-warning .warning-close:hover::before {
    transform: translateY(0);
}

.chat-warning .warning-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.chat-warning .warning-close:active {
    transform: scale(0.95);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}



/* Mobile Responsive */
@media (max-width: 768px) {
    .jayto-chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .chat-header {
        border-radius: 0;
    }
    
    .chat-input-area {
        border-radius: 0;
        padding: 12px;
    }
    
    #jayto-chat-message-input {
        margin-right: 45px;
        max-height: 60px;
        min-height: 35px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    #jayto-chat-send-btn {
        left: 12px;
        bottom: 12px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .jayto-chat-floating-button,
    .jayto-chat-host-button {
        bottom: 15px;
        right: 15px;
        padding: 12px 16px;
    }
    
    .chat-text {
        display: none;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Conversation Closed Message */
.conversation-closed-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(238, 90, 82, 0.05) 100%);
    border-radius: 12px;
    margin: 10px;
    position: relative;
    overflow: hidden;
}

.conversation-closed-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(238, 90, 82, 0.1) 100%);
    border-radius: 12px;
    animation: shimmer 2s ease-in-out infinite;
}

.conversation-closed-message p {
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    position: relative;
    z-index: 1;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(255, 107, 107, 0.1);
}

/* Pending message styling */
.message-wrapper.message-pending .message-bubble {
    opacity: 0.7;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.message-wrapper.message-pending .message-time::after {
    content: ' (در حال ارسال...)';
    font-size: 10px;
    color: #6c757d;
}

/* Temporary message styling */
.message-wrapper.message-temp .message-bubble {
    opacity: 0.8;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    animation: temp-message-pulse 1.5s infinite;
}

.message-wrapper.message-temp .message-time::after {
    content: ' (در حال ارسال...)';
    font-size: 10px;
    color: #856404;
}

@keyframes temp-message-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
} 