/**
 * UI Enhancements - Frutiger Aero Y2K Style
 * Components: Meta Strip, Hero Dashboard, Desktop Sidebar, Site Footer, Two-tier Footers
 */

/* ============================================
   META STRIP - Between filters and articles
   ============================================ */
.meta-strip {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 20px;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.12);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.meta-strip .trend-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.trend-tile {
    padding: 0.5rem 0.85rem;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.trend-tile i {
    color: var(--primary);
    font-size: 0.75rem;
}

.trend-tile strong {
    color: var(--text-primary);
    font-weight: 600;
}

.topic-capsules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1;
    min-width: 150px;
}

.topic-capsule {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-timeline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.activity-timeline .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* ============================================
   HERO STATUS RAIL - Compact ticker-only bar
   ============================================ */
.hero-status-rail {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 44px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    margin-top: 0;
    overflow: hidden;
}

.hero-status-rail__ticker {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

/* Full-width ticker (no stat boxes) */
.hero-status-rail__ticker--full {
    border-left: none;
    padding-left: 0;
}

.hero-status-rail__ticker-label {
    flex-shrink: 0;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.hero-status-rail__ticker-track {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
}

.hero-status-rail__ticker-text {
    display: inline-block;
    white-space: nowrap;
    width: max-content;
    animation: heroTicker var(--hero-duration, 20s) linear infinite;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes heroTicker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Dark theme - command strip */
[data-theme="dark"] .hero-status-rail {
    background: rgba(12, 20, 31, 0.90);
    border: 1px solid rgba(30, 45, 64, 0.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Legacy hero-dashboard hidden - replaced by status rail */
.hero-dashboard {
    display: none !important;
}

/* ============================================
   DESKTOP SIDEBAR - ≥1200px only
   ============================================ */
.content-with-sidebar {
    display: flex;
    gap: 1.5rem;
}

.content-main {
    flex: 1;
    min-width: 0;
}

.desktop-sidebar {
    width: 260px;
    flex-shrink: 0;
}

/* Sidebar filter sections */
.sidebar-section {
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin: 0 0 0.625rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-section-title i {
    color: var(--primary);
    font-size: 0.7rem;
}

/* View toggle in sidebar - compact horizontal row */
.sidebar-view-toggle .view-toggle {
    flex-direction: row;
    width: 100%;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 10px;
}

.sidebar-view-toggle .view-button {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 8px;
}

/* Topic tags in sidebar - wrap in narrow column */
.sidebar-topics .filter-tags {
    gap: 0.35rem;
}

.sidebar-topics .tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.65rem;
}

/* Controls section - vertical stack */
.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-controls .layout-switcher {
    margin-bottom: 0.25rem;
}

.sidebar-controls .toggle-switch {
    font-size: 0.8rem;
}

.sidebar-controls .toggle-label {
    font-size: 0.75rem;
}

.sidebar-controls .time-frame-selector {
    margin-top: 0.25rem;
}

.sidebar-controls .time-frame-select {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
}

[data-theme="dark"] .sidebar-section {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.15);
}

/* ============================================
   SITE FOOTER
   ============================================ */
.site-footer {
    margin-top: 3rem;
    padding: 2rem clamp(1rem, 4vw, 2rem);
    border-radius: 24px 24px 0 0;
    background: rgba(var(--primary-rgb), 0.04);
    border-top: 1px solid rgba(var(--primary-rgb), 0.12);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.footer-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trust-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 150ms ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.newsletter-form input {
    flex: 1;
    min-width: 160px;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.newsletter-form input::placeholder {
    color: var(--text-muted);
}

.newsletter-form button {
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: var(--primary);
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.newsletter-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-links a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.social-links a:hover {
    background: var(--primary);
    color: var(--bg-primary);
}

/* ============================================
   TWO-TIER CARD FOOTERS
   ============================================ */
.article-footer-enhanced {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-tier {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.footer-tier-primary {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
}

.footer-source {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.source-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(var(--primary-rgb), 0.15);
    font-size: 0.7rem;
}

.footer-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reading-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.severity-chip {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.severity-chip.critical {
    background: rgba(255, 86, 102, 0.15);
    color: #ff5666;
    border: 1px solid rgba(255, 86, 102, 0.3);
}

.severity-chip.high {
    background: rgba(255, 147, 71, 0.15);
    color: #ff9347;
    border: 1px solid rgba(255, 147, 71, 0.3);
}

.severity-chip.medium {
    background: rgba(255, 216, 102, 0.15);
    color: #ffd866;
    border: 1px solid rgba(255, 216, 102, 0.3);
}

.severity-chip.low {
    background: rgba(101, 240, 160, 0.15);
    color: #65f0a0;
    border: 1px solid rgba(101, 240, 160, 0.3);
}

.footer-tier-secondary {
    justify-content: flex-end;
}

.footer-action {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease;
}

.footer-action:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.2);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Sidebar always visible - holds filter controls */
.desktop-sidebar {
    display: block;
}

/* Mobile/Tablet: sidebar sits above content as horizontal filter row */
@media (max-width: 1199px) {
    .content-with-sidebar {
        flex-direction: column;
    }

    .desktop-sidebar {
        width: 100%;
        order: -1;
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem;
        border-radius: 1rem;
        background: var(--surface-card);
        border: 1px solid var(--surface-card-border);
        margin-bottom: 1rem;
    }

    [data-theme="dark"] .desktop-sidebar {
        background: rgba(12, 20, 31, 0.90);
        border-color: rgba(30, 45, 64, 0.50);
    }

    .sidebar-section {
        margin-bottom: 0;
        background: transparent;
        border: none;
        padding: 0.25rem;
    }

    .sidebar-section-title {
        display: none;
    }

    .sidebar-view-toggle .view-toggle {
        flex-direction: row;
    }

    .sidebar-view-toggle .view-button {
        width: auto;
    }

    .sidebar-controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
        max-width: 100%;
        overflow: hidden;
    }
}

/* Mobile sidebar overflow containment */
@media (max-width: 768px) {
    .desktop-sidebar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Desktop: ≥1200px - sidebar as vertical column */
@media (min-width: 1200px) {
    .desktop-sidebar {
        position: sticky;
        top: 5rem;
        height: fit-content;
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
    }
}

/* Tablet and below: <1024px */
@media (max-width: 1024px) {
    .meta-strip {
        flex-direction: column;
        align-items: stretch;
    }

    .activity-timeline {
        margin-left: 0;
    }
}

/* Mobile: <768px */
@media (max-width: 768px) {
    .meta-strip {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .trend-tiles {
        flex-direction: column;
    }

    .trend-tile {
        width: 100%;
    }

    /* Status rail responsive - simplified ticker-only */
    .hero-status-rail {
        height: auto;
        padding: 12px 16px;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .site-footer {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }

    .footer-tier-secondary {
        justify-content: flex-start;
    }
}

/* Small mobile: <480px */
@media (max-width: 480px) {
    .meta-strip {
        display: none;
    }

    .hero-status-rail {
        /* Keep visible on mobile, just reduce padding */
        padding: 8px 12px;
        min-height: auto;
    }

    .site-footer {
        border-radius: 16px 16px 0 0;
    }
}

/* Light theme adjustments */
[data-theme="light"] .meta-strip,
[data-theme="light"] .stat-card,
[data-theme="light"] .sidebar-widget,
[data-theme="light"] .site-footer {
    background: rgba(var(--primary-rgb), 0.04);
}

[data-theme="light"] .trend-tile {
    background: rgba(var(--primary-rgb), 0.06);
}

[data-theme="light"] .topic-capsule {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
