/* ==========================================================================
   realtime-news.css — Realtime Live News Engine & Cron Popup
   ----------------------------------------------------------------------------
   Extrahiert aus js/realtime-news.js (vorher per JS-String injiziert → FOUC,
   nicht browser-cache-bar). Nutzt konsistent die Design-Tokens aus
   default.css / theme_3.css (--color-*, --glass-*, --radius-*, --shadow-*),
   damit das White-Labeling automatisch durchschlaegt.
   Last updated: 2026-08-04
   ========================================================================== */

/* --- Animations --------------------------------------------------------- */
@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--color-red, #ef4444); opacity: 1; }
    70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes slideUpDrawer {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Live Pulsing Dot --------------------------------------------------- */
.live-pulsing-dot {
    width: 10px;
    height: 10px;
    background-color: var(--color-red, #ef4444);
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulseDot 2s infinite;
}

/* --- High-Contrast Search Box (dark, fix white-on-white) ---------------- */
#news-search-input {
    background-color: var(--color-primary-mid, #1e293b) !important;
    color: var(--color-text-heading, #f8fafc) !important;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.18)) !important;
    font-size: 0.85rem !important;
}
#news-search-input::placeholder {
    color: var(--color-text-muted, #94a3b8) !important;
    opacity: 1 !important;
}
#news-search-input:focus {
    background-color: var(--color-primary, #0f172a) !important;
    color: #ffffff !important;
    border-color: var(--color-blue, #3b82f6) !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.3) !important;
    outline: none !important;
}

/* --- Glassmorphic Header Action Buttons --------------------------------- */
.realtime-action-pill-push {
    background: rgba(245, 158, 11, 0.12) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    backdrop-filter: blur(4px);
}
.realtime-action-pill-push:hover,
.realtime-action-pill-push:focus {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: #f59e0b !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4) !important;
    outline: none !important;
}

.realtime-action-pill-audio {
    background: rgba(56, 189, 248, 0.12) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    color: #38bdf8 !important;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    backdrop-filter: blur(4px);
}
.realtime-action-pill-audio:hover,
.realtime-action-pill-audio:focus {
    background: rgba(56, 189, 248, 0.25) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
    outline: none !important;
}

/* --- Custom Scrollbar --------------------------------------------------- */
#news-popup-scrollbody::-webkit-scrollbar {
    width: 8px;
}
#news-popup-scrollbody::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
}
#news-popup-scrollbody::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
#news-popup-scrollbody::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.8);
}

/* --- News Item Card ----------------------------------------------------- */
.news-item-card {
    background: var(--glass-bg, rgba(30, 41, 59, 0.7));
    backdrop-filter: var(--glass-blur, blur(8px));
    border: 1px solid var(--glass-border, rgba(51, 65, 85, 0.6));
    transition: all 0.25s ease-in-out;
}
.news-item-card:hover,
.news-item-card:focus-within {
    border-color: var(--color-blue, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Phase 5: Frische-Karte visuell hervorheben (linker Akzent-Streifen). */
.news-item-card.is-fresh {
    border-left: 3px solid var(--color-accent-cyan, #06b6d4);
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), var(--glass-bg, rgba(30, 41, 59, 0.7)) 18%);
}

/* Freshness-Badge: pulsierender Punkt + "NEU" – nur auf wirklich neuen Artikeln. */
.news-fresh-badge {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(59, 130, 246, 0.25));
    border: 1px solid rgba(6, 182, 212, 0.55);
    color: var(--color-accent-cyan, #67e8f9);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}
.news-fresh-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent-cyan, #22d3ee);
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7);
    animation: pulseDot 1.8s infinite;
}

/* Karten-Excerpt: auf 2 Zeilen begrenzen (line-clamp), sauberer Abschlus. */
.news-card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.82;
}

/* Karten-Footer: Quelle + Weiterlesen-Affordance, dezent aber scanbar. */
.news-card-footer {
    font-size: 0.72rem;
}
.news-source-pill {
    color: var(--color-text-muted, #94a3b8);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.news-readmore-pill {
    color: var(--color-blue, #60a5fa);
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.2s ease;
}
.news-item-card:hover .news-readmore-pill,
.news-item-card:focus-within .news-readmore-pill {
    transform: translateX(3px);
}

/* Karten-Titel: kompakter, besserer Zeilenumbruch. */
.news-item-card h3 {
    line-height: 1.35;
}

/* --- Empty State -------------------------------------------------------- */
.news-empty-state {
    color: var(--color-text-muted, #94a3b8);
}
.news-empty-icon {
    font-size: 2.4rem;
    opacity: 0.85;
    animation: pulseGlow 2.4s infinite;
    display: inline-block;
}

/* --- Unread-Badge (Watchdog) ------------------------------------------- */
.news-unread-badge {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
    animation: pulseGlow 1.5s infinite;
}
.realtime-trigger-btn.has-unread {
    border-color: rgba(245, 158, 11, 0.6) !important;
}

/* --- Toast Banner ------------------------------------------------------- */
#news-toast-banner {
    position: sticky;
    top: 0;
    z-index: 1050;
    animation: fadeInDown 0.4s ease-out;
}

/* --- Trigger Button (Countdown) ---------------------------------------- */
.realtime-trigger-btn {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: var(--color-text-heading, #f8fafc) !important;
    font-size: 0.825rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.realtime-trigger-btn:hover,
.realtime-trigger-btn:focus {
    background: var(--color-red, #ef4444) !important;
    color: #ffffff !important;
    border-color: var(--color-red, #ef4444) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.5) !important;
    transform: translateY(-1px);
    outline: none;
}

/* --- Category Pills ----------------------------------------------------- */
.category-pill {
    background: rgba(51, 65, 85, 0.5);
    color: var(--color-text-muted, #cbd5e1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.category-pill:hover,
.category-pill:focus,
.category-pill.active {
    background: #2563eb;
    color: #ffffff;
    border-color: var(--color-blue, #3b82f6);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    outline: none;
}

.animate-pulse {
    animation: pulseGlow 1.5s infinite;
}

/* --- Fetch Loading Bar (Phase 5) --------------------------------------- */
/* Duenner, animierter Balken ganz oben, waehrend ein /live-news-Fetch laeuft.
   Sicherheitsbewusst umgesetzt: nur eine Body-Klasse wird getoggelt (kein
   zusaetzliches DOM-Element, keine Beruehrung der Modal-Erstellungslogik). */
body.realtime-fetching::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-cyan, #06b6d4), var(--color-blue, #3b82f6), var(--color-accent-cyan, #06b6d4));
    background-size: 200% 100%;
    animation: realtimeFetchSweep 1s linear infinite;
    z-index: 10002;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    pointer-events: none;
}
@keyframes realtimeFetchSweep {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* --- Mobile Slide-Up Drawer (< 768px) ---------------------------------- */
@media (max-width: 767.98px) {
    #news-popup {
        width: 100vw !important;
        height: 85vh !important;
        max-width: 100vw !important;
        max-height: 85vh !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        transform: translateY(0) !important;
        border-radius: 18px 18px 0 0 !important;
        border-bottom: none !important;
        animation: slideUpDrawer 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .mobile-drawer-handle {
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
        margin: 5px auto 2px auto;
    }

    .popup-header {
        padding: 10px 14px !important;
    }

    .popup-controls {
        padding: 10px 14px !important;
        gap: 8px !important;
    }

    .popup-scrollbody {
        padding: 12px 14px !important;
    }

    .popup-footer {
        padding: 10px 14px !important;
    }

    .news-item-card {
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }

    .news-item-card h3 {
        font-size: 0.875rem !important;
        line-height: 1.35 !important;
    }

    .search-box {
        min-width: 120px !important;
        flex-grow: 1;
    }
}

/* --- Header Live-Radar Countdown Badge --------------------------------- */
.live-radar-header-badge {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #fca5a5 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    transition: all 0.25s ease !important;
    cursor: pointer;
}

.live-radar-header-badge:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: livePulseRing 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes livePulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
        transform: scale(0.95);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(0.95);
    }
}

.live-radar-header-badge.is-syncing {
    background: rgba(99, 102, 241, 0.25) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    color: #c7d2fe !important;
    animation: liveSyncPulse 1s infinite alternate;
}

@keyframes liveSyncPulse {
    from { box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); }
    to { box-shadow: 0 0 14px rgba(99, 102, 241, 0.9); }
}

.live-radar-highlight {
    animation: radarContainerFlash 2.5s ease-out;
}

@keyframes radarContainerFlash {
    0% { box-shadow: 0 0 0 4px #6366f1, 0 0 30px rgba(99, 102, 241, 0.6); }
    100% { box-shadow: none; }
}

/* --- Accessibility: Reduced Motion (Phase 3.3) -------------------------- */
@media (prefers-reduced-motion: reduce) {
    .live-pulsing-dot,
    .live-pulse-dot,
    .animate-pulse,
    #news-popup,
    #news-toast-banner,
    .news-item-card {
        animation: none !important;
        transition: none !important;
    }

    #news-popup {
        animation: none !important;
    }
}

