/**
 * Space News Feed Plugin CSS
 * Dark space-dashboard aesthetic matching STAR Astro website
 * Palette matches ISS Tracker Widget: #1b1b1b bg, #ffe9aa gold accent, #c8d6e5 text
 */

/* ─── Widget shell ──────────────────────────────────────────────────────────── */
.space-news-feed-widget {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    color: #c8d6e5;
    position: relative;
    background: #1b1b1b;
    border-radius: 14px;
    padding: 0;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 233, 170, 0.04);
    border: 1px solid rgba(255, 233, 170, 0.15);
    overflow: hidden;
}

.elementor-widget-space-news-feed .elementor-widget-container,
.wp-block-shortcode,
.entry-content .space-news-feed-widget {
    max-width: none;
}

/* ─── Header banner ──────────────────────────────────────────────────────────── */
.space-news-feed-header {
    width: 100%;
    position: relative;
}

.space-news-banner {
    width: 100%;
    height: 60px;
    background-image: var(--banner-image-url);
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Dark vignette over banner image */
.space-news-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.82) 0%,
        rgba(0, 20, 50, 0.55) 50%,
        rgba(0, 0, 0, 0.82) 100%
    );
    z-index: 1;
}

/* Animated sweep line at banner bottom */
.space-news-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffe9aa, #a89860, #ffe9aa, transparent);
    background-size: 200% 100%;
    z-index: 2;
    animation: bannerSweep 5s linear infinite;
}

@keyframes bannerSweep {
    0%   { background-position: -100% center; }
    100% { background-position: 100% center; }
}

/* Banner text block */
.space-news-banner-text {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.space-news-feed-banner h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: #ffe9aa;
    text-shadow: 0 0 18px rgba(255, 233, 170, 0.4);
    line-height: 1;
}

.space-news-banner-subtitle {
    font-size: 9px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #a89860;
    opacity: 0.8;
    font-weight: 400;
    line-height: 1;
}

/* ─── Main layout ────────────────────────────────────────────────────────────── */
.space-news-feed-container {
    padding: 12px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
}

/* ─── Content area ─────────────────────────────────────────────────────────── */
.space-news-feed-content {
    flex: 1;
    min-width: 0;
    position: relative;
}

.space-news-feed-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #ffe9aa;
    text-shadow: 0 0 10px rgba(255, 233, 170, 0.4);
}

/* ─── News items list — single horizontal row ──────────────────────────────── */
.space-news-feed-list {
    margin-bottom: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    overflow: hidden;
}

.space-news-item {
    background: rgba(255, 233, 170, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 233, 170, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    margin-bottom: 0;
    padding: 10px 12px;
    position: relative;
    overflow: hidden;
    transition: background 0.25s, border-color 0.25s, transform 0.25s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Grow equally to fill the row; JS uses 280px as the minimum for count */
    flex: 1 1 280px;
    min-width: 0;
    max-width: 100%;
}

.space-news-item:hover {
    background: rgba(255, 233, 170, 0.07);
    border-color: rgba(255, 233, 170, 0.18);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    transform: translateY(-2px);
}

/* Left accent bar */
.space-news-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #ffe9aa, #a89860);
    border-radius: 3px 0 0 3px;
}

.space-news-item-thumbnail {
    flex-shrink: 0;
    width: 100%;
    height: 140px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.space-news-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.space-news-item-content {
    flex: 1;
    min-width: 0;
}

.space-news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 6px;
}

.space-news-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffe9aa;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.space-news-item-source {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffe9aa;
    font-weight: 600;
    background: rgba(255, 233, 170, 0.08);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 233, 170, 0.18);
    margin: 0;
    display: inline-block;
    align-self: flex-start;
}

.space-news-item-meta {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #8a7a55;
    margin-bottom: 0;
    gap: 8px;
}

.space-news-item-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.space-news-item-date::before {
    content: '•';
    color: #a89860;
}

.space-news-item-excerpt {
    font-size: 12px;
    line-height: 1.4;
    color: #c8d6e5;
    margin: 0;
}

.space-news-item-link {
    display: inline-block;
    color: #ffe9aa;
    text-decoration: none;
    font-weight: 600;
    padding: 5px 12px;
    border: 1px solid rgba(255, 233, 170, 0.18);
    border-radius: 6px;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
    background: rgba(255, 233, 170, 0.03);
    font-size: 12px;
    letter-spacing: 0.3px;
    align-self: flex-start;
    margin-top: auto;
}

.space-news-item-link:hover {
    background: rgba(255, 233, 170, 0.1);
    border-color: rgba(255, 233, 170, 0.35);
    box-shadow: 0 0 15px rgba(255, 233, 170, 0.15);
    color: #ffffff;
}

/* Responsive adjustments for horizontal layout */
@media (max-width: 768px) {
    .space-news-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .space-news-item-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .space-news-item-title {
        font-size: 16px;
    }
    
    .space-news-item-excerpt {
        font-size: 14px;
    }
}

/* ─── Load more button ───────────────────────────────────────────────────────── */
.space-news-feed-load-more {
    text-align: center;
    padding: 10px 0 2px;
}

.space-news-load-more-btn {
    background: rgba(255, 233, 170, 0.05);
    border: 1px solid rgba(255, 233, 170, 0.18);
    border-radius: 14px;
    color: #ffe9aa;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(255, 233, 170, 0.08);
}

.space-news-load-more-btn:hover {
    background: rgba(255, 233, 170, 0.1);
    border-color: rgba(255, 233, 170, 0.35);
    box-shadow: 0 0 20px rgba(255, 233, 170, 0.2);
    color: #ffffff;
}

/* ─── Responsive design ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .space-news-feed-container {
        flex-direction: column;
        padding: 14px;
        gap: 14px;
    }
    
    .space-news-item {
        padding: 16px;
    }
    
    .space-news-item-title {
        font-size: 16px;
    }
    
    .space-news-item-excerpt {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .space-news-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .space-news-item-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .space-news-item-title {
        font-size: 16px;
    }
    
    .space-news-item-excerpt {
        font-size: 14px;
    }
}
@media (max-width: 768px) {
    .space-news-banner {
        height: 72px;
    }
    
    .space-news-feed-banner h2 {
        font-size: 16px;
        letter-spacing: 5px;
    }
    
    .space-news-banner-subtitle {
        font-size: 7px;
        letter-spacing: 3px;
    }
    
    .space-news-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .space-news-item-source {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .space-news-banner h2 {
        font-size: 13px;
        letter-spacing: 3px;
    }
    
    .space-news-banner-subtitle {
        font-size: 6px;
        letter-spacing: 2px;
    }
    
    .space-news-item {
        padding: 12px;
    }
    
    .space-news-item-title {
        font-size: 14px;
    }
    
    .space-news-load-more-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ─── Custom properties for banner image URL ───────────────────────────────── */
:root {
    --banner-image-url: url('https://star-astro.com/wp-content/uploads/banner.png');
}

.space-news-feed-widget[data-banner-image] {
    --banner-image-url: var(--banner-image-url-from-js);
}