/**
 * Offers / Promotions Slider — scoped customer styles.
 *
 * Every selector is namespaced under .ro-offers-slider so nothing here can
 * affect existing OwnServe UI. No global element selectors (body/html/header/
 * button/img/etc.) are used — all rules are descendants of .ro-offers-slider.
 *
 * Layout target (matches the provided reference):
 *   HEADER
 *     ↓
 *   PROMOTIONAL BANNER  (wide, ~21:9 desktop / ~16:9 mobile, rounded corners)
 *     ↓
 *   DOT INDICATORS      (separate row centered BELOW the banner)
 *     ↓
 *   SEARCH BAR / MENU   (unchanged, rendered by core after this component)
 */

/* Green accent used for the active dot — matches the OwnServe customer UI
   accent seen in the reference. Scoped variable, no global override. */
.ro-offers-slider {
    --ro-offers-accent: #1f8f4e;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 16px 0 6px;
}

.ro-offers-slider * {
    box-sizing: border-box;
}

/* The banner viewport: sized to the CURRENT slide's own image aspect ratio
   (CSS var --ro-ar, set inline from the real intrinsic dimensions and updated
   by offers.js as slides change). This makes the uploaded promotional artwork
   fill the banner edge-to-edge with NO grey pillar/letterbox bars. max-height
   keeps a tall/square promo from becoming an oversized banner. Rounded corners,
   clips the horizontally-sliding track. */
.ro-offers-slider-viewport {
    position: relative;
    /* Ratio-preserving banner. Shows the uploaded image COMPLETE — no grey side
       bars AND no cropping — by keeping the image's real aspect ratio
       (var --ro-ar). To stop a near-square promo from becoming an oversized
       square on wide screens, the banner's WIDTH is capped at
       (ratio * max-banner-height): this bounds the height while the ratio (and
       therefore the full uncropped artwork) is preserved. The banner then
       centers within the content column. A true wide banner upload fills the
       full content width because its ratio*height easily exceeds the column. */
    --ro-max-h: 460px;
    width: 100%;
    max-width: calc(var(--ro-ar-dec, 1.6) * var(--ro-max-h));
    aspect-ratio: var(--ro-ar, 16 / 9);
    margin-inline: auto;
    overflow: hidden;
    border-radius: 18px;
    background: #f3f4f6;            /* neutral placeholder before image paint */
    transition: max-width 0.3s ease;
}

.ro-offers-slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.45s ease;
    will-change: transform;
}

.ro-offers-slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: block;
    text-decoration: none;
    overflow: hidden;
}

/* The uploaded artwork is the sole visual and the source of truth. Because the
   viewport is sized to THIS image's own aspect ratio (via --ro-ar), `cover`
   fills the banner edge-to-edge with NO grey bars AND effectively no cropping
   (container ratio == image ratio). The clamp on the viewport (min/max-height)
   can introduce at most a few pixels of trim on an extreme ratio, never the
   large side bars the old `contain` produced. */
.ro-offers-slide-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Fallback ONLY for an image-less offer (never over an uploaded image). */
.ro-offers-slide:has(.ro-offers-slide-caption) {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f8f4e 0%, #12693a 100%);
    color: #fff;
    text-align: center;
    padding: 24px;
}
.ro-offers-slide-title {
    font-size: clamp(18px, 2.4vw, 26px);
    font-weight: 800;
    line-height: 1.15;
}
.ro-offers-slide-subtitle {
    margin-top: 6px;
    font-size: clamp(13px, 1.6vw, 16px);
    font-weight: 600;
    opacity: 0.95;
}

/* Circular prev/next arrows overlaying the banner, vertically centered. */
.ro-offers-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 2;
    transition: background 0.2s ease;
}
.ro-offers-slider-arrow:hover,
.ro-offers-slider-arrow:focus-visible {
    background: rgba(0, 0, 0, 0.65);
    outline: none;
}
.ro-offers-slider-prev { left: 12px; }
.ro-offers-slider-next { right: 12px; }

/* Dot indicators — overlaid on the BOTTOM of the banner so they read as part
   of the carousel (not floating far below). Centered horizontally, on a subtle
   scrim pill so they stay visible over any artwork. */
.ro-offers-slider-dots {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
    z-index: 3;
}
.ro-offers-slider-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7); /* inactive: translucent white on scrim */
    cursor: pointer;
    transition: width 0.2s ease, background 0.2s ease;
}
.ro-offers-slider-dot:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.ro-offers-slider-dot.is-active {
    background: var(--ro-offers-accent); /* active: OwnServe green */
    width: 20px;
    border-radius: 5px;
}

/* ---- Responsive ---- */

/* The banner ratio now follows the uploaded image (var --ro-ar), so there are
   no fixed per-breakpoint ratios. We only cap the height per device so a
   near-square promo can't dominate the viewport, and shrink the arrows on
   small screens. Border-radius scales down slightly on smaller widths. */
@media (max-width: 1024px) {
    .ro-offers-slider-viewport { --ro-max-h: 380px; border-radius: 16px; }
}
@media (max-width: 700px) {
    .ro-offers-slider { margin: 12px 0 4px; }
    /* On phones the content column is narrow, so the width-driven height is
       already small; a high ceiling keeps near-square art fully uncropped. */
    .ro-offers-slider-viewport { --ro-max-h: 620px; border-radius: 14px; }
    .ro-offers-slider-arrow { width: 34px; height: 34px; font-size: 20px; }
    .ro-offers-slider-prev { left: 8px; }
    .ro-offers-slider-next { right: 8px; }
    .ro-offers-slider-dots { bottom: 10px; }
}

/* Respect reduced-motion: disable the sliding transition. Manual navigation
   still jumps between slides, just without the animated transform. */
.ro-offers-slider.ro-offers-reduced-motion .ro-offers-slider-track {
    transition: none;
}
@media (prefers-reduced-motion: reduce) {
    .ro-offers-slider-track {
        transition: none;
    }
}
