/* ============================================================
   P2-B B2 RTL 语言支持 — 全局 RTL 覆盖（规范④：编辑器镜像预览 + 前台 ar 渲染共用）
   仅 [dir="rtl"] 下生效；LTR 页面加载无副作用。
   用法：前台 ar 由 ft/layout.blade.php 按 locale 引入；装修编辑器画布由 edit.blade.php 引入。
   ============================================================ */

/* ---------- 1. 基础方向与对齐 ---------- */
html[dir="rtl"] body,
html[dir="rtl"] .ft-body {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .ftf-container,
html[dir="rtl"] .ftf-section {
  text-align: right;
}

/* 标题/段落统一右对齐 */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] p {
  text-align: right;
}

/* ---------- 2. flex 布局镜像反转（row → row-reverse） ---------- */
html[dir="rtl"] .ftf-flex,
html[dir="rtl"] .ftf-hero__actions,
html[dir="rtl"] .ftf-nav__links,
html[dir="rtl"] .ftf-nav__actions,
html[dir="rtl"] .ftf-btn-group,
html[dir="rtl"] .ftf-stats__row,
html[dir="rtl"] .ftf-feature__row,
html[dir="rtl"] .ftf-product-grid__head,
html[dir="rtl"] .ftf-footer__cols,
html[dir="rtl"] .ftf-socials,
html[dir="rtl"] .ftf-inquiry-actions,
html[dir="rtl"] .ftf-breadcrumb {
  flex-direction: row-reverse;
}

/* 空间分布反转（start 到 end） */
html[dir="rtl"] .ftf-flex--between { justify-content: flex-start; }
html[dir="rtl"] .ftf-hero__inner { text-align: right; }

/* ---------- 3. 文本对齐（text-left ↔ text-right） ---------- */
html[dir="rtl"] .ftf-text-left { text-align: right; }
html[dir="rtl"] .ftf-text-right { text-align: left; }

/* ---------- 4. 轮播箭头镜像（左右互换 + 图形翻转） ---------- */
html[dir="rtl"] .ftf-carousel__arrow--prev { left: auto; right: 12px; transform: translateY(-50%) scaleX(-1); }
html[dir="rtl"] .ftf-carousel__arrow--next { right: auto; left: 12px; transform: translateY(-50%) scaleX(-1); }
html[dir="rtl"] .ftf-carousel__caption { left: 24px; right: auto; text-align: right; }
html[dir="rtl"] .ftf-carousel__dots { left: auto; right: 50%; transform: translateX(50%); }

/* ---------- 5. 分页/箭头符号翻转 ---------- */
html[dir="rtl"] .ftf-pagination .ftf-page-prev,
html[dir="rtl"] .ftf-pagination .ftf-page-next { transform: scaleX(-1); }

/* ---------- 6. 表单（标签右对齐、提交按钮组位置） ---------- */
html[dir="rtl"] .ftf-form-item label,
html[dir="rtl"] .ftf-form-item .ftf-form-label { text-align: right; }
html[dir="rtl"] .ftf-form-actions { justify-content: flex-start; }

/* ---------- 7. 编辑器画布内 RTL 镜像（#decCanvas[dir=rtl]） ---------- */
html[dir="rtl"] .ft-decor-v2__blocks,
.ft-decor-v2__blocks[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
/* 画布内区块 flex 反转 */
.ft-decor-v2__blocks[dir="rtl"] .ftf-flex,
.ft-decor-v2__blocks[dir="rtl"] .ftf-hero__actions,
.ft-decor-v2__blocks[dir="rtl"] .ftf-nav__links,
.ft-decor-v2__blocks[dir="rtl"] .ftf-btn-group,
.ft-decor-v2__blocks[dir="rtl"] .ftf-footer__cols { flex-direction: row-reverse; }
.ft-decor-v2__blocks[dir="rtl"] .ftf-carousel__arrow--prev { left: auto; right: 12px; transform: translateY(-50%) scaleX(-1); }
.ft-decor-v2__blocks[dir="rtl"] .ftf-carousel__arrow--next { right: auto; left: 12px; transform: translateY(-50%) scaleX(-1); }

/* ---------- 8. 阿拉伯语字体栈（Tahoma 已由 tokens.css html[dir=rtl] 提供，此处兜底） ---------- */
html[dir="rtl"] body,
html[dir="rtl"] .ft-body,
html[dir="rtl"] .ftf-container {
  font-family: "Tahoma", "Segoe UI", "Noto Naskh Arabic", "Tajawal", Arial, sans-serif;
}

/* ---------- 9. 其他通用镜像 ---------- */
html[dir="rtl"] .ftf-tag,
html[dir="rtl"] .ftf-badge { direction: rtl; }
html[dir="rtl"] .ftf-price { direction: ltr; unicode-bidi: bidi-override; display: inline-block; }

/* ---------- 10. P2-B B4-4 RTL 补漏：商品详情/侧栏/富文本/消息条 ---------- */
/* 侧栏分类图标（原 margin-right → RTL 镜像） */
html[dir="rtl"] .ftf-sidebar__icon { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .ftf-sidebar__sub { padding: 2px 22px 4px 0; }

/* 富文本列表/引用/表格（原 padding-left / border-left / text-align:left → RTL 镜像） */
html[dir="rtl"] .ftf-prose--rich ul,
html[dir="rtl"] .ftf-prose--rich ol { padding-left: 0; padding-right: 1.6em; }
html[dir="rtl"] .ftf-prose--rich blockquote { border-left: none; border-right: 4px solid #d1d5db; }
html[dir="rtl"] .ftf-prose--rich th,
html[dir="rtl"] .ftf-prose--rich td { text-align: right; }

/* 徽标/证书标签（badge 在标题后，原 margin-left → RTL margin-right） */
html[dir="rtl"] .ftf-badge { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .ftf-cert__tag { margin-left: 0; margin-right: 6px; }

/* 消息条（原 border-left 强调色 → RTL border-right） */
html[dir="rtl"] .ftf-message--success { border-left: none; border-right: 3px solid var(--ftf-success); }
html[dir="rtl"] .ftf-message--error { border-left: none; border-right: 3px solid var(--ftf-error); }
html[dir="rtl"] .ftf-message--warning { border-left: none; border-right: 3px solid var(--ftf-warning); }
html[dir="rtl"] .ftf-message--info { border-left: none; border-right: 3px solid var(--ftf-primary); }

/* 商品详情两栏 grid 方向跟随 direction 自动镜像，无需处理；缩略图 flex 自动镜像 */
/* 询盘表单分栏（label 右对齐已覆盖） */
html[dir="rtl"] .ftf-form-actions { justify-content: flex-start; }

/* 编辑器画布内同套规则（.ft-decor-v2__blocks[dir=rtl] 作用域） */
.ft-decor-v2__blocks[dir="rtl"] .ftf-sidebar__icon { margin-right: 0; margin-left: 6px; }
.ft-decor-v2__blocks[dir="rtl"] .ftf-prose--rich ul,
.ft-decor-v2__blocks[dir="rtl"] .ftf-prose--rich ol { padding-left: 0; padding-right: 1.6em; }
.ft-decor-v2__blocks[dir="rtl"] .ftf-prose--rich blockquote { border-left: none; border-right: 4px solid #d1d5db; }
.ft-decor-v2__blocks[dir="rtl"] .ftf-prose--rich th,
.ft-decor-v2__blocks[dir="rtl"] .ftf-prose--rich td { text-align: right; }
.ft-decor-v2__blocks[dir="rtl"] .ftf-message--success { border-left: none; border-right: 3px solid var(--ftf-success); }
.ft-decor-v2__blocks[dir="rtl"] .ftf-message--error { border-left: none; border-right: 3px solid var(--ftf-error); }
.ft-decor-v2__blocks[dir="rtl"] .ftf-message--warning { border-left: none; border-right: 3px solid var(--ftf-warning); }
.ft-decor-v2__blocks[dir="rtl"] .ftf-message--info { border-left: none; border-right: 3px solid var(--ftf-primary); }
