/**
 * RTL styles for WooCommerce Order Chat
 */

/* RTL Layout Adjustments */
.woc-customer-chat-container {
    direction: rtl;
}

.woc-chat-interface {
    grid-template-columns: 300px 1fr;
}

@media (max-width: 768px) {
    .woc-chat-interface {
        grid-template-columns: 1fr;
    }
}

/* Chat Header RTL */
.woc-chat-header {
    direction: rtl;
}

.woc-order-info {
    text-align: right;
}

.woc-chat-status {
    flex-direction: row-reverse;
}

.woc-admin-status {
    flex-direction: row-reverse;
}

/* Messages RTL */
.woc-messages-container {
    direction: rtl;
}

.woc-message.customer {
    align-items: flex-start;
}

.woc-message.admin,
.woc-message.system {
    align-items: flex-end;
}

.woc-message.customer .woc-message-bubble {
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 4px;
}

.woc-message.admin .woc-message-bubble {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}

.woc-message-meta {
    direction: rtl;
}

.woc-message.customer .woc-message-meta {
    justify-content: flex-start;
}

.woc-message.admin .woc-message-meta {
    justify-content: flex-end;
}

/* Attachment RTL */
.woc-attachment {
    direction: rtl;
}

.woc-attachment-info {
    text-align: right;
}

/* Message Input RTL */
.woc-message-input {
    direction: rtl;
}

.woc-message-input textarea {
    direction: rtl;
    text-align: right;
}

.woc-message-actions {
    flex-direction: row-reverse;
}

/* Chat Rating RTL */
.woc-chat-rating {
    direction: rtl;
}

.woc-rating-stars {
    flex-direction: row-reverse;
}

.woc-chat-rating textarea {
    direction: rtl;
    text-align: right;
}

/* Chat History RTL */
.woc-chat-history {
    direction: rtl;
}

.woc-history-item {
    text-align: right;
}

.woc-history-status {
    flex-direction: row-reverse;
}

/* Emoji Picker RTL */
.woc-emoji-picker {
    right: auto;
    left: 0;
}

/* Notification RTL */
.woc-notification-popup {
    right: auto;
    left: 20px;
    direction: rtl;
}

@keyframes woc-slide-in-rtl {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.woc-notification-popup {
    animation: woc-slide-in-rtl 0.3s ease-out;
}

.woc-notification-content {
    flex-direction: row-reverse;
}

.woc-notification-close {
    margin-left: 0;
    margin-right: 10px;
}

/* Order Selector RTL */
.woc-order-selector {
    direction: rtl;
}

.woc-order-selector label {
    text-align: right;
}

.woc-order-select {
    direction: rtl;
    text-align: right;
}

/* No Orders RTL */
.woc-no-orders {
    direction: rtl;
}

/* Loading States RTL */
.woc-loading {
    direction: rtl;
}

.woc-spinner {
    margin-right: 0;
    margin-left: 10px;
}

/* Error/Success Messages RTL */
.woc-error,
.woc-success {
    direction: rtl;
    text-align: right;
}

/* Typography RTL */
.woc-customer-chat-container h2,
.woc-chat-history h3,
.woc-chat-rating h4 {
    text-align: right;
}

/* Form Elements RTL */
input[type="text"],
input[type="email"],
textarea,
select {
    direction: rtl;
    text-align: right;
}

/* Button Alignment RTL */
.woc-no-orders .button,
.woc-chat-rating .button {
    direction: rtl;
}

/* Responsive RTL Adjustments */
@media (max-width: 768px) {
    .woc-notification-popup {
        left: 10px;
        right: 10px;
    }
    
    .woc-chat-header {
        align-items: flex-end;
    }
}

@media (max-width: 480px) {
    .woc-message-actions {
        flex-direction: column-reverse;
    }
}

/* Arabic/Hebrew Font Support */
.woc-customer-chat-container,
.woc-message-bubble,
.woc-message-input textarea {
    font-family: 'Tahoma', 'Arial Unicode MS', 'Lucida Grande', sans-serif;
}

/* Arabic specific adjustments */
html[lang^="ar"] .woc-customer-chat-container,
html[lang^="ar"] .woc-message-bubble,
html[lang^="ar"] .woc-message-input textarea {
    font-family: 'Tahoma', 'Arabic Typesetting', 'Traditional Arabic', 'Al Bayan', sans-serif;
    line-height: 1.6;
}

/* Hebrew specific adjustments */
html[lang^="he"] .woc-customer-chat-container,
html[lang^="he"] .woc-message-bubble,
html[lang^="he"] .woc-message-input textarea {
    font-family: 'Tahoma', 'David', 'Times New Roman', serif;
    line-height: 1.5;
}

/* Persian/Farsi specific adjustments */
html[lang^="fa"] .woc-customer-chat-container,
html[lang^="fa"] .woc-message-bubble,
html[lang^="fa"] .woc-message-input textarea {
    font-family: 'Tahoma', 'Iranian Sans', 'B Nazanin', 'Terafik', sans-serif;
    line-height: 1.7;
}

/* Urdu specific adjustments */
html[lang^="ur"] .woc-customer-chat-container,
html[lang^="ur"] .woc-message-bubble,
html[lang^="ur"] .woc-message-input textarea {
    font-family: 'Tahoma', 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', sans-serif;
    line-height: 1.8;
}

/* RTL Text Selection */
.woc-message-bubble::selection {
    background: rgba(255, 255, 255, 0.3);
}

/* RTL Scrollbar */
.woc-messages-container::-webkit-scrollbar {
    width: 6px;
}

.woc-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.woc-messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.woc-messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* RTL Input Placeholder */
.woc-message-input textarea::placeholder {
    text-align: right;
    direction: rtl;
}

/* RTL Icon Adjustments */
.woc-attach-btn .dashicons,
.woc-emoji-btn .dashicons {
    transform: scaleX(-1);
}

/* RTL Animation Adjustments */
@keyframes woc-typing-rtl {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.woc-typing-dots {
    animation: woc-typing-rtl 1.4s infinite;
}

/* RTL Status Indicator */
.woc-status-indicator {
    order: 2;
}

.woc-status-text {
    order: 1;
}

/* RTL Attachment Layout */
.woc-attachment-download {
    margin-right: auto;
    margin-left: 0;
}

/* RTL Chat Widget (if used) */
.woc-chat-widget {
    right: auto;
    left: 20px;
    direction: rtl;
}

.woc-widget-header {
    direction: rtl;
}

.woc-widget-input {
    flex-direction: row-reverse;
}

/* RTL Form Validation */
.woc-error,
.woc-success {
    text-align: right;
}

/* RTL Accessibility */
.woc-sr-only {
    direction: rtl;
}

/* RTL Print Styles */
@media print {
    .woc-customer-chat-container {
        direction: rtl;
    }
    
    .woc-message {
        page-break-inside: avoid;
    }
}
