/**
 * StockSphere — Premium Animated Scrolling Announcement Ticker
 * Lighter Theme UI matching Website & Logo Branding
 *
 * Colors:
 *   - Background: Pure White / Soft Mint Ice (#FFFFFF / #F0FDF9)
 *   - Logo Brand Green: #3EC89E (Hover: #2FB88A, Dark: #259C74)
 *   - Text: Deep Charcoal / Slate (#0F172A) for maximum readability
 *   - Text Highlight: Deep Emerald Green (#047857) with #3EC89E badge glow
 *   - Border: Subtle Logo Green Glass (#3EC89E at 0.45 opacity)
 */

:root {
    --ss-ticker-bg: #FFFFFF;
    --ss-ticker-bg-gradient: #FFFFFF;
    --ss-ticker-border: rgba(62, 200, 158, 0.45);
    --ss-ticker-border-glow: rgba(62, 200, 158, 0.15);

    --ss-ticker-brand-green: #3EC89E;
    --ss-ticker-brand-green-hover: #2FB88A;
    --ss-ticker-brand-dark: #259C74;
    --ss-ticker-brand-charcoal: #0F172A;

    --ss-ticker-text: #0F172A;
    --ss-ticker-text-muted: #64748B;
    --ss-ticker-highlight: #047857;

    --ss-ticker-desktop-height: 44px;
    --ss-ticker-mobile-height: 40px;
}

/* Outer Wrapper (aligns seamlessly with navigation container) */
.ss-ticker-wrapper {
    width: 100%;
    max-width: 1320px;
    margin: 0.65rem auto 0.75rem auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
    position: relative;
    z-index: 95;
}

/* The Main Ticker Bar — Clean Lighter Theme UI */
.ss-ticker-bar {
    width: 100%;
    height: var(--ss-ticker-desktop-height);
    background: var(--ss-ticker-bg);
    background: var(--ss-ticker-bg-gradient);
    border: 1px solid var(--ss-ticker-border);
    border-radius: 6px;
    box-shadow: 0 3px 14px var(--ss-ticker-border-glow), 0 1px 3px rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Fixed Lead Label on the Left ("LIVE" / StockSphere Logo Gradient) */
.ss-ticker-lead {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 1rem;
    height: 100%;
    background: linear-gradient(135deg, #259C74 0%, #3EC89E 100%);
    border-right: 1px solid rgba(37, 156, 116, 0.35);
    z-index: 5;
    flex-shrink: 0;
    box-shadow: none !important;
}

.ss-ticker-lead-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 0 6px #FFFFFF;
    position: relative;
    flex-shrink: 0;
}

.ss-ticker-lead-dot::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 1.5px solid #FFFFFF;
    opacity: 0.8;
    animation: ss-ticker-pulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ss-ticker-pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    70% {
        transform: scale(2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

.ss-ticker-lead-text {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #FFFFFF;
    white-space: nowrap;
}

/* Ensure no pseudo-element overlay before content */
.ss-ticker-bar::before {
    display: none !important;
    content: none !important;
}

/* Right Edge Fade Gradient (Incoming items from the right smoothly fade in from pure white) */
.ss-ticker-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 36px;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(270deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
}

/* Continuous Scrolling Content Area */
.ss-ticker-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

/* The Continuous Scrolling Rail */
.ss-ticker-rail {
    display: flex;
    align-items: center;
    width: max-content;
    will-change: transform;
    animation: ss-ticker-slide var(--ss-ticker-duration, 45s) linear infinite;
}

/* Keyframe Animation: Smooth Seamless Looping */
@keyframes ss-ticker-slide {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* Pause Scrolling on Mouse Hover or Keyboard Focus */
.ss-ticker-bar:hover .ss-ticker-rail,
.ss-ticker-bar:focus-within .ss-ticker-rail,
.ss-ticker-bar.is-paused .ss-ticker-rail {
    animation-play-state: paused !important;
}

/* Individual Duplicate Track for Infinite Loop */
.ss-ticker-track {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Ticker Message Item */
.ss-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.5rem;
    color: var(--ss-ticker-text);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.ss-ticker-item:hover {
    text-decoration: none;
}

/* Clickable Item Enhancements */
a.ss-ticker-item {
    cursor: pointer;
}

a.ss-ticker-item:hover .ss-ticker-text {
    color: var(--ss-ticker-brand-dark);
}

a.ss-ticker-item:hover .ss-ticker-cta {
    background: var(--ss-ticker-brand-green);
    color: #FFFFFF;
    border-color: var(--ss-ticker-brand-green);
    box-shadow: 0 2px 8px rgba(62, 200, 158, 0.35);
    transform: translateX(2px);
}

/* Icon */
.ss-ticker-icon {
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Category Badges — Clean Light SaaS Badges */
.ss-ticker-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 4px;
    line-height: 1.2;
    flex-shrink: 0;
}

.ss-ticker-badge-promotional {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FCD34D;
}

.ss-ticker-badge-feature {
    background: #ECFDF5;
    color: #047857;
    border: 1px solid #A7F3D0;
}

.ss-ticker-badge-update {
    background: #F0F9FF;
    color: #0369A1;
    border: 1px solid #BAE6FD;
}

.ss-ticker-badge-educational {
    background: #FAF5FF;
    color: #7E22CE;
    border: 1px solid #E9D5FF;
}

.ss-ticker-badge-announcement {
    background: #F0FDF4;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

/* Message Text */
.ss-ticker-text {
    color: var(--ss-ticker-text);
    letter-spacing: 0.01em;
}

/* Text Highlight — High Contrast Logo Green Pill */
.ss-ticker-highlight {
    color: var(--ss-ticker-highlight);
    font-weight: 700;
    background: rgba(62, 200, 158, 0.16);
    border: 1px solid rgba(62, 200, 158, 0.35);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Action CTA pill (Explore ->) */
.ss-ticker-cta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: rgba(62, 200, 158, 0.14);
    border: 1px solid rgba(62, 200, 158, 0.45);
    border-radius: 4px;
    color: #065F46;
    font-size: 0.70rem;
    font-weight: 700;
    margin-left: 0.35rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ss-ticker-cta svg {
    transition: transform 0.2s ease;
}

a.ss-ticker-item:hover .ss-ticker-cta svg {
    transform: translateX(2px);
}

/* Thin Separator between messages */
.ss-ticker-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    color: var(--ss-ticker-brand-green);
    opacity: 0.7;
    font-size: 0.55rem;
    flex-shrink: 0;
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .ss-ticker-rail {
        animation: none !important;
        transform: none !important;
    }
    .ss-ticker-viewport {
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--ss-ticker-brand-green) transparent;
    }
    .ss-ticker-lead-dot::after {
        animation: none !important;
    }
}

/* Responsive: Mobile & Tablet */
@media (max-width: 768px) {
    .ss-ticker-wrapper {
        padding: 0.35rem 0.75rem 0.5rem 0.75rem;
        margin-top: 0.25rem;
    }

    .ss-ticker-bar {
        height: var(--ss-ticker-mobile-height);
        border-radius: 6px;
    }

    .ss-ticker-lead {
        padding: 0 0.65rem;
        gap: 0.35rem;
    }

    .ss-ticker-lead-text {
        font-size: 0.65rem;
    }

    .ss-ticker-bar::after {
        width: 20px;
    }

    .ss-ticker-item {
        font-size: 0.75rem;
        gap: 0.4rem;
        padding: 0 0.35rem;
    }

    .ss-ticker-icon {
        font-size: 0.85rem;
    }

    .ss-ticker-badge {
        font-size: 0.62rem;
        padding: 1.5px 5px;
    }

    .ss-ticker-cta {
        display: none;
    }

    .ss-ticker-sep {
        padding: 0 0.85rem;
        font-size: 0.5rem;
    }
}
