/* Chat System Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Arial', sans-serif;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #007cba, #005a8b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 124, 186, 0.3);
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
    position: relative;
    overflow: hidden;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 124, 186, 0.4);
}

.chat-button-text {
    position: absolute;
    right: 70px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-button:hover .chat-button-text {
    opacity: 1;
    transform: translateX(0);
}

.chat-button-text::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #333;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.chat-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-minimize,
.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.2s ease;
    margin-left: 5px;
}

.chat-minimize:hover,
.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-start-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    text-align: center;
}

.chat-welcome h4 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 18px;
}

.chat-welcome p {
    color: #666;
    margin: 0 0 30px 0;
    font-size: 14px;
}

.chat-start-form {
    width: 100%;
    max-width: 280px;
}

#customer-name {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    transition: border-color 0.3s ease;
}

#customer-name:focus {
    outline: none;
    border-color: #007cba;
}

#start-chat-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.bot {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Message time styling */
.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    color: inherit;
    font-weight: normal;
}

.chat-message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-message.bot .message-time {
    color: rgba(51, 51, 51, 0.5);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message-links {
    margin-top: 10px;
}

.message-link {
    display: block;
    background: #f0f8ff;
    border: 1px solid #007cba;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 5px 0;
    text-decoration: none;
    color: #007cba;
    font-size: 13px;
    transition: all 0.2s ease;
}



.message-link-title {
    font-weight: 600;
    display: block;
}

.message-link-desc {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

#chat-message-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    margin-right: 10px;
    transition: border-color 0.3s ease;
}

#chat-message-input:focus {
    outline: none;
    border-color: #007cba;
}

#send-message-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#send-message-btn:hover {
    transform: scale(1.1);
}

.end-chat-btn {
    width: 100%;
    padding: 8px 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.end-chat-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    background: #007cba;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: calc(100vw - 30px);
        height: 70vh;
        bottom: 80px;
        right: -15px;
    }
    
    .chat-button-text {
        display: none;
    }
}

/* RTL Support */
[dir="rtl"] .chat-widget {
    left: 20px;
    right: auto;
}

[dir="rtl"] .chat-window {
    left: 0;
    right: auto;
}

[dir="rtl"] .chat-button-text {
    left: 70px;
    right: auto;
}

[dir="rtl"] .chat-button-text::after {
    left: -8px;
    right: auto;
    border-left-color: transparent;
    border-right-color: #333;
}

[dir="rtl"] .chat-message.user {
    justify-content: flex-start;
}

[dir="rtl"] .chat-message.bot {
    justify-content: flex-end;
}

[dir="rtl"] .chat-message.user .message-bubble {
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-message.bot .message-bubble {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] #chat-message-input {
    margin-left: 10px;
    margin-right: 0;
}

/* Animations */
.chat-message {
    animation: fadeInUp 0.3s ease;
}

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

/* Support Form Styles */
.support-form {
    background: #f8f9fa;
    border: 2px solid #007cba;
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    max-width: 100%;
}

.support-form-title {
    color: #007cba;
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

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

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-field textarea {
    min-height: 80px;
    resize: vertical;
}

.form-field input[required],
.form-field select[required],
.form-field textarea[required] {
    border-left: 3px solid #007cba;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: space-between;
}

.submit-support-btn,
.cancel-support-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-support-btn {
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
}

.submit-support-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.submit-support-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cancel-support-btn {
    background: #6c757d;
    color: white;
}

.cancel-support-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.support-form-message {
    max-width: 95% !important;
}

.support-form-message .message-bubble {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* Enhanced Message Links */
.message-link {
    display: block;
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border: 1px solid #007cba;
    border-radius: 10px;
    padding: 12px 15px;
    margin: 8px 0;
    text-decoration: none;
    color: #007cba;
    font-size: 13px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-link::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.5s ease;
}

.message-link:hover::before {
    left: 100%;
}

.message-link:hover {
    background: linear-gradient(135deg, #007cba, #005a8b);
    color: white;
    transform: translateX(5px) scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.message-link-title {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.message-link-desc {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Enhanced Animations */
.chat-message {
    animation: slideInUp 0.4s ease;
}

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

.support-form {
    animation: expandIn 0.5s ease;
}

@keyframes expandIn {
    from {
        opacity: 0;
        transform: scale(0.9);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: scale(1);
        max-height: 1000px;
    }
}

/* Enhanced Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.typing-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #007cba, #005a8b);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.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 typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2) translateY(-10px);
        opacity: 1;
    }
}

/* Mobile Enhancements */
@media (max-width: 768px) {
    .support-form {
        padding: 15px;
        margin: 5px 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .submit-support-btn,
    .cancel-support-btn {
        margin-bottom: 8px;
    }
    
    .message-link {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* RTL Support for Forms */
[dir="rtl"] .form-field input[required],
[dir="rtl"] .form-field select[required],
[dir="rtl"] .form-field textarea[required] {
    border-right: 3px solid #007cba;
    border-left: 2px solid #e0e0e0;
}

[dir="rtl"] .message-link:hover {
    transform: translateX(-5px) scale(1.02);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #007cba;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #005a8b;
}
