/**
 * ZeVoice News Ticker — Frontend Styles
 *
 * Vertical-flip breaking-news banner, inspired by BFM/LCI TV tickers.
 * Dark background with a left accent bar, one line visible at a time.
 *
 * Uses the Ze Mood design system variables (--zm-*) for palette coherence.
 *
 * @since 2.38.0
 */

/* ═══════════════════════════════════════════════════════════════
   1. VARIABLES & CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker {
    /* ── Ze Mood palette ── */
    --zm-violet:       #696ACB;
    --zm-violet-dark:  #5558b3;
    --zm-violet-glow:  rgba(105, 106, 203, 0.35);
    --zm-vert:         #CBE236;
    --zm-noir:         #383E52;

    /* ── Ticker-specific ── */
    --zvt-bg:           #1a1a2e;
    --zvt-bg-accent:    #16213e;
    --zvt-text:         #e0e0e0;
    --zvt-text-bright:  #ffffff;
    --zvt-accent:       var(--zm-violet);
    --zvt-accent-glow:  var(--zm-violet-glow);
    --zvt-cta-color:    var(--zm-vert);
    --zvt-cta-border:   rgba(203, 226, 54, 0.35);
    --zvt-dot-inactive: rgba(255, 255, 255, 0.2);
    --zvt-dot-active:   var(--zm-vert);
    --zvt-height:       52px;
    --zvt-bar-width:    4px;

    position: relative;
    width: 100%;
    background: var(--zvt-bg);
    overflow: hidden;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-family: 'Spectral', Georgia, serif;
    user-select: none;
}

/* Left accent bar — Ze Mood violet */
.zv-ticker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--zvt-bar-width);
    height: 100%;
    background: linear-gradient(
        180deg,
        var(--zvt-accent) 0%,
        var(--zm-vert) 100%
    );
    z-index: 2;
}

/* Subtle animated glow pulse on the left bar */
.zv-ticker::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--zvt-bar-width);
    height: 100%;
    background: var(--zvt-accent);
    opacity: 0;
    z-index: 3;
    animation: zvt-bar-pulse 4s ease-in-out infinite;
}

@keyframes zvt-bar-pulse {
    0%, 100% { opacity: 0; }
    50%      { opacity: 0.6; }
}


/* ═══════════════════════════════════════════════════════════════
   2. VIEWPORT — Visible window (one item height)
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker-viewport {
    position: relative;
    height: var(--zvt-height);
    overflow: hidden;
    padding-left: calc(var(--zvt-bar-width) + 16px);
    padding-right: 16px;
}


/* ═══════════════════════════════════════════════════════════════
   3. ITEMS — Stacked absolutely, vertical-flip animation
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--zvt-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-left: calc(var(--zvt-bar-width) + 16px);
    padding-right: 16px;

    /* Start invisible & shifted down */
    opacity: 0;
    transform: translateY(100%);
    will-change: transform, opacity;

    /* Transition for the flip effect */
    transition:
        transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
        opacity   0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Active item: visible & in place */
.zv-ticker-item--active {
    opacity: 1;
    transform: translateY(0);
}

/* Exiting item: flips upward */
.zv-ticker-item--exit {
    opacity: 0;
    transform: translateY(-100%);
}


/* ═══════════════════════════════════════════════════════════════
   4. ITEM INNER ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

/* Icon (emoji) */
.zv-ticker-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.15));
}

/* Text */
.zv-ticker-text {
    flex: 0 1 auto;
    min-width: 0;
    color: var(--zvt-text);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CTA button */
.zv-ticker-cta {
    flex-shrink: 0;
    align-self: center;
    height: auto;
    line-height: 1.4;
    color: var(--zvt-cta-color);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--zvt-cta-border);
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.zv-ticker-cta:hover,
.zv-ticker-cta:focus-visible {
    background: rgba(203, 226, 54, 0.12);
    border-color: var(--zvt-cta-color);
    color: #fff;
    outline: none;
}


/* ═══════════════════════════════════════════════════════════════
   5. NAVIGATION DOTS
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 8px;
    background: var(--zvt-bg);
}

.zv-ticker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--zvt-dot-inactive);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.zv-ticker-dot--active {
    background: var(--zvt-dot-active);
    transform: scale(1.35);
    box-shadow: 0 0 6px rgba(203, 226, 54, 0.5);
}


/* ═══════════════════════════════════════════════════════════════
   6. PAUSE INDICATOR (appears on hover)
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker-pause {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    z-index: 5;
}

.zv-ticker:hover .zv-ticker-pause,
.zv-ticker.zv-ticker--paused .zv-ticker-pause {
    opacity: 1;
}

.zv-ticker-pause-bar {
    width: 3px;
    height: 14px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
}


/* ═══════════════════════════════════════════════════════════════
   7. PROGRESS BAR (thin line at bottom)
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    z-index: 4;
}

.zv-ticker-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(
        90deg,
        var(--zvt-accent) 0%,
        var(--zvt-cta-color) 100%
    );
    /* Animation controlled by JS via style.animationDuration */
    animation: zvt-progress-fill linear forwards;
}

@keyframes zvt-progress-fill {
    from { width: 0%; }
    to   { width: 100%; }
}

/* Paused state stops the progress bar */
.zv-ticker--paused .zv-ticker-progress-bar {
    animation-play-state: paused;
}


/* ═══════════════════════════════════════════════════════════════
   8. SINGLE-ITEM MODE (no rotation needed)
   ═══════════════════════════════════════════════════════════════ */

.zv-ticker[data-count="1"] .zv-ticker-dots,
.zv-ticker[data-count="1"] .zv-ticker-progress,
.zv-ticker[data-count="1"] .zv-ticker-pause {
    display: none;
}


/* ═══════════════════════════════════════════════════════════════
   9. RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Small screens: tighter layout */
@media (max-width: 600px) {
    .zv-ticker {
        --zvt-height: 46px;
    }

    .zv-ticker-item {
        gap: 8px;
        padding-left: calc(var(--zvt-bar-width) + 12px);
        padding-right: 10px;
    }

    .zv-ticker-viewport {
        padding-left: calc(var(--zvt-bar-width) + 12px);
        padding-right: 10px;
    }

    .zv-ticker-text {
        font-size: 13px;
    }

    .zv-ticker-cta {
        font-size: 11px;
        padding: 3px 8px;
    }

    .zv-ticker-icon {
        font-size: 16px;
    }
}

/* Very small screens: hide CTA, let text breathe */
@media (max-width: 400px) {
    .zv-ticker-cta {
        display: none;
    }

    .zv-ticker-text {
        font-size: 12.5px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   10. REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .zv-ticker-item {
        transition-duration: 0.01ms;
    }

    .zv-ticker-progress-bar {
        animation-duration: 0.01ms !important;
    }

    .zv-ticker::after {
        animation: none;
    }
}
