/* =============================================================
   WP Announcement Bar — Frontend Styles  v1.1.0
   All selectors scoped to #wab-bar / .wab-* to avoid conflicts
   ============================================================= */

/* ── Base bar ─────────────────────────────────────────────────── */
#wab-bar {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    z-index: 99990;
    line-height: 1.4;
    text-align: center;
    padding-top:    var(--wab-pad-desk, 8px);
    padding-bottom: var(--wab-pad-desk, 8px);
    font-size:      var(--wab-fs-desk,  13px);
    font-weight:    var(--wab-fw-desk,  400);
    letter-spacing: var(--wab-ls-desk,  0);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Static bar in theme header context */
#wab-bar:not(.wab-fixed):not(.wab-sticky) {
    position: relative;
}

/* Sticky top bar (moves with page scroll at top) */
#wab-bar.wab-sticky {
    position: sticky;
    top: 0;
}

/* Fixed position bar (fallback positioning when wp_body_open is absent) */
#wab-bar.wab-fixed {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99990;
}
#wab-bar.wab-fixed:not(.wab-bottom) {
    top: 0;
}
#wab-bar.wab-fixed.wab-bottom {
    bottom: 0;
    top: auto;
}

/* Reset margins on adjacent elements when fixed */
#wab-bar.wab-fixed + *,
#wab-bar.wab-fixed ~ header {
    margin-top: 0 !important;
}

#wab-bar.wab-bottom.wab-fixed + *,
#wab-bar.wab-bottom.wab-fixed ~ header {
    margin-top: 0 !important;
}

/* ── Inner wrapper ────────────────────────────────────────────── */
.wab-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
    max-width: 100%;
    gap: 4px;
}

/* ── Track ────────────────────────────────────────────────────── */
.wab-track {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
}

/* ── Items (Full track height for 100% translateY bounds) ────── */
.wab-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    padding: 0 8px;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    will-change: transform, opacity;
}

.wab-item.wab-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Link inside item inherits bar color — !important beats theme a:hover rules */
.wab-link {
    color: inherit !important;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.wab-link:hover,
.wab-link:focus-visible {
    color: inherit !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Buttons (arrows + close) — !important beats Elementor/theme button:hover rules */
.wab-btn {
    position: relative;
    background: none !important;
    border: none !important;
    color: inherit !important;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.65;
    transition: opacity 0.2s ease;
    border-radius: 3px;
    box-shadow: none !important;
    z-index: 10;
    min-width: 28px;
    min-height: 28px;
}

/* Accessible 44×44px touch hit area without visual padding hacks */
.wab-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

.wab-btn svg {
    stroke: currentColor;
    pointer-events: none;
}

.wab-btn:hover,
.wab-btn:focus,
.wab-btn:focus-visible,
.wab-btn:active {
    background: none !important;
    color: inherit !important;
    opacity: 1 !important;
    outline: none !important;
    box-shadow: none !important;
}

.wab-prev {
    position: absolute !important;
    left: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10;
    width: 28px;
    height: 28px;
}

/* Compensate track padding when absolute buttons are present to maintain perfect horizontal centering */
.wab-inner:has(.wab-prev) .wab-track {
    padding-left: 28px;
}
.wab-inner:has(.wab-close) .wab-track {
    padding-right: 28px;
}
.wab-inner:has(.wab-cta) .wab-track {
    padding-right: 28px;
}
.wab-inner:has(.wab-cta):has(.wab-close) .wab-track {
    padding-right: 56px;
}

/* ── CTA button ────────────────────────────────────────────────── */
.wab-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    margin: 0 4px;
    color: #fff;
    background: rgba(255,255,255,0.15);
    transition: background 0.2s ease;
    z-index: 10;
}
.wab-cta:hover,
.wab-cta:focus-visible {
    background: rgba(255,255,255,0.25);
    color: #fff;
    text-decoration: none;
}

/* ── Close / dismiss button ───────────────────────────────────── */
.wab-close {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 4px;
    z-index: 10;
}

/* ── Progress bar indicator ────────────────────────────────────── */
.wab-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: currentColor;
    opacity: 0.35;
    width: 0%;
    transition: width linear;
    pointer-events: none;
    z-index: 11;
}

/* Kill any border/margin/pseudo on the element that follows the bar */
#wab-bar + *,
#wab-bar ~ #whn-header,
#wab-bar ~ header,
#wab-bar ~ .site-header {
    border-top: none !important;
    margin-top: -1px !important;
}
#wab-bar + *::before,
#wab-bar ~ #whn-header::before,
#wab-bar ~ header::before,
#wab-bar ~ .site-header::before {
    display: none !important;
}

/* ── Dot indicators ───────────────────────────────────────────── */
.wab-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 0 0;
}

.wab-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    border: none;
    cursor: pointer;
    padding: 19px;
    margin: -19px;
    box-sizing: content-box;
    opacity: 0.3;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.wab-dot.wab-dot-active {
    opacity: 1;
    transform: scale(1.4);
}

/* ── Transition: None (Instant) ────────────────────────────────── */
#wab-bar[data-transition="none"] .wab-item {
    transition: none !important;
    animation: none !important;
}

/* ── Transition: Fade ─────────────────────────────────────────── */
#wab-bar[data-transition="fade"] .wab-item {
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out !important;
}

/* ── Transition: Zoom Fade ────────────────────────────────────── */
#wab-bar[data-transition="zoom"] .wab-item {
    transform: scale(0.85);
    transition: opacity 0.4s ease-in-out, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.4s ease-in-out !important;
}

#wab-bar[data-transition="zoom"] .wab-item.wab-active {
    transform: scale(1);
}

/* ── Transition: Slide Vertical (ticker) ──────────────────────── */
.wab-item.wab-slide-in-next {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideInNext 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-in-prev {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideInPrev 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-out-next {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideOutNext 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-out-prev {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideOutPrev 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}

@keyframes wabSlideInNext  { from { transform: translateY(120%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes wabSlideInPrev  { from { transform: translateY(-120%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes wabSlideOutNext { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-120%); opacity: 0; } }
@keyframes wabSlideOutPrev { from { transform: translateY(0); opacity: 1; } to { transform: translateY(120%); opacity: 0; } }

/* ── Transition: Slide Horizontal ────────────────────────────── */
.wab-item.wab-slide-h-in-next {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideHInNext 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-h-in-prev {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideHInPrev 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-h-out-next {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideHOutNext 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}
.wab-item.wab-slide-h-out-prev {
    opacity: 1 !important;
    visibility: visible !important;
    animation: wabSlideHOutPrev 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}

@keyframes wabSlideHInNext  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes wabSlideHInPrev  { from { transform: translateX(-120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes wabSlideHOutNext { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-120%); opacity: 0; } }
@keyframes wabSlideHOutPrev { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

/* ── Device visibility & Responsive Spacing ───────────────────── */
@media (max-width: 767px) {
    .wab-hide-mobile {
        display: none !important;
    }

    #wab-bar {
        padding-top:    var(--wab-pad-mob, 9px);
        padding-bottom: var(--wab-pad-mob, 9px);
        font-size:      var(--wab-fs-mob,  12px);
        font-weight:    var(--wab-fw-mob,  400);
        letter-spacing: var(--wab-ls-mob,  0);
        text-align:     var(--wab-ta-mob,  center);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .wab-hide-tablet {
        display: none !important;
    }

    #wab-bar {
        padding-top:    var(--wab-pad-tab, 10px);
        padding-bottom: var(--wab-pad-tab, 10px);
        font-size:      var(--wab-fs-tab,  13px);
        font-weight:    var(--wab-fw-tab,  400);
        letter-spacing: var(--wab-ls-tab,  0);
        text-align:     var(--wab-ta-tab,  center);
    }
}

@media (min-width: 1024px) {
    .wab-hide-desktop {
        display: none !important;
    }

    #wab-bar {
        padding-top:    var(--wab-pad-desk, 11px);
        padding-bottom: var(--wab-pad-desk, 11px);
        font-size:      var(--wab-fs-desk,  14px);
        font-weight:    var(--wab-fw-desk,  400);
        letter-spacing: var(--wab-ls-desk,  0);
        text-align:     var(--wab-ta-desk,  center);
    }
}

/* ── Focus visible ─────────────────────────────────────────────── */
.wab-btn:focus-visible,
.wab-dot:focus-visible,
.wab-link:focus-visible,
.wab-cta:focus-visible,
.wab-close:focus-visible {
    outline: 3px solid -webkit-focus-ring-color;
    outline-offset: 2px;
}

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #wab-bar,
    .wab-item,
    .wab-track,
    .wab-btn,
    .wab-dot,
    .wab-cta,
    .wab-close {
        transition: none !important;
        animation: none !important;
    }
}
