/* Chat Widget Styles */
.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-widget-toggle {
    width: 60px;
    height: 60px;
    background: #0066FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.4);
    transition: all 0.3s ease;
    color: white;
}

.chat-widget-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.5);
}

.chat-widget-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget-panel.active {
    display: flex;
}

.chat-widget-header {
    background: #0066FF;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-widget-header-content {
    flex: 1;
}

.chat-widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-widget-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ADE80;
    border-radius: 50%;
    display: inline-block;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-reply-item {
    background: #E3F2FD;
    color: #0066FF;
    padding: 12px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.quick-reply-item:hover {
    background: #BBDEFB;
    transform: translateX(4px);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 80%;
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user .chat-message-bubble {
    background: #0066FF;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-message-bubble {
    background: #F5F5F5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    color: #999;
    padding: 0 4px;
}

.chat-form-container {
    background: #F9F9F9;
    padding: 16px;
    border-radius: 8px;
    margin-top: auto;
}

.chat-form-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.chat-user-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-user-form input {
    padding: 12px;
    border: 1px solid #DDD;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-user-form input[name="phone"] {
    padding-left: 90px !important;
}

.chat-user-form input:focus {
    outline: none;
    border-color: #0066FF;
}

.chat-form-submit {
    background: #0066FF;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.chat-form-submit:hover {
    background: #0052CC;
}

.chat-form-submit svg {
    width: 16px;
    height: 16px;
}

.chat-form-container {
    position: relative;
}

.chat-widget-footer {
    border-top: 1px solid #E5E5E5;
    padding: 12px;
    background: white;
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-attach-btn,
.chat-send-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex: 1 1 0;
}

.chat-attach-btn:hover,
.chat-send-btn:hover:not(:disabled) {
    background: #F5F5F5;
    color: #0066FF;
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-message-input {
    padding: 10px 12px;
    border: 1px solid #DDD;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    min-width: unset;
    flex: 1 1 70%;
}

.chat-message-input:focus {
    border-color: #0066FF;
}

.chat-message-input:disabled {
    background: #F5F5F5;
    cursor: not-allowed;
}

/* Scrollbar styling */
.chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-body::-webkit-scrollbar-track {
    background: #F5F5F5;
}

.chat-widget-body::-webkit-scrollbar-thumb {
    background: #CCC;
    border-radius: 3px;
}

.chat-widget-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* RTL Support for Arabic */
[dir="rtl"] .chat-widget-container {
    right: 20px;
    left: auto;
}

[dir="rtl"] .chat-widget-panel {
    right: 0;
    left: auto;
}

[dir="rtl"] .quick-reply-item:hover {
    transform: translateX(-4px);
}

[dir="rtl"] .chat-message.user {
    align-self: flex-start;
}

[dir="rtl"] .chat-message.bot {
    align-self: flex-end;
}

[dir="rtl"] .chat-message.user .chat-message-bubble {
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-message.bot .chat-message-bubble {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 10px;
    }
    
    .chat-widget-container {
        bottom: 10px;
        right: 10px;
    }
    
    [dir="rtl"] .chat-widget-container {
        right: auto;
        left: 10px;
    }
    
    [dir="rtl"] .chat-widget-panel {
        right: 10px;
        left: auto;
    }
}

/* Animation for form appearance */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-form-container {
    animation: slideUp 0.3s ease;
}

/* Hide elements */
.hidden {
    display: none !important;
}

