/* ============================================
   Quantum News Widget - Reusable Component
   ============================================ */

/* Main Widget Container */
.quantum-news-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 140px; /* Reduced from 165px */
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.95), rgba(20, 0, 0, 0.9));
    border: 1px solid rgba(139, 0, 0, 0.6);
    border-radius: 8px;
    box-shadow:
        0 4px 12px rgba(139, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    padding: 8px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    transition: all 0.3s ease;
}

.quantum-news-widget:hover {
    border-color: rgba(139, 0, 0, 0.8);
    box-shadow:
        0 6px 16px rgba(139, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

/* Widget Header */
.quantum-news-widget .widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.4);
    position: relative;
    z-index: 2;
}

/* Widget Title */
.quantum-news-widget .widget-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: #e8f8ff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
}

.quantum-news-widget .widget-title-icon {
    font-size: 0.9rem;
    color: #8b0000;
    filter: drop-shadow(0 0 4px rgba(139, 0, 0, 0.6));
}

/* Navigation Controls */
.quantum-news-widget .news-nav-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    position: relative;
    z-index: 3;
}

/* Scroll Direction Indicator */
.quantum-news-widget .scroll-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    background: rgba(139, 0, 0, 0.3);
    border: 1px solid rgba(139, 0, 0, 0.5);
    border-radius: 50%;
    font-size: 0.7rem;
    animation: rotateIndicator 3s linear infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantum-news-widget .scroll-indicator:hover {
    background: rgba(139, 0, 0, 0.5);
    border-color: rgba(139, 0, 0, 0.8);
    transform: scale(1.1);
}

@keyframes rotateIndicator {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.quantum-news-widget .news-nav-btn {
    background: rgba(139, 0, 0, 0.3);
    border: 1px solid rgba(139, 0, 0, 0.5);
    border-radius: 4px;
    color: #e8f8ff;
    cursor: pointer;
    font-size: 0.6rem;
    padding: 3px 6px;
    transition: all 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.quantum-news-widget .news-nav-btn:hover {
    background: rgba(139, 0, 0, 0.5);
    border-color: rgba(139, 0, 0, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.4);
}

.quantum-news-widget .news-nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(139, 0, 0, 0.3);
}

.quantum-news-widget .news-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* News Ticker Container */
.quantum-news-widget .news-ticker-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 6px;
    z-index: 1;
    display: flex;
    align-items: center;
}

/* News Ticker Items */
.quantum-news-widget .news-ticker-item {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center; /* Center content vertically */
}

.quantum-news-widget .news-ticker-item.active {
    opacity: 1;
    position: relative;
}

/* News Article Link */
.quantum-news-widget .news-ticker-link {
    display: flex;
    flex-direction: row; /* Horizontal layout: image left, content right */
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    align-items: flex-start;
    width: 100%;
}

.quantum-news-widget .news-ticker-link:hover {
    transform: translateX(2px);
}

/* News Image */
.quantum-news-widget .news-ticker-image {
    width: 85px; /* Reduced to fit smaller height */
    height: 60px; /* Reduced to fit smaller height */
    min-width: 85px; /* Prevent shrinking */
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(139, 0, 0, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.quantum-news-widget .news-ticker-link:hover .news-ticker-image {
    border-color: rgba(139, 0, 0, 0.6);
    box-shadow: 0 4px 10px rgba(139, 0, 0, 0.4);
}

.quantum-news-widget .news-ticker-image.no-image {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.2), rgba(20, 0, 0, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(139, 0, 0, 0.5);
}

/* News Source Badge */
.quantum-news-widget .news-ticker-source {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.55rem;
    font-weight: 500;
    color: #8b0000;
    background: rgba(139, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    align-self: flex-start;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(139, 0, 0, 0.3);
}

/* News Content Wrapper */
.quantum-news-widget .news-ticker-content {
    flex: 1; /* Take remaining space */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* News Title */
.quantum-news-widget .news-ticker-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: calc(0.68rem + 2px); /* Increased by 2px for better readability */
    line-height: 1.38;
    font-weight: 500;
    color: #e8f8ff;
    text-align: left;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Adjusted to 4 lines for better fit */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    transition: color 0.25s ease;
}

.quantum-news-widget .news-ticker-link:hover .news-ticker-title {
    color: #5dade2;
}

/* News Metadata (Article Date) */
.quantum-news-widget .news-ticker-meta {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.5rem;
    font-weight: 400;
    color: #7ec8e3;
    text-align: left;
    opacity: 0.8;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Error State */
.quantum-news-widget .news-ticker-error {
    color: #e74c3c;
    font-size: 0.6rem;
    text-align: center;
    font-style: italic;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Update Time Footer */
.quantum-news-widget .news-updated {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.5rem;
    color: #7ec8e3;
    text-align: center;
    opacity: 0.85;
    padding-top: 4px;
    border-top: 1px solid rgba(139, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin-top: 6px;
}

.quantum-news-widget .news-separator {
    opacity: 0.5;
    color: #7ec8e3;
}

.quantum-news-widget #news-source {
    font-weight: 400;
    color: #7ec8e3;
}

.quantum-news-widget #news-update-time {
    color: #7ec8e3;
}

/* Subtle fade animation */
@keyframes newsTickerFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.quantum-news-widget .news-ticker-item {
    animation: newsTickerFade 5s ease-in-out infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quantum-news-widget {
        height: auto; /* Allow flexible height on mobile */
        min-height: 160px;
    }

    .quantum-news-widget .widget-title {
        font-size: 0.65rem;
    }

    .quantum-news-widget .news-ticker-title {
        font-size: 0.62rem;
        -webkit-line-clamp: 4;
    }

    .quantum-news-widget .news-ticker-source {
        font-size: 0.52rem;
    }

    .quantum-news-widget .news-ticker-image {
        width: 85px;
        height: 65px;
        min-width: 85px;
    }

    .quantum-news-widget .scroll-indicator {
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .quantum-news-widget {
        padding: 6px;
        height: auto;
        min-height: 150px;
    }

    .quantum-news-widget .news-ticker-container {
        padding: 4px;
    }

    .quantum-news-widget .widget-title {
        font-size: 0.6rem;
    }

    .quantum-news-widget .news-nav-btn {
        font-size: 0.55rem;
        padding: 2px 5px;
    }

    .quantum-news-widget .news-ticker-image {
        width: 75px;
        height: 60px;
        min-width: 75px;
    }

    .quantum-news-widget .news-ticker-title {
        font-size: 0.6rem;
        -webkit-line-clamp: 4;
    }

    .quantum-news-widget .scroll-indicator {
        width: 14px;
        height: 14px;
        font-size: 0.6rem;
        margin-right: 2px;
    }
}
