/**
 * RTL (Right-to-Left) CSS Overrides
 * Applied to Arabic, Hebrew, Farsi, Urdu languages
 */

/* Base RTL Direction */
html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Flex containers - reverse horizontal layouts */
body.rtl .header,
body.rtl .header-left,
body.rtl .header-right,
body.rtl .header-title,
body.rtl .input-area,
body.rtl .action-buttons,
body.rtl .username-input-group,
body.rtl .setting-item,
body.rtl .footer {
    flex-direction: row-reverse;
}

/* Header adjustments */
body.rtl .header-title {
    flex-direction: row-reverse;
}

body.rtl .header-logo {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Back button flip */
body.rtl .soft-back-btn svg {
    transform: rotate(180deg);
}

/* Message bubbles */
body.rtl .message.own {
    align-self: flex-start;
    border-radius: 18px 18px 0 18px;
}

body.rtl .message.other {
    align-self: flex-end;
    border-radius: 18px 18px 18px 0;
}

/* Input field text alignment */
body.rtl input[type="text"],
body.rtl input[type="search"],
body.rtl textarea {
    text-align: right;
    direction: rtl;
}

/* Placeholder alignment */
body.rtl input::placeholder,
body.rtl textarea::placeholder {
    text-align: right;
}

/* Chat input area */
body.rtl .input-area {
    flex-direction: row-reverse;
}

body.rtl #messageInput {
    border-radius: 0 20px 20px 0;
}

body.rtl #sendButton {
    border-radius: 20px 0 0 20px;
}

/* Settings modal */
body.rtl .settings-header {
    flex-direction: row-reverse;
}

body.rtl .setting-item {
    flex-direction: row-reverse;
}

body.rtl .setting-item.column {
    flex-direction: column;
    align-items: flex-end;
}

/* Switch toggle position */
body.rtl .switch {
    margin-left: 0;
    margin-right: auto;
}

/* Online count and connection status */
body.rtl .online-count,
body.rtl .connection-status {
    direction: ltr;
    /* Keep numbers LTR */
}

/* Message meta (time, status) */
body.rtl .message-meta {
    flex-direction: row-reverse;
}

body.rtl .message-time {
    direction: ltr;
    /* Keep time LTR */
}

/* System messages */
body.rtl .system-message {
    text-align: center;
}

/* Typing indicator */
body.rtl .typing-indicator {
    text-align: right;
}

body.rtl .typing-content {
    flex-direction: row-reverse;
}

/* Footer links */
body.rtl .footer {
    direction: rtl;
}

/* About page specific */
body.rtl .psychology-grid,
body.rtl .features-grid {
    direction: rtl;
}

body.rtl .psychology-card,
body.rtl .feature-card {
    text-align: right;
}

body.rtl .card-icon,
body.rtl .feature-icon {
    margin-left: 0;
    margin-right: 0;
}

/* Benefits list */
body.rtl .benefits-list {
    padding-right: 1.5rem;
    padding-left: 0;
}

body.rtl .benefits-list li {
    text-align: right;
}

/* Unread notification */
body.rtl .unread-notification {
    direction: ltr;
    /* Keep count on left */
}

/* Scrollbar position */
body.rtl ::-webkit-scrollbar {
    direction: ltr;
}

/* Modal close button */
body.rtl .close-btn {
    left: 1rem;
    right: auto;
}

/* Form labels */
body.rtl label {
    text-align: right;
}

/* Buttons with icons */
body.rtl button svg {
    margin-left: 0.5rem;
    margin-right: 0;
}