/* ============================================================
   Coderix Widgets – Slider Styles  v2.0
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.cx-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ── Slide (now a plain flex container, no inline bg-image here —
   Swiper injects its own `style="width:...px"` on this element, and we
   deliberately avoid putting background-image on the same element to
   prevent any conflict with Swiper's own style attribute management) ── */
.cx-slider .swiper-slide.cx-slide {
    position: relative;
    display: flex;
    overflow: hidden;
}

/* ── Background layer — separate element, always behind content ───── */
.cx-slide-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-repeat: no-repeat;
    background-position: center center;
    background-color: #1a1a1a; /* visible fallback if an image URL is ever empty */
}

/* ── Vertical alignment ──────────────────────────────────── */
.cx-slide.cx-valign--top    { align-items: flex-start; }
.cx-slide.cx-valign--middle { align-items: center; }
.cx-slide.cx-valign--bottom { align-items: flex-end; }

/* ── Overlay ─────────────────────────────────────────────── */
.cx-slide__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ── Ken Burns ───────────────────────────────────────────── */
/* Rendered as its own bg-carrying element (PHP outputs the same
   background-image/size/position on it directly — see widget.php) */
.cx-ken-burns {
    position: absolute;
    inset: -5%;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    animation: cx-ken-burns 8s ease-in-out infinite alternate;
}
@keyframes cx-ken-burns {
    from { transform: scale(1);    }
    to   { transform: scale(1.08); }
}

/* When Ken Burns is active, hide the static bg layer underneath it
   so we don't double-paint the same image */
.cx-slide:has(.cx-ken-burns) .cx-slide-bg { opacity: 0; }

/* Slide link overlay */
.cx-slide__link-wrap {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
}

/* ── Content ─────────────────────────────────────────────── */
.cx-slide__content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 860px;
    padding: 20px 40px;
    box-sizing: border-box;
}

/* ── Horizontal alignment ────────────────────────────────── */
.cx-slide__content.cx-halign--center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
.cx-slide__content.cx-halign--left {
    text-align: left;
    margin-left: 0;
    margin-right: auto;
}
.cx-slide__content.cx-halign--right {
    text-align: right;
    margin-left: auto;
    margin-right: 0;
}

/* ── Button group alignment ──────────────────────────────── */
.cx-slide__content.cx-halign--center .cx-slide__btns { justify-content: center; }
.cx-slide__content.cx-halign--left   .cx-slide__btns { justify-content: flex-start; }
.cx-slide__content.cx-halign--right  .cx-slide__btns { justify-content: flex-end; }

/* ── Layout Presets ──────────────────────────────────────── */

/* Bottom bar: content sits at bottom with semi-dark strip */
.cx-layout--bottom-bar .cx-slide {
    align-items: flex-end;
}
.cx-layout--bottom-bar .cx-slide__content {
    width: 100%;
    max-width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    padding: 40px 60px 32px;
    text-align: left;
    margin: 0;
}
.cx-layout--bottom-bar .cx-slide__btns { justify-content: flex-start; }

/* Split: left-column feel */
.cx-layout--split .cx-slide__content {
    margin-left: 5%;
    margin-right: auto;
    text-align: left;
    background: rgba(0,0,0,0.45);
    border-radius: 8px;
    max-width: 480px;
}
.cx-layout--split .cx-slide__btns { justify-content: flex-start; }

/* Minimal: no subtitle, centered */
.cx-layout--minimal .cx-slide__subtitle,
.cx-layout--minimal .cx-slide__eyebrow { display: none; }
.cx-layout--minimal .cx-slide__content { max-width: 640px; }

/* Fullscreen: 100vh forced */
.cx-layout--fullscreen .swiper-slide { height: 100vh !important; }

/* ── Eyebrow / Badge Label ───────────────────────────────── */
.cx-slide__eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffc107;
    background: rgba(255,193,7,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

/* ── Title ───────────────────────────────────────────────── */
.cx-slide__title {
    margin: 0 0 16px;
    color: #fff;
    font-size: clamp(1.6rem, 4.5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

/* ── Subtitle ────────────────────────────────────────────── */
.cx-slide__subtitle {
    margin: 0 0 32px;
    color: rgba(255,255,255,0.92);
    font-size: clamp(0.92rem, 2vw, 1.15rem);
    line-height: 1.7;
}

/* ── Button Group ────────────────────────────────────────── */
.cx-slide__btns {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

/* ── Base Button ─────────────────────────────────────────── */
.cx-slide__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 36px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 0;
    transition: background 0.28s ease, color 0.28s ease, border-color 0.28s ease, transform 0.28s ease, box-shadow 0.28s ease;
    line-height: 1;
}
.cx-slide__btn:hover { transform: translateY(-2px); text-decoration: none; }

/* Filled */
.cx-slide__btn--1.cx-btn--filled  { background: #1e90ff; color: #fff; border-color: #1e90ff; }
.cx-slide__btn--1.cx-btn--filled:hover { background: #0070e0; border-color: #0070e0; }

/* Outline */
.cx-slide__btn.cx-btn--outline  { background: transparent; color: #fff; border-color: #fff; }
.cx-slide__btn.cx-btn--outline:hover { background: rgba(255,255,255,0.15); }

/* Ghost / Text */
.cx-slide__btn.cx-btn--ghost  { background: transparent; color: #fff; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.cx-slide__btn.cx-btn--ghost:hover { background: rgba(255,255,255,0.08); }

/* Pill */
.cx-slide__btn.cx-btn--pill  { border-radius: 999px; background: #1e90ff; color: #fff; border-color: #1e90ff; }
.cx-slide__btn.cx-btn--pill:hover { background: #0070e0; }

/* Button 2 default */
.cx-slide__btn--2 { background: transparent; color: #fff; border-color: rgba(255,255,255,0.6); }
.cx-slide__btn--2:hover { background: rgba(255,255,255,0.12); border-color: #fff; }

/* ── Navigation: Arrows ──────────────────────────────────── */
.cx-slider .swiper-button-prev,
.cx-slider .swiper-button-next {
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.28);
    border-radius: 50%;
    transition: background 0.25s, opacity 0.25s;
    display: flex !important;
}
.cx-slider .swiper-button-prev::after,
.cx-slider .swiper-button-next::after {
    font-size: 14px;
    color: #fff;
    font-weight: 700;
}
.cx-slider .swiper-button-prev:hover,
.cx-slider .swiper-button-next:hover { background: rgba(0,0,0,0.55); }

@media (max-width: 767px) {
    .cx-slider .swiper-button-prev,
    .cx-slider .swiper-button-next { width: 36px; height: 36px; }
    .cx-slider .swiper-button-prev::after,
    .cx-slider .swiper-button-next::after { font-size: 12px; }
}

/* ── Navigation: Dots (bullets) ──────────────────────────── */
.cx-slider .swiper-pagination { bottom: 18px; }

.cx-slider .swiper-pagination-bullet {
    width: 10px; height: 10px;
    background: rgba(255,255,255,0.50);
    opacity: 1;
    transition: background 0.3s, transform 0.3s;
}
.cx-slider .swiper-pagination-bullet-active {
    background: #fff;
    transform: scale(1.35);
}

/* Bars style */
.cx-slider .cx-dots--bars .swiper-pagination-bullet {
    width: 28px; height: 4px;
    border-radius: 2px;
}
.cx-slider .cx-dots--bars .swiper-pagination-bullet-active { transform: scaleX(1.3); }

/* Numbers style */
.cx-slider .cx-dots--numbers .swiper-pagination-bullet {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.cx-slider .cx-dots--numbers .swiper-pagination-bullet::before {
    counter-increment: bullet;
    content: counter(bullet);
}
.cx-slider .cx-dots--numbers { counter-reset: bullet; }
.cx-slider .cx-dots--numbers .swiper-pagination-bullet-active { background: #fff; color: #000; }

/* ── Navigation: Progress Bar ────────────────────────────── */
.cx-progress-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(255,255,255,0.2);
    z-index: 10;
}
.cx-progress-fill {
    height: 100%;
    width: 0%;
    background: #1e90ff;
    transition: width 0.1s linear;
}

/* ── Per-device visibility ───────────────────────────────── */
@media (min-width: 1025px) { .cx-slider .cx-hide-desktop { display: none !important; } }
@media (min-width: 768px) and (max-width: 1024px) { .cx-slider .cx-hide-tablet { display: none !important; } }
@media (max-width: 767px) { .cx-slider .cx-hide-mobile { display: none !important; } }

/* ── Content animations ──────────────────────────────────── */
/* Pure CSS only — JS never sets inline opacity/transform on these elements.
   This guarantees content can never get stuck invisible due to a JS error,
   timing race, or loop-mode/duplicate-slide index mismatch. Swiper itself
   adds/removes .swiper-slide-active reliably, even on cloned slides. */
.cx-animate {
    opacity: 0;
    transform: translateY(44px);
    transition: opacity 0.65s ease, transform 0.65s ease;
    transition-delay: 0.15s;
}

.cx-animate.cx-anim--up    { transform: translateY(44px); }
.cx-animate.cx-anim--down  { transform: translateY(-44px); }
.cx-animate.cx-anim--left  { transform: translateX(60px); }
.cx-animate.cx-anim--right { transform: translateX(-60px); }
.cx-animate.cx-anim--zoom  { transform: scale(0.82); }
.cx-animate.cx-anim--fade  { transform: none; }
.cx-animate.cx-anim--none  { opacity: 1; transform: none; transition: none; }

.swiper-slide-active .cx-animate,
.swiper-slide-duplicate-active .cx-animate {
    opacity: 1;
    transform: none;
}

/* Hard safety net: no matter what (JS fails, Swiper fails to add the
   active class, a conflicting plugin script interferes, etc.) force full
   visibility after 2s so content is NEVER permanently stuck hidden. */
@keyframes cx-force-visible { to { opacity: 1; transform: none; } }
.cx-animate { animation: cx-force-visible 0.01s 2s forwards; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .cx-slide__content { padding: 16px 28px; }
    .cx-layout--bottom-bar .cx-slide__content { padding: 32px 28px 24px; }
}
@media (max-width: 767px) {
    .cx-slide__content { padding: 12px 16px; }
    .cx-slide__title   { font-size: clamp(1.25rem, 6vw, 2.2rem); margin-bottom: 10px; }
    .cx-slide__subtitle{ font-size: 0.9rem; margin-bottom: 20px; }
    .cx-slide__btn     { padding: 11px 22px; font-size: 0.85rem; }
    .cx-slide__btns    { gap: 10px; }
    .cx-layout--bottom-bar .cx-slide__content { padding: 20px 16px 16px; }
    .cx-layout--split  .cx-slide__content { max-width: 90%; margin: 0 auto; }
}
@media (max-width: 480px) {
    .cx-slide__title   { font-size: 1.25rem; }
    .cx-slide__subtitle{ font-size: 0.85rem; }
    .cx-slide__btns    { flex-direction: column; align-items: stretch; }
    .cx-slide__btn     { text-align: center; justify-content: center; }
}