/* =============================================================================
   BrixiesV2 Sticky ATC Bar
   Colors via CSS custom properties:
     --satc-bg        bar background
     --satc-fg        text color
     --satc-btn-bg    button background
     --satc-btn-fg    button text color
   ============================================================================= */

#brixiesv2-satc {
    position   : fixed;
    left       : 0;
    right      : 0;
    z-index    : 99999;
    background : var(--satc-bg, #fff);
    color      : var(--satc-fg, #1e293b);
    border-bottom : 1px solid rgba(0, 0, 0, 0.07);
    box-shadow : 0 4px 24px rgba(0, 0, 0, 0.10);
    pointer-events : none;
    /* Start hidden */
    transform  : translateY(-105%);
    transition : transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Top variant default */
#brixiesv2-satc.brixiesv2-satc--top { top: 0; }

/* Bottom variant */
#brixiesv2-satc.brixiesv2-satc--bottom {
    top         : auto;
    bottom      : 0;
    border-bottom : none;
    border-top  : 1px solid rgba(0, 0, 0, 0.07);
    box-shadow  : 0 -4px 24px rgba(0, 0, 0, 0.10);
    transform   : translateY(105%);
}

/* Visible state */
#brixiesv2-satc.brixiesv2-satc--visible {
    transform    : translateY(0);
    pointer-events: all;
}

/* ── Inner layout ────────────────────────────────────────────────────────────── */
.brixiesv2-satc__inner {
    max-width  : 1200px;
    margin     : 0 auto;
    padding    : 10px 20px;
    display    : flex;
    align-items: center;
    gap        : 16px;
}

/* ── Product info block ──────────────────────────────────────────────────────── */
.brixiesv2-satc__product {
    display    : flex;
    align-items: center;
    gap        : 12px;
    flex       : 1;
    min-width  : 0;
}

.brixiesv2-satc__thumb {
    width       : 40px;
    height      : 40px;
    object-fit  : cover;
    border-radius: 6px;
    flex-shrink : 0;
    border      : 1px solid rgba(0, 0, 0, 0.07);
}

.brixiesv2-satc__info {
    display   : flex;
    flex-direction: column;
    gap       : 1px;
    min-width : 0;
}

.brixiesv2-satc__name {
    font-size   : 13.5px;
    font-weight : 600;
    color       : var(--satc-fg, #1e293b);
    white-space : nowrap;
    overflow    : hidden;
    text-overflow: ellipsis;
}

.brixiesv2-satc__price {
    font-size  : 13px;
    color      : var(--satc-fg, #1e293b);
    opacity    : 0.7;
}

.brixiesv2-satc__price ins { text-decoration: none; }
.brixiesv2-satc__price del { opacity: 0.5; margin-right: 4px; }

/* ── Button ──────────────────────────────────────────────────────────────────── */
.brixiesv2-satc__btn {
    background  : var(--satc-btn-bg, #6366f1);
    color       : var(--satc-btn-fg, #fff);
    border      : none;
    border-radius: 8px;
    padding     : 10px 20px;
    font-size   : 13.5px;
    font-weight : 600;
    cursor      : pointer;
    white-space : nowrap;
    transition  : background 0.15s, transform 0.1s, opacity 0.15s;
    flex-shrink : 0;
    letter-spacing: 0.1px;
}

.brixiesv2-satc__btn:hover:not(:disabled) {
    filter   : brightness(1.08);
    transform: translateY(-1px);
}

.brixiesv2-satc__btn:active:not(:disabled) { transform: translateY(0); }

.brixiesv2-satc__btn--disabled {
    opacity : 0.5;
    cursor  : not-allowed;
}

.brixiesv2-satc__btn--added {
    background: #10b981 !important;
}

.brixiesv2-satc__btn--loading {
    opacity: 0.7;
    cursor: progress;
}

/* ── Sentinels ───────────────────────────────────────────────────────────────
   Zero-height markers inserted around the trigger element by sticky-atc.js.
   Used as IntersectionObserver targets for precise start/end boundary
   detection. Must remain in normal flow (display:block) so they sit at the
   trigger's true vertical edges; absolutely-positioned markers wouldn't.
   ─────────────────────────────────────────────────────────────────────────── */
.brixiesv2-satc__sentinel {
    display : block;
    width   : 0;
    height  : 0;
    margin  : 0;
    padding : 0;
    border  : 0;
    pointer-events: none;
}

/* ── Display modifiers ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #brixiesv2-satc.brixiesv2-satc--desktop { display: none !important; }
    .brixiesv2-satc__inner { padding: 9px 14px; gap: 10px; }
    .brixiesv2-satc__name  { font-size: 12.5px; }
    .brixiesv2-satc__btn   { padding: 9px 14px; font-size: 13px; }
}

@media (min-width: 769px) {
    #brixiesv2-satc.brixiesv2-satc--mobile { display: none !important; }
}

/* ── Button attention animation ──────────────────────────────────────────────
   Opt-in looping animation to draw the eye to the CTA. Runs only while the bar
   is visible, pauses on hover/focus, never runs on the disabled/loading/added
   states, and is fully suppressed when the visitor prefers reduced motion.
   ─────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    .brixiesv2-satc--visible.brixiesv2-satc--anim-pulse  .brixiesv2-satc__btn { animation: brixiesv2-satc-pulse  1.7s ease-in-out infinite; }
    .brixiesv2-satc--visible.brixiesv2-satc--anim-bounce .brixiesv2-satc__btn { animation: brixiesv2-satc-bounce 1.6s ease-in-out infinite; }
    .brixiesv2-satc--visible.brixiesv2-satc--anim-glow   .brixiesv2-satc__btn { animation: brixiesv2-satc-glow   1.8s ease-in-out infinite; }
    .brixiesv2-satc--visible.brixiesv2-satc--anim-shake  .brixiesv2-satc__btn { animation: brixiesv2-satc-shake  2.2s ease-in-out infinite; }

    /* Shine: a soft light sweep via an overlay pseudo-element. */
    .brixiesv2-satc--anim-shine .brixiesv2-satc__btn { position: relative; overflow: hidden; }
    .brixiesv2-satc--anim-shine .brixiesv2-satc__btn::after {
        content   : '';
        position  : absolute;
        top       : 0;
        left      : 0;
        width     : 60%;
        height    : 100%;
        background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
        transform : translateX(-180%) skewX(-18deg);
        pointer-events: none;
    }
    .brixiesv2-satc--visible.brixiesv2-satc--anim-shine .brixiesv2-satc__btn::after {
        animation: brixiesv2-satc-shine 2.6s ease-in-out infinite;
    }

    /* Pause while the user interacts; stop entirely when not actionable. */
    .brixiesv2-satc__btn:hover,
    .brixiesv2-satc__btn:focus-visible,
    .brixiesv2-satc__btn:hover::after,
    .brixiesv2-satc__btn:focus-visible::after { animation-play-state: paused; }

    .brixiesv2-satc__btn--disabled,
    .brixiesv2-satc__btn--loading,
    .brixiesv2-satc__btn--added { animation: none !important; }
    .brixiesv2-satc__btn--disabled::after,
    .brixiesv2-satc__btn--loading::after,
    .brixiesv2-satc__btn--added::after { animation: none !important; opacity: 0; }
}

@keyframes brixiesv2-satc-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.045); }
}

@keyframes brixiesv2-satc-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

@keyframes brixiesv2-satc-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--satc-btn-bg, #6366f1) 30%, transparent);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.18);
        box-shadow: 0 0 0 6px color-mix(in srgb, var(--satc-btn-bg, #6366f1) 24%, transparent);
    }
}

@keyframes brixiesv2-satc-shine {
    0%        { transform: translateX(-180%) skewX(-18deg); }
    60%, 100% { transform: translateX(320%)  skewX(-18deg); }
}

/* Quick wiggle in the first ~12% of the cycle, then rests — a periodic nudge
   rather than a constant shake, so it draws attention without being annoying. */
@keyframes brixiesv2-satc-shake {
    0%, 12%, 100% { transform: translateX(0); }
    2%  { transform: translateX(-3px); }
    4%  { transform: translateX(3px); }
    6%  { transform: translateX(-3px); }
    8%  { transform: translateX(3px); }
    10% { transform: translateX(-2px); }
}
