/* ==========================================================================
   AGP Rotating Banner — mod_agp_rotatingbanner v1.0.0
   Bootstrap-first: all colors fall back to --bs-* template variables.
   Module pickers override via --agp-rb-* when set.
   ========================================================================== */

/* ---- Base ---- */
.agp-rb {
    font-family: var(--agp-rb-font-body, var(--bs-body-font-family, -apple-system, sans-serif));
    background: var(--agp-rb-bg, var(--bs-primary, #0d6efd));
    color: var(--agp-rb-text, #fff);
    border-radius: var(--bs-border-radius-lg, 0.75rem);
    padding: 48px 40px 40px;
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Viewport: stacks slides, controls visibility ---- */
.agp-rb__viewport {
    position: relative;
    min-height: 200px;
}

/* ---- Slide base ---- */
.agp-rb__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    visibility: hidden;
    pointer-events: none;
}

.agp-rb__slide--active {
    position: relative;
    visibility: visible;
    pointer-events: auto;
}

/* ---- Fade transition ---- */
.agp-rb--fade .agp-rb__slide {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.agp-rb--fade .agp-rb__slide--active {
    opacity: 1;
}

/* ---- Slide-up transition ---- */
.agp-rb--slide .agp-rb__slide {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.agp-rb--slide .agp-rb__slide--active {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Badge ---- */
.agp-rb__badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--agp-rb-badge-text, #fff);
    background: var(--agp-rb-badge-bg, rgba(255, 255, 255, 0.15));
    border-radius: 100px;
    padding: 4px 14px;
    margin-bottom: 16px;
}

/* ---- Headline ---- */
.agp-rb__headline {
    font-family: var(--agp-rb-font-display, Georgia, serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--agp-rb-text, #fff);
    margin: 0 0 12px;
    line-height: 1.25;
}

/* ---- Description ---- */
.agp-rb__desc {
    font-size: 1rem;
    color: var(--agp-rb-text, #fff);
    opacity: 0.75;
    line-height: 1.6;
    margin: 0 0 24px;
    max-width: 480px;
}

/* ---- Button ---- */
.agp-rb__btn {
    display: inline-block;
    font-family: var(--agp-rb-font-body, var(--bs-body-font-family, inherit));
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: var(--bs-border-radius, 0.375rem);
    background: var(--agp-rb-btn-bg, #fff);
    color: var(--agp-rb-btn-text, var(--bs-body-color, #212529));
    border: none;
    transition: opacity 0.2s ease;
}

.agp-rb__btn:hover {
    opacity: 0.9;
    color: var(--agp-rb-btn-text, var(--bs-body-color, #212529));
    text-decoration: none;
}

/* ---- Image ---- */
.agp-rb__image {
    text-align: center;
}

.agp-rb__image img {
    max-height: 220px;
    width: auto;
    border-radius: var(--bs-border-radius-lg, 0.5rem);
}

/* ---- Progress Bars ---- */
.agp-rb__progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.agp-rb__progress-bar {
    position: relative;
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
}

.agp-rb__progress-fill {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: var(--agp-rb-progress-bg, rgba(255, 255, 255, 0.7));
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Active bar: fill animates from 0 to 100% over the autoplay duration */
.agp-rb__progress-bar--active .agp-rb__progress-fill {
    width: 100%;
    /* Duration set via JS inline style based on autoplay_speed */
}

/* Completed bars: fully filled */
.agp-rb__progress-bar--done .agp-rb__progress-fill {
    width: 100%;
    transition: none;
}

/* Paused state: freeze the fill animation */
.agp-rb--paused .agp-rb__progress-bar--active .agp-rb__progress-fill {
    animation-play-state: paused;
    /* Also handled by JS pausing the transition */
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .agp-rb {
        padding: 36px 28px 32px;
        text-align: center;
    }

    .agp-rb__desc {
        margin-left: auto;
        margin-right: auto;
    }

    .agp-rb__image img {
        max-height: 180px;
        margin-top: 16px;
    }
}

@media (max-width: 767.98px) {
    .agp-rb {
        padding: 28px 20px 24px;
    }

    .agp-rb__headline {
        font-size: 1.5rem;
    }

    .agp-rb__image img {
        max-height: 140px;
    }

    .agp-rb__progress-bar {
        width: 40px;
    }
}
