/**
 * News-Ticker CSS
 * Laufschrift mit Klick-Details - Barrierefrei
 */

/* Banner Container - wird nur angezeigt wenn Meldungen vorhanden */
.ticker-container {
    display: none;
    width: 100%;
    max-width: 100vw;
    background-color: var(--mainColor, #005092);
    position: relative;
    z-index: 100;
    box-sizing: border-box;
}

.ticker-container.active {
    display: block;
}

/* High contrast mode */
.high-contrast .ticker-container {
    background-color: #000;
    border-bottom: 2px solid #fff;
}

/* Banner wrapper */
.ticker-wrapper {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Label-Bereich "Aktuell" */
.ticker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 15px;
    background: rgba(0, 0, 0, 0.2);
    height: 100%;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.ticker-label i {
    font-size: 0.85rem;
}

/* Content-Wrapper - begrenzt den sichtbaren Bereich */
.ticker-content-wrapper {
    flex: 1 1 auto;
    overflow: hidden;
    position: relative;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Ticker Content - die animierte Laufschrift */
.ticker-content {
    display: inline-flex;
    align-items: center;
    animation: ticker-scroll 20s linear infinite;
    white-space: nowrap;
    will-change: transform;
    height: 100%;
    /* Kein padding-left - Text ist sofort sichtbar */
}

/* Animation pausieren bei Hover/Focus für Barrierefreiheit */
.ticker-content:hover,
.ticker-content:focus-within {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Scrollt zur Hälfte (duplizierter Inhalt) */
    }
}

/* Static mode - when all content fits on screen */
.ticker-content.ticker-static {
    animation: none !important;
    justify-content: flex-start;
    width: auto;
}

.ticker-content.ticker-static .ticker-separator:last-child {
    display: none; /* Hide last separator in static mode */
}


/* Einzelne Ticker-Meldung – Schrift & Hover wie Footer-Links */
.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 50px;
    height: 100%;
    color: white !important;
    font-size: 1rem;
    font-weight: 400;
    text-decoration: none !important;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: Roboto, Helvetica, Arial, Verdana, sans-serif;
    letter-spacing: normal;
    text-shadow: none;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.ticker-item > span {
    position: relative;
    display: inline-block;
}

/* Unterstreichungs-Linie wie bei .footer-link */
.ticker-item > span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: white;
    transition: width 0.3s ease;
}

.ticker-item:hover > span::after,
.ticker-item:focus > span::after {
    width: 100%;
}

.ticker-item:hover,
.ticker-item:focus {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* Focus-Ring für Barrierefreiheit */
.ticker-item:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Trennzeichen zwischen Meldungen */
.ticker-separator {
    color: rgba(255, 255, 255, 0.5);
    padding: 0 30px;
    font-size: 0.8rem;
}

/* Close Button */
.ticker-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 1rem;
}

.ticker-close:hover,
.ticker-close:focus {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.ticker-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}




/* ============================================
   Detail-Modal (bei Klick auf Meldung)
   ============================================ */
.ticker-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ticker-modal-overlay.open {
    display: flex;
}

.ticker-modal {
    background: #ffffff;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modal-appear 0.2s ease;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ticker-modal-header {
    background: var(--mainColor, #005092);
    color: #ffffff;
    padding: 20px;
    padding-right: 50px;
}

.ticker-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticker-modal-title i {
    font-size: 1.1rem;
}

.ticker-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.ticker-modal-close:hover,
.ticker-modal-close:focus {
    background: rgba(255, 255, 255, 0.3);
}

.ticker-modal-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.ticker-modal-body {
    padding: 25px;
}

.ticker-modal-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #333;
    margin: 0 0 20px 0;
}

.ticker-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--mainColor, #005092);
    color: #ffffff !important;
    padding: 12px 24px;
    border-radius: 5px;
    text-decoration: none !important;
    font-weight: 500;
    transition: background 0.2s;
}

.ticker-modal-link:hover,
.ticker-modal-link:focus {
    background: #003d73;
    color: #ffffff !important;
}

.ticker-modal-link:focus-visible {
    outline: 2px solid var(--mainColor, #005092);
    outline-offset: 2px;
}

/* Navigation im Modal (bei mehreren Meldungen) */
.ticker-modal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.ticker-modal-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid #ddd;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    color: #333;
    font-size: 0.95rem;
    transition: background 0.2s, border-color 0.2s;
}

.ticker-modal-nav-btn:hover,
.ticker-modal-nav-btn:focus {
    background: #e9ecef;
    border-color: #adb5bd;
}

.ticker-modal-nav-btn:focus-visible {
    outline: 2px solid var(--mainColor, #005092);
    outline-offset: 2px;
}

.ticker-modal-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.ticker-modal-counter {
    font-size: 0.9rem;
    color: #666;
}

/* Visually hidden für Screen Reader */
.ticker-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mobile Anpassungen */
@media (max-width: 768px) {
    .ticker-wrapper {
        height: 44px;
    }
    
    .ticker-label {
        padding: 0 10px;
        font-size: 0.8rem;
    }
    
    .ticker-label span {
        display: none;
    }
    
    .ticker-item {
        font-size: 1rem;
        padding: 0 30px;
    }
    
    .ticker-close {
        width: 36px;
        font-size: 0.9rem;
    }
    
    .ticker-modal {
        max-height: 90vh;
        margin: 10px;
    }
    
    .ticker-modal-header {
        padding: 15px;
        padding-right: 45px;
    }
    
    .ticker-modal-title {
        font-size: 1.1rem;
    }
    
    .ticker-modal-body {
        padding: 20px;
    }
    
    .ticker-modal-nav {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    .ticker-modal-nav-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* Reduzierte Bewegung (Barrierefreiheit) */
@media (prefers-reduced-motion: reduce) {
    .ticker-content {
        animation: none !important;
    }
    
    .ticker-modal {
        animation: none;
    }
}

/* Animation für das Einblenden */
.ticker-container.fade-in {
    animation: ticker-fade-in 0.3s ease forwards;
}

@keyframes ticker-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
