/*
 * js_rabatt_master – zentrales Frontend-CSS.
 *
 * Die Renderer (FrontendRenderer.php) setzen teils Inline-Styles mit der
 * konfigurierten Akzentfarbe. Diese Klassen sind daher ADDITIV gedacht:
 * sie ergaenzen Layout/Verhalten (Positionierung, Transitionen, Responsive),
 * ohne auf !important angewiesen zu sein oder die Inline-Farbe zu ueberschreiben.
 *
 * Akzentfarbe zentral ueber die CSS-Variable --rm-accent steuerbar,
 * Fallback ist das JustSound-Orange #f39200.
 */

:root {
    --rm-accent: #f39200;
}

/* --- Aktionsleiste oben (.rm-top-banner) ----------------------------------
   Inline gesetzt sind bereits Hintergrund/Farbe/Padding. Hier nur Feinschliff. */
.rm-top-banner {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
    letter-spacing: .2px;
}

.rm-top-banner a {
    color: #fff;
    text-decoration: underline;
}

/* --- Fortschrittsbalken (.rm-progress) ------------------------------------ */
.rm-progress {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}

/* Aeussere Spur des Balkens (das direkte div-Kind mit fester Hoehe). */
.rm-progress .rm-progress-track {
    background: #e0e0e0;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    max-width: 520px;
    margin: 0 auto;
}

/* Innerer, gefuellter Balken. Farbe kommt inline aus der Akzentfarbe,
   fehlt sie, greift der Fallback aus der Variablen. */
.rm-progress .rm-progress-bar {
    background: var(--rm-accent, #f39200);
    height: 100%;
    transition: width .3s ease;
}

/* --- Slide-In-Panel (.rm-slidein) -----------------------------------------
   Grundzustand: fixiert unten rechts, aber ausserhalb des Viewports (rechts
   herausgeschoben) und unsichtbar. Erst .rm-slidein--visible holt es herein. */
.rm-slidein {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: 320px;
    box-sizing: border-box;
    z-index: 9999;
    /* Startposition ausserhalb des sichtbaren Bereichs. */
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: transform .4s cubic-bezier(.22, .61, .36, 1), opacity .4s ease;
    will-change: transform, opacity;
}

/* Eingeblendeter Zustand: in den Viewport gefahren und sichtbar. */
.rm-slidein.rm-slidein--visible {
    transform: translateX(0);
    opacity: 1;
}

/* Schliessen-Button oben rechts im Panel. */
.rm-slidein-close {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #888;
    font-size: 20px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    transition: color .2s ease, background .2s ease;
}

.rm-slidein-close:hover,
.rm-slidein-close:focus {
    color: var(--rm-accent, #f39200);
    background: rgba(0, 0, 0, .06);
    outline: none;
}

/* --- Countdown (.rm-countdown) -------------------------------------------- */
.rm-countdown {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    /* Monospace-Ziffern verhindern "springende" Breite beim Zaehlen. */
    font-feature-settings: "tnum" 1;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--rm-accent, #f39200);
    white-space: nowrap;
}

/* --- QR-Code-Block (.rm-qr) ----------------------------------------------- */
.rm-qr {
    display: inline-block;
    padding: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    line-height: 0;
}

.rm-qr img,
.rm-qr svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* --- Artikel-Banner (.rm-article-banner) ----------------------------------
   Hinweis auf der Artikelseite, dezent mit Akzent-Linie links. */
.rm-article-banner {
    box-sizing: border-box;
    margin: 12px 0;
    padding: 12px 16px;
    background: #f8f8f8;
    border-left: 4px solid var(--rm-accent, #f39200);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.rm-article-banner strong {
    color: var(--rm-accent, #f39200);
}

/* --- Responsive: Mobile --------------------------------------------------- */
@media (max-width: 600px) {
    /* Slide-In nimmt unten die volle Breite ein und faehrt von unten herein. */
    .rm-slidein {
        right: 0;
        left: 0;
        bottom: 0;
        max-width: none;
        border-radius: 12px 12px 0 0;
        transform: translateY(calc(100% + 20px));
    }

    .rm-slidein.rm-slidein--visible {
        transform: translateY(0);
    }

    .rm-top-banner,
    .rm-progress {
        font-size: 13px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Artikel-Coupons (1.2.0): eigene Knopffarben, unabhaengig vom Theme-Grau.
   Gemessen (design-beweis): Ruhe #222 auf #fff 15,9:1, Hover/Active #fff auf #222,
   Fokusring #222 auf #f8f8f8 > 3:1. */
.rm-article-coupon .rm-ac-btn {
    color: #222;
    background-color: #fff;
    border: 1px solid #555;
    min-height: 32px;
}
.rm-article-coupon .rm-ac-btn:hover,
.rm-article-coupon .rm-ac-btn:active {
    color: #fff;
    background-color: #222;
    border-color: #222;
}
.rm-article-coupon .rm-ac-btn:focus {
    box-shadow: none;
}
.rm-article-coupon .rm-ac-btn:focus-visible {
    outline: 2px solid #222;
    outline-offset: 2px;
}
