/**
 * Content Ticker Bar
 *
 * Displays content headlines in grid or carousel mode
 * Grid: Multiple items side-by-side
 * Carousel: Single item with crossfade transitions
 */

/* ========================================
   TICKER WRAPPER
   ======================================== */

.content-ticker-wrapper {
    width: 100%;
    display: block;
    margin-bottom: 30px;
}

/* Device visibility classes */
.content-ticker-wrapper.hide-desktop {
    display: none;
}

@media (max-width: 999px) {
    .content-ticker-wrapper.hide-tablet {
        display: none;
    }
}

@media (max-width: 689px) {
    .content-ticker-wrapper.hide-mobile {
        display: none;
    }
}

/* Legacy class support */
.content-ticker-header-element,
.shortnews-ticker-header-element {
    width: 100%;
    display: block;
}

/* ========================================
   TICKER CONTAINER
   ======================================== */

.content-ticker-bar,
.shortnews-ticker-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 90;
}

.ticker-container {
    display: flex;
    align-items: stretch;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* ========================================
   TICKER LABEL
   ======================================== */

.ticker-label {
    display: none;
}

.ticker-label-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.ticker-label-line {
    display: block;
}

.ticker-label svg {
    width: 16px;
    height: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* ========================================
   TICKER ITEMS GRID
   ======================================== */

.ticker-items {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    flex: 1;
    min-width: 0;
}

.ticker-item {
    border-right: 1px solid #e5e7eb;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    min-width: 0;
    position: relative;
}

.ticker-item:last-child {
    border-right: none;
}

.ticker-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dc2626;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ticker-item:hover::before {
    opacity: 1;
}

/* ========================================
   TICKER LINKS
   ======================================== */

.ticker-link {
    display: block;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
    font-weight: 600;
    transition: color 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
}

.ticker-link:hover {
    color: #dc2626;
}

.ticker-link .external-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 0.25rem;
    opacity: 0.5;
    vertical-align: middle;
}

.ticker-link:hover .external-icon {
    opacity: 1;
}

/* ========================================
   VIEW ALL LINK
   ======================================== */

.ticker-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.875rem 1.25rem;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
    min-width: 90px;
}

.ticker-view-all:hover {
    background: #f3f4f6;
    color: #dc2626;
}

.ticker-view-all svg {
    width: 12px;
    height: 12px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Large Desktop (5 items visible) */
@media (min-width: 1200px) {
    .ticker-items {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Medium Desktop (4 items visible) */
@media (max-width: 1199px) and (min-width: 1024px) {
    .ticker-items {
        grid-template-columns: repeat(4, 1fr);
    }

    .ticker-item:nth-child(n+5) {
        display: none;
    }
}

/* Tablet (3 items visible) */
@media (max-width: 1023px) and (min-width: 768px) {
    .ticker-items {
        grid-template-columns: repeat(3, 1fr);
    }

    .ticker-item:nth-child(n+4) {
        display: none;
    }

    .ticker-label {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
        min-width: 85px;
    }

    .ticker-link {
        font-size: 0.8125rem;
    }

    .ticker-view-all {
        padding: 0.75rem 1rem;
        min-width: 80px;
    }
}

/* Mobile (2 items visible) */
@media (max-width: 767px) {
    .ticker-items {
        grid-template-columns: repeat(2, 1fr);
    }

    .ticker-item:nth-child(n+3) {
        display: none;
    }

    .ticker-label {
        padding: 0.625rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.25rem;
        min-width: 70px;
    }

    .ticker-label svg {
        width: 14px;
        height: 14px;
    }

    .ticker-link {
        font-size: 0.75rem;
        -webkit-line-clamp: 3;
    }

    .ticker-item {
        padding: 0.75rem 0.75rem;
    }

    .ticker-view-all {
        padding: 0.625rem 0.75rem;
        font-size: 0.75rem;
        min-width: 70px;
    }

    .ticker-view-all svg {
        width: 10px;
        height: 10px;
    }
}

/* Small Mobile (1 item visible) */
@media (max-width: 480px) {
    .ticker-items {
        grid-template-columns: 1fr;
    }

    .ticker-item:nth-child(n+2) {
        display: none;
    }

    .ticker-label-text {
        display: none;
    }

    .ticker-label {
        padding: 0.5rem;
        min-width: 48px;
    }

    .ticker-view-all span {
        display: none;
    }

    .ticker-view-all {
        min-width: 48px;
        padding: 0.5rem;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

[data-theme="dark"] .shortnews-ticker-bar,
[data-theme="dark"] .content-ticker-bar {
    background: #1f2937;
    border-bottom-color: #374151;
}

[data-theme="dark"] .ticker-item {
    border-right-color: #374151;
}

[data-theme="dark"] .ticker-link {
    color: #e5e7eb;
}

[data-theme="dark"] .ticker-link:hover {
    color: #ef4444;
}

[data-theme="dark"] .ticker-view-all {
    background: #374151;
    border-left-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .ticker-view-all:hover {
    background: #4b5563;
    color: #ef4444;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.ticker-view-all:focus-visible,
.ticker-link:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: -2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ticker-label svg {
        animation: none;
    }

    .ticker-item::before {
        transition: none;
    }
}

/* ========================================
   CAROUSEL MODE
   ======================================== */

/* Carousel mode: Single item display with crossfade */
.ticker-mode-carousel .ticker-items {
    display: block;
    position: relative;
    min-height: 60px;
    overflow: hidden;
}

.ticker-mode-carousel .ticker-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out;
    border-right: none;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ticker-mode-carousel .ticker-item.active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

.ticker-mode-carousel .ticker-link {
    text-align: center;
    justify-content: center;
}

/* Carousel on mobile */
@media (max-width: 767px) {
    .ticker-mode-carousel .ticker-item {
        padding: 0.75rem 0.75rem;
        min-height: 50px;
    }

    .ticker-mode-carousel .ticker-link {
        font-size: 0.8125rem;
    }
}

/* Reduced motion for carousel */
@media (prefers-reduced-motion: reduce) {
    .ticker-mode-carousel .ticker-item {
        transition: none;
    }
}

/* ========================================
   PRINT
   ======================================== */

@media print {
    .shortnews-ticker-bar,
    .content-ticker-bar {
        display: none;
    }
}
