/* ═══════════════════════════════════════════════════════
   ReWire — Arabic RTL (Right-to-Left) Support
   Add to: frontend/rtl-arabic.css
   Include via: <link rel="stylesheet" href="/rtl-arabic.css">
   ═══════════════════════════════════════════════════════ */

/* ─── Base RTL Mode ─── */
.rtl-mode {
    direction: rtl;
    text-align: right;
}

/* ─── RTL Text Blocks ─── */
.rtl-mode .answer-content,
.rtl-mode .follow-up-btn,
.rtl-mode p,
.rtl-mode li,
.rtl-mode h1, .rtl-mode h2, .rtl-mode h3, .rtl-mode h4 {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

/* ─── Code & Numbers Stay LTR (automatic via Unicode BiDi, reinforced here) ─── */
.rtl-mode .answer-content code,
.rtl-mode .answer-content pre,
.rtl-mode .answer-content .katex {
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

/* ─── Flipped Chat Bubbles ─── */
/* User message: moves to left side in RTL */
.rtl-user-row {
    flex-direction: row-reverse; /* justify-end becomes left in RTL context */
}

/* Assistant message: avatar goes right */
.rtl-assistant-row {
    flex-direction: row-reverse;
}

/* Bubble corners flip */
.rtl-bubble-user {
    border-radius: 0.75rem 0.75rem 0.25rem 0.75rem !important;
}

.rtl-bubble-assistant {
    border-radius: 0.75rem 0.75rem 0.75rem 0.25rem !important;
}

/* ─── RTL Follow-up Buttons ─── */
.rtl-mode .follow-up-btn {
    text-align: right;
    direction: rtl;
}

/* ─── RTL Input Area ─── */
.rtl-input {
    direction: rtl !important;
    text-align: right !important;
}

/* ─── RTL Typing Indicator Row ─── */
.rtl-typing-row {
    flex-direction: row-reverse;
}

/* ─── RTL System Messages ─── */
.rtl-system {
    direction: rtl;
    text-align: right;
}

/* ─── RTL Unit Badge ─── */
.rtl-mode .unit-badge-rtl {
    text-align: right;
    direction: rtl;
}

/* ─── RTL Explore Header ─── */
.rtl-mode .explore-header-rtl {
    direction: rtl;
    text-align: right;
}

/* ─── RTL Copy Button Alignment ─── */
.rtl-mode .copy-answer-btn {
    left: 8px;
    right: auto;
}

/* ─── RTL Daily Limit Badge ─── */
.rtl-limit-text {
    direction: rtl;
    text-align: right;
}

/* ─── Smooth Transition When Switching Languages ─── */
.answer-content,
.follow-up-btn,
.message-bubble {
    transition: direction 0.2s ease, text-align 0.2s ease;
}
