/* Cookie Banner Pro — RTL overrides
 * Loaded on the page (for floating button) AND injected into Shadow DOM
 * when the effective frontend direction is RTL.
 * Selectors target elements with dir="rtl" set by banner.js.
 * Note: dir="rtl" already reverses flex row order, so we must NOT add
 * flex-direction: row-reverse (that would double-flip back to LTR).
 */

/* Banner card position: swap right/left.
 *
 * RTL normally mirrors placement, so "bottom right" means the reading-start
 * corner and lands on the left. One client build opts out of that
 * (CBP_SITE_APPEARANCE_LOCK): there the setting names a physical corner,
 * because the client selected "right" and expected the right-hand side. The
 * banner root carries .cbp-placement-physical in that build and nowhere else,
 * so every other RTL site keeps the mirrored behaviour unchanged. */
[dir="rtl"].cbp-layout-bottom-right:not(.cbp-placement-physical) { right: auto; left: 20px; }
[dir="rtl"].cbp-layout-bottom-left:not(.cbp-placement-physical)  { left: auto; right: 20px; }

/* Button row: dir="rtl" already reverses flex order, and nothing about the triad
 * sizing differs in RTL — this file used to restate the LTR default here:
 *   [dir="rtl"] .cbp-actions.cbp-actions--triad .cbp-btn { flex: 1 1 calc(33.333% - 8px); }
 * That added nothing (banner.css already says exactly that) but it carried four
 * classes of specificity and loaded after banner.css, so it silently beat every
 * layout-specific button rule — the compact bar sizing and the mobile stacking
 * both worked in LTR and were overridden on precisely the RTL sites this plugin
 * is built for. Removed rather than re-specified: the base rule already covers it. */

/* Category row order is handled automatically by dir="rtl"; no row-reverse needed. */

/* Accordion arrow points the other way */
[dir="rtl"] .cbp-accordion-toggle { transform: rotate(180deg); }
[dir="rtl"] .cbp-accordion-toggle.cbp-accordion-open { transform: rotate(90deg); }

/* Toggle switch knob starts from the right and slides left when checked */
[dir="rtl"] .cbp-cat-toggle::after { left: auto; right: 3px; }
[dir="rtl"] .cbp-cat-toggle:checked::after { transform: translateX(-20px); }

/* Cookie table duration column: left-align in RTL */
[dir="rtl"] .cbp-cookie-duration { text-align: left; }

/* Floating button positions — mirror left/right and use offset vars */
[dir="rtl"].cbp-pref-fab.cbp-fab-bottom-right { right: auto; left:  var(--cbp-fab-x, 20px); bottom: var(--cbp-fab-y, 20px); top: auto; }
[dir="rtl"].cbp-pref-fab.cbp-fab-bottom-left  { left:  auto; right: var(--cbp-fab-x, 20px); bottom: var(--cbp-fab-y, 20px); top: auto; }
[dir="rtl"].cbp-pref-fab.cbp-fab-bottom-center { left: 50%; right: auto; bottom: var(--cbp-fab-y, 20px); top: auto; transform: translateX(-50%); }
[dir="rtl"].cbp-pref-fab.cbp-fab-top-right    { right: auto; left:  var(--cbp-fab-x, 20px); top: var(--cbp-fab-y, 20px); bottom: auto; }
[dir="rtl"].cbp-pref-fab.cbp-fab-top-left     { left:  auto; right: var(--cbp-fab-x, 20px); top: var(--cbp-fab-y, 20px); bottom: auto; }
[dir="rtl"].cbp-pref-fab.cbp-fab-top-center   { left: 50%; right: auto; top: var(--cbp-fab-y, 20px); bottom: auto; transform: translateX(-50%); }

/* Modal and cookie detail alignment (header order handled by dir="rtl"). */
[dir="rtl"] .cbp-cookie-row { direction: rtl; }

/* Responsive RTL */
@media (max-width: 640px) {
  [dir="rtl"].cbp-layout-bottom-right,
  [dir="rtl"].cbp-layout-bottom-left { left: 8px; right: 8px; }
}

@media (max-width: 480px) {
  [dir="rtl"] .cbp-cookie-duration { text-align: right; }
}
