/**
 * NFDS RTL-Overrides — wird NUR bei RTL-Sprachen (Arabisch) enqueued,
 * als letztes Stylesheet (Prio 999, siehe Multilanguage_Frontend::enqueue_rtl_overrides).
 *
 * Prinzip: Elementor/Theme/WooCommerce spiegeln ueber ihre *-rtl.css
 * selbst, sobald is_rtl() true ist. Diese Datei spiegelt nur die
 * physisch positionierten Regeln des nf-digital-shop-Plugins
 * (Quelldateien bleiben unangetastet). Selektoren gewinnen ueber
 * html[dir="rtl"]-Praefix + spaetere Ladereihenfolge + !important.
 */

/* ==========================================================================
   1. Sidecart — slidet in RTL von LINKS herein
   (Quelle: sidecart-complete.css, html body #wcc-sidecart-container)
   ========================================================================== */

html[dir="rtl"] body #wcc-sidecart-container,
html[dir="rtl"] body.woocommerce-cart #wcc-sidecart-container,
html[dir="rtl"] body #wcc-cart-wrapper ~ #wcc-sidecart-wrapper #wcc-sidecart-container {
    right: auto !important;
    left: -400px !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
    transition: left 0.3s ease, width 0.3s ease !important;
}

html[dir="rtl"] body #wcc-sidecart-container.active,
html[dir="rtl"] body #wcc-sidecart-container.open,
html[dir="rtl"] body.woocommerce-cart #wcc-sidecart-container.active,
html[dir="rtl"] body #wcc-cart-wrapper ~ #wcc-sidecart-wrapper #wcc-sidecart-container.active {
    left: 0 !important;
    right: auto !important;
}

@media (max-width: 480px) {
    html[dir="rtl"] body #wcc-sidecart-container {
        left: -90% !important;
        right: auto !important;
    }
    html[dir="rtl"] body #wcc-sidecart-container.open,
    html[dir="rtl"] body #wcc-sidecart-container.active {
        left: 0 !important;
        right: auto !important;
    }
}

@media (max-width: 375px) {
    html[dir="rtl"] body #wcc-sidecart-container {
        left: calc(-100vw + 20px) !important;
        right: auto !important;
    }
    html[dir="rtl"] body #wcc-sidecart-container.active {
        left: 0 !important;
        right: auto !important;
    }
}

@media (max-width: 320px) {
    html[dir="rtl"] body #wcc-sidecart-container {
        left: calc(-100vw + 15px) !important;
        right: auto !important;
    }
    html[dir="rtl"] body #wcc-sidecart-container.active {
        left: 0 !important;
        right: auto !important;
    }
}

/* Remove-Button sitzt in LTR oben links am Bild bzw. oben rechts am Item */
html[dir="rtl"] body #wcc-sidecart-container .wcc-sidecart-items .wcc-sidecart-remove {
    left: auto;
    right: -10px;
}

html[dir="rtl"] #wcc-sidecart-wrapper .wcc-sidecart-remove {
    right: auto;
    left: -8px;
}

/* Preise: Spalte spiegelt nach links */
html[dir="rtl"] body #wcc-sidecart-container .wcc-sidecart-items .wcc-item-price,
html[dir="rtl"] body #wcc-sidecart-container .wcc-sidecart-total-value {
    text-align: left;
}

/* Gratisversand-Icon war per scaleX(-1) gespiegelt — in RTL zuruecksetzen */
html[dir="rtl"] body #wcc-sidecart-container .wcc-sidecart-free-shipping .wcc-shipping-icon {
    transform: scaleX(1) !important;
}

/* Coupon-Pfeil: margin-left:auto → margin-right:auto */
html[dir="rtl"] body #wcc-sidecart-container .wcc-sidecart-coupon-arrow {
    margin-left: 0;
    margin-right: auto;
}

/* ==========================================================================
   2. Sprach-Switcher — in RTL links unten
   (Quelle: multilanguage-frontend.css, inkl. !important-Cascade-Guard)
   ========================================================================== */

html[dir="rtl"] .nfds-lang-switcher,
html[dir="rtl"] body .nfds-lang-switcher {
    right: auto !important;
    left: 20px !important;
}

html[dir="rtl"] .nfds-lang-switcher--widget {
    left: auto !important;
    right: auto !important;
}

html[dir="rtl"] .nfds-lang-switcher__panel,
html[dir="rtl"] body .nfds-lang-switcher__panel {
    right: auto !important;
    left: 0 !important;
}

@media (max-width: 640px) {
    html[dir="rtl"] .nfds-lang-switcher,
    html[dir="rtl"] body .nfds-lang-switcher {
        right: auto !important;
        left: 12px !important;
    }
}

/* ==========================================================================
   3. Cookie-Consent-Banner
   (Positionsklassen sind Admin-Konfiguration und bleiben wie eingestellt;
   nur Innen-Ausrichtung spiegeln)
   ========================================================================== */

html[dir="rtl"] .nfds-consent-settings-footer {
    text-align: left;
}

html[dir="rtl"] .nfds-cookie-table td:last-child {
    text-align: left;
}

/* ==========================================================================
   4. Mobile-Menü — Panel ankert in RTL links
   (Quelle: widgets/mobile-menu.css)
   ========================================================================== */

html[dir="rtl"] .nfds-menu-panel {
    right: auto !important;
    left: 0 !important;
    transform-origin: top left;
}

html[dir="rtl"] .nfds-menu-panel[data-width-type="content"] {
    right: auto !important;
    left: 0 !important;
}

/* Full-width-Varianten (left:0/right:0) brauchen keine Spiegelung */

/* ==========================================================================
   5. Checkout / Warenkorb / Danke-Seite — Preisspalten spiegeln
   (Quellen: checkout.css, cart-complete.css, thankyou.css)
   ========================================================================== */

html[dir="rtl"] body #wcc-checkout-container .wcc-item-price,
html[dir="rtl"] body #wcc-checkout-container .wcc-total-value,
html[dir="rtl"] body #wcc-checkout-container .wcc-sidecart-items .wcc-item-price,
html[dir="rtl"] body #wcc-cart-wrapper .wcc-item-price,
html[dir="rtl"] body #wcc-cart-wrapper .wcc-total-value,
html[dir="rtl"] body #wcc-cart-wrapper .wcc-totals-row .wcc-total-value {
    text-align: left;
}

html[dir="rtl"] body #wcc-cart-wrapper .wcc-order-totals td {
    text-align: right;
}

html[dir="rtl"] .wcc-price-column {
    text-align: left;
}

/* ==========================================================================
   6. Startseiten-Hero — arabische Headline-Zeilen laufen sonst hinter den
   Kopf des Models (das de-Original formt seine Zeilen per &nbsp;-Einrueckung
   um das Bild herum, der arabische Umbruch faellt anders)
   ========================================================================== */

@media (min-width: 1025px) {
    html[dir="rtl"] .elementor-element-64d73e8b .elementor-heading-title,
    html[dir="rtl"] .elementor-element-52350b43 .elementor-heading-title {
        transform: translateY(-80px);
    }

    /* Header: Suchlupe kollidiert in RTL mit dem Warenkorb-Preisblock */
    html[dir="rtl"] .elementor-element-f2e99f1.elementor-widget {
        margin-right: 90px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    html[dir="rtl"] .elementor-element-64d73e8b .elementor-heading-title,
    html[dir="rtl"] .elementor-element-52350b43 .elementor-heading-title {
        transform: translateY(-40px);
    }
}
