/* News Page Styles - Following LDR Design System */
/* Note: Color variables inherited from themes.css */

/* Alert Container */
.ldr-settings-alert-container {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

/* Page wrapper */
.ldr-news-page-wrapper {
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* Override Bootstrap white backgrounds */
.modal-content {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.ldr-dropdown-menu {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.ldr-dropdown-item {
    color: var(--text-primary) !important;
}

.ldr-dropdown-item:hover {
    background-color: var(--bg-tertiary) !important;
}

.ldr-form-control, .form-select {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.ldr-form-control:focus, .form-select:focus {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--accent-primary) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--accent-primary-rgb), 0.25) !important;
}

/* Layout - Two column without left sidebar */
.ldr-news-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    height: calc(100vh - 140px);
    margin-top: 1rem;
    width: calc(100% - 2rem);
    max-width: calc(100vw - 2rem);
    box-sizing: border-box;
    margin-left: 1rem;
    margin-right: 1rem;
}

@media (max-width: 1400px) {
    .ldr-news-container {
        grid-template-columns: 1fr 280px;
        gap: 1rem;
    }
}

@media (max-width: 1200px) {
    .ldr-news-container {
        grid-template-columns: 1fr;
    }

    .ldr-subscriptions-card {
        display: none;
    }
}

/* Mobile-specific styles for small phones */
@media (max-width: 767px) {
    .ldr-news-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        height: auto;
        min-height: calc(100vh - 180px);
        margin: 0.5rem;
        width: calc(100% - 1rem);
        max-width: calc(100vw - 1rem);
    }

    /* Grid items default to ``min-width: auto`` which is the child's
       intrinsic min-content width — a single ``white-space: nowrap``
       descendant (e.g. a filter pill with long text) is enough to push
       the column past its 1fr allocation and the whole feed past the
       viewport. ``min-width: 0`` lets the column actually obey 1fr. */
    .ldr-news-feed,
    .ldr-feed-header-section,
    .ldr-filters-bar,
    .ldr-news-cards-container {
        min-width: 0;
        max-width: 100%;
    }

    .ldr-news-page-wrapper {
        padding: 0;
    }

    /* Feed header section */
    .ldr-feed-header-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .ldr-feed-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .ldr-feed-header h1 {
        font-size: 1.25rem;
    }

    /* Search container */
    .ldr-news-search-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .ldr-news-search-box {
        width: 100%;
    }

    /* Filters bar */
    .ldr-filters-bar {
        padding: 0.75rem;
    }

    .ldr-filter-section {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .ldr-subscriptions-horizontal {
        max-width: 100%;
    }

    .ldr-time-filter-group,
    .ldr-impact-filter-group {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .ldr-filter-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 44px;
    }

    /* News items */
    .ldr-news-item {
        padding: 1.25rem;
        min-height: auto;
    }

    .ldr-news-card {
        padding: 1.25rem;
        min-height: auto;
    }

    .ldr-news-headline,
    .ldr-news-title {
        font-size: 1.2rem;
        line-height: 1.4;
    }

    .ldr-news-findings {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .ldr-news-summary {
        font-size: 0.9rem;
    }

    .ldr-news-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    .ldr-news-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .ldr-vote-buttons {
        width: 100%;
        justify-content: center;
    }

    .ldr-action-buttons {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Topic tags */
    .ldr-topic-tags {
        gap: 0.375rem;
    }

    .ldr-topic-tag {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }

    /* Quick actions */
    .ldr-quick-actions-row {
        flex-direction: column;
    }

    .ldr-quick-actions-row .btn {
        width: 100%;
        min-width: unset;
    }

    /* Sources list */
    .ldr-sources-list {
        flex-direction: column;
    }

    .ldr-source-link {
        max-width: 100%;
    }

    /* Integrated search */
    .ldr-integrated-search-section {
        padding: 1rem;
    }

    .ldr-search-controls {
        flex-wrap: wrap;
    }
}

/* Extra small phones (360px and below) */
@media (max-width: 380px) {
    .ldr-news-container {
        margin: 0.25rem;
        width: calc(100% - 0.5rem);
    }

    .ldr-news-headline,
    .ldr-news-title {
        font-size: 1.1rem;
    }

    .ldr-news-item,
    .ldr-news-card {
        padding: 1rem;
    }

    .ldr-filter-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Integrated Search Section */
.ldr-integrated-search-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.ldr-search-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem;
    transition: all 0.3s ease;
}

.ldr-search-input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

.ldr-search-icon {
    padding: 0 0.75rem;
    color: var(--text-secondary);
}

.ldr-search-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 0.5rem 0;
    color: var(--text-primary);
}

.ldr-search-input:focus {
    outline: 2px solid transparent;
}

.ldr-search-controls {
    display: flex;
    gap: 0.25rem;
    padding-right: 0.25rem;
}

/* Removed search-type-select styles as dropdown was removed */

.ldr-quick-actions-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ldr-quick-actions-row .btn {
    min-width: 140px;
    font-size: 0.9rem;
}

/* Query Template */
.ldr-query-template {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.ldr-template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ldr-template-header h3 {
    font-size: 0.9rem;
    margin: 0;
}

.ldr-template-content {
    font-size: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 4px;
}

.ldr-template-actions {
    display: flex;
    gap: 0.5rem;
}

/* View Options */
.ldr-view-options {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.ldr-view-options h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.ldr-option-group {
    margin-bottom: 1rem;
}

.ldr-option-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.ldr-toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.ldr-toggle-switch input {
    display: none;
}

.ldr-toggle-slider {
    width: 40px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    position: relative;
    transition: background 0.3s;
    margin-right: 0.5rem;
}

.ldr-toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.ldr-toggle-switch input:checked + .ldr-toggle-slider {
    background: var(--accent-primary);
}

.ldr-toggle-switch input:checked + .ldr-toggle-slider::after {
    transform: translateX(20px);
    background: var(--text-primary);
}

/* Feed Section */
.ldr-news-feed-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    overflow: hidden;
}

.ldr-feed-header-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.ldr-feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ldr-feed-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Search Container */
.ldr-news-search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ldr-news-search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.ldr-news-search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

.ldr-news-search-box .ldr-search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.ldr-news-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.ldr-news-search-box input:focus {
    outline: 2px solid transparent;
}

.ldr-news-search-box input::placeholder {
    color: var(--text-muted);
}

#search-btn {
    background: var(--accent-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0 8px 8px 0;
    font-weight: 500;
    transition: all 0.3s ease;
}

#search-btn:hover {
    background: var(--accent-secondary);
}

.ldr-feed-controls {
    display: flex;
    gap: 0.5rem;
}

/* Horizontal Filters Bar */
.ldr-filters-bar {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ldr-filter-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ldr-subscriptions-section {
    flex: 1;
}

/* Horizontal subscriptions */
.ldr-subscriptions-horizontal {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.25rem 0;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-secondary);
}

.ldr-subscriptions-horizontal::-webkit-scrollbar {
    height: 6px;
}

.ldr-subscriptions-horizontal::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.ldr-subscriptions-horizontal::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

.ldr-subscriptions-horizontal .ldr-subscription-item {
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.ldr-subscriptions-horizontal .ldr-subscription-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.ldr-subscriptions-horizontal .ldr-subscription-item.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Time and impact filters inline */
.ldr-time-filter-group,
.ldr-impact-filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ldr-filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: fit-content;
}

.ldr-filter-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.ldr-filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.ldr-impact-slider {
    width: 120px;
}

/* Query template integrated */
.ldr-query-template-integrated {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    animation: slideDown 0.3s ease-out;
}

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

/* Priority Alert */
.ldr-priority-alert {
    padding: 1rem;
    background: var(--warning-color);
    color: #000;  /* Black text on warning background */
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* News Items */
.ldr-news-items-card {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ldr-news-items-card .ldr-card-content {
    flex: 1;
    overflow-y: auto;
}

.ldr-news-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Active research card */
.ldr-active-research-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(var(--accent-primary-rgb), 0.1) 100%);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.2);
    position: relative;
    overflow: hidden;
}

.ldr-active-research-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-primary) 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.ldr-active-research-card .ldr-progress {
    margin: 1rem 0;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.ldr-active-research-card .ldr-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.5s ease;
}

.ldr-spinning {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* News Card */
.ldr-news-item {
    padding: 2.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
    min-height: 350px;
}

/* Read/Unread states */
.ldr-news-item.ldr-is-unread {
    border-left: 4px solid var(--accent-primary);
}

.ldr-news-item.ldr-is-read {
    opacity: 0.85;
}

.ldr-news-item.ldr-is-read .ldr-news-headline {
    color: var(--text-secondary);
}

/* News item header */
.ldr-news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.ldr-news-actions-menu {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.ldr-news-actions-menu .dropdown {
    position: relative;
}

.ldr-news-actions-menu .ldr-dropdown-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(var(--shadow-color-rgb), 0.3);
    min-width: 180px;
}

.ldr-news-actions-menu .ldr-dropdown-item {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.ldr-news-actions-menu .ldr-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ldr-news-actions-menu .ldr-dropdown-item i {
    width: 1.2rem;
    text-align: center;
}

.ldr-news-actions-menu .dropdown-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
}

.ldr-btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.ldr-btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Saved items indicator */
.ldr-save-btn i.ldr-bi-bookmark-fill {
    color: var(--warning-color);
}

.ldr-subscription-item .ldr-subscription-type {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.ldr-expand-icon {
    transition: transform 0.3s;
}

.ldr-news-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--glow-effect);
    transform: translateY(-2px);
}

/* New item styling */
.ldr-news-item.ldr-is-new {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(var(--accent-primary-rgb), 0.05) 100%);
    border-color: rgba(var(--accent-primary-rgb), 0.3);
    position: relative;
    overflow: hidden;
}

.ldr-news-item.ldr-is-new::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-primary), rgba(var(--accent-primary-rgb), 0.3));
    animation: newItemPulse 2s ease-in-out infinite;
}

.ldr-news-item.ldr-is-new .ldr-new-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ldr-news-item.ldr-is-new .ldr-new-indicator::before {
    content: '•';
    font-size: 1.2rem;
    animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes newItemPulse {
    0%, 100% {
        opacity: 1;
        transform: scaleY(1);
    }
    50% {
        opacity: 0.7;
        transform: scaleY(0.98);
    }
}

@keyframes pulseDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Subtle animation when new items appear */
.ldr-news-item.ldr-fade-in-new {
    animation: fadeInNew 0.6s ease-out forwards;
}

@keyframes fadeInNew {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ldr-news-item.ldr-priority-high {
    border-left: 4px solid var(--error-color);
}

.ldr-news-item.ldr-priority-medium {
    border-left: 4px solid var(--warning-color);
}

.ldr-news-item.ldr-priority-low {
    border-left: 4px solid var(--success-color);
}

.ldr-news-headline {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.ldr-news-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* News content styles */
.ldr-news-findings {
    color: var(--text-primary);
    line-height: 1.8;
    margin: 1.5rem 0;
    /* Removed max-height and overflow as items are always expanded */
    position: relative;
    font-size: 1.1rem;
    transition: max-height 0.5s ease;
}

/* News card styles for JavaScript-generated content */
.ldr-news-card {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    position: relative;
    min-height: 450px;
}

.ldr-news-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.ldr-news-summary {
    color: var(--text-primary);
    line-height: 1.7;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.ldr-news-summary p {
    color: var(--text-primary);
    margin: 0;
}

/* Ensure proper text color inheritance */
#news-container,
#news-feed-content {
    color: var(--text-primary);
}

.ldr-news-card * {
    color: inherit;
}

/* Expand/Collapse button - Commented out as news items are now always expanded */
/*
.ldr-expand-toggle-btn {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
    z-index: 10;
}

.ldr-expand-toggle-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.ldr-expand-toggle-btn i {
    transition: transform 0.3s;
}

.ldr-news-item.ldr-is-expanded .ldr-expand-toggle-btn i,
.ldr-news-card.ldr-is-expanded .ldr-expand-toggle-btn i {
    transform: rotate(180deg);
}
*/

/* Expanded state styles */
.ldr-news-item.ldr-is-expanded,
.ldr-news-card.ldr-is-expanded {
    min-height: auto;
}

.ldr-news-item.ldr-is-expanded .ldr-news-findings,
.ldr-news-card.ldr-is-expanded .ldr-news-findings,
.ldr-news-item.ldr-is-expanded .ldr-news-summary,
.ldr-news-card.ldr-is-expanded .ldr-news-summary {
    max-height: none;
    overflow: visible;
}

.ldr-news-item.ldr-is-expanded .ldr-news-findings::after,
.ldr-news-card.ldr-is-expanded .ldr-news-findings::after,
.ldr-news-item.ldr-is-expanded .ldr-news-summary::after,
.ldr-news-card.ldr-is-expanded .ldr-news-summary::after {
    display: none;
}

.ldr-news-header h2 {
    color: var(--text-primary);
}

.ldr-news-actions {
    color: var(--text-primary);
}

/* Subscription Management Styles */
.ldr-subscription-stats {
    margin-bottom: 2rem;
}

.ldr-stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.ldr-stat-card:hover {
    transform: translateY(-2px);
}

.ldr-stat-card h3 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.ldr-stat-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ldr-subscriptions-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.ldr-subscription-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.ldr-subscription-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.1);
}

.ldr-subscription-actions {
    display: flex;
    gap: 0.5rem;
}

.ldr-subscription-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

#folderTabs .ldr-nav-link {
    color: var(--text-secondary);
    border: 1px solid transparent;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
}

#folderTabs .ldr-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

#folderTabs .ldr-nav-link.active {
    color: var(--accent-primary);
    background: var(--bg-secondary);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-secondary);
}

#folderTabs .badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
}

/* Fade-out effect - commented out as items are always expanded */
/*
.ldr-news-findings::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--bg-tertiary));
    pointer-events: none;
    transition: opacity 0.3s;
}
*/

/* Expanded state */
.ldr-news-item.ldr-is-expanded .ldr-news-findings {
    max-height: none;
}

.ldr-news-item.ldr-is-expanded .ldr-news-findings::after {
    opacity: 0;
}

.ldr-news-findings p {
    margin: 0.5rem 0;
}

.ldr-news-findings ul, .ldr-news-findings ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.ldr-news-findings strong {
    font-weight: 600;
    color: var(--text-primary);
}

.ldr-news-summary {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 1.25rem 0;
    font-size: 1.05rem;
    /* Removed max-height and overflow as items are always expanded */
    position: relative;
}

/* Fade-out effect - commented out as items are always expanded */
/*
.ldr-news-summary::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-tertiary));
    pointer-events: none;
}
*/

.ldr-news-category {
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-weight: 500;
}

.ldr-impact-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ldr-impact-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.ldr-impact-fill {
    height: 100%;
    background: linear-gradient(to right, var(--success-color), var(--warning-color), var(--error-color));
}

.ldr-news-summary {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.ldr-news-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.ldr-vote-buttons {
    display: flex;
    gap: 0.5rem;
}

.ldr-vote-btn {
    padding: 0.4rem 1rem;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary) !important;  /* Changed from text-secondary for better contrast */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
}

.ldr-vote-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ldr-vote-btn.ldr-voted {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.ldr-action-buttons {
    display: flex;
    gap: 0.5rem;
}

.ldr-action-buttons .btn,
.ldr-action-buttons a,
.ldr-action-buttons button {
    position: relative;
    z-index: 2;
}

/* Search History */
.ldr-recent-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.ldr-recent-search-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.ldr-recent-search-item i:first-child {
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.ldr-recent-search-item i:last-child {
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.2s;
}

.ldr-recent-search-item:hover i:last-child {
    opacity: 1;
}

.ldr-recent-search-item .ldr-search-query {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ldr-recent-search-item .ldr-search-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Table View */
.ldr-news-table-container {
    overflow-x: auto;
}

.ldr-news-table {
    width: 100%;
    border-collapse: collapse;
}

.ldr-news-table th {
    background: var(--bg-tertiary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ldr-news-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: top;
}

.ldr-news-table tr:hover td {
    background: var(--bg-tertiary);
}

.ldr-impact-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.ldr-impact-high {
    background: var(--error-color);
    color: white;
}

.ldr-impact-medium {
    background: var(--warning-color);
    color: #000;  /* Black text on warning background */
}

.ldr-impact-low {
    background: var(--success-color);
    color: white;
}

/* Subscriptions */
.ldr-subscriptions-card {
    height: fit-content;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.ldr-subscriptions-list {
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.ldr-subscription-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.ldr-subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ldr-subscription-item:hover {
    border-color: var(--accent-primary);
}

.ldr-subscription-item.active {
    background: var(--accent-primary);
    color: white;
}

.ldr-subscription-type {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
}

.ldr-subscription-query {
    font-weight: 500;
    margin: 0.25rem 0;
}

.ldr-subscription-meta {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* News Topics */
.ldr-news-topics {
    margin: 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Filter chips */
.ldr-filter-group {
    margin-bottom: 1.5rem;
}

.ldr-filter-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.ldr-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ldr-filter-chip {
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.ldr-filter-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.ldr-filter-chip.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Filter status bar */
.ldr-filter-status-bar {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.ldr-active-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ldr-active-filters > span:first-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.ldr-filter-badge {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-primary);
    border: 1px solid var(--accent-primary);
}

.ldr-filter-status-bar .btn-link {
    margin-left: auto;
    color: var(--accent-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
}

.ldr-filter-status-bar .btn-link:hover {
    color: var(--accent-secondary);
}

/* Bulk actions bar */
.ldr-bulk-actions-bar {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.ldr-bulk-actions-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.ldr-news-stats {
    display: flex;
    gap: 1.5rem;
}

.ldr-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ldr-stat-item i {
    color: var(--accent-primary);
}

.ldr-bulk-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ldr-bulk-actions .btn {
    font-size: 0.85rem;
}

/* Auto-refresh indicator */
.text-warning {
    color: var(--warning-color) !important;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.form-check-label[for="auto-refresh"] {
    font-size: 0.9rem;
    transition: color 0.3s;
}

/* Refresh button animation */
button[onclick="refreshFeed()"] i {
    transition: transform 0.3s, color 0.3s;
}

button[onclick="refreshFeed()"]:hover i {
    transform: rotate(180deg);
}

/* Trending Topics */
.ldr-trending-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.ldr-trending-section h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

#trending-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#trending-topics .ldr-topic-tag {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
}

.ldr-topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ldr-topic-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-primary) !important;  /* Ensure text color is set */
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
    display: inline-block;
}

.ldr-topic-tag:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.ldr-topic-tag.active {
    background: var(--accent-primary) !important;
    color: white !important;
    border-color: var(--accent-primary) !important;
}

/* Topic count badge */
.ldr-topic-count {
    background: rgba(var(--highlight-color-rgb), 0.2);
    color: var(--text-primary);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.3rem;
    display: inline-block;
    min-width: 1.2rem;
    text-align: center;
}

.ldr-topic-tag:hover .ldr-topic-count {
    background: rgba(var(--highlight-color-rgb), 0.3);
    color: white;
}

.ldr-topic-tag.active .ldr-topic-count {
    background: rgba(var(--highlight-color-rgb), 0.3);
    color: white;
}

/* Source links */
.ldr-news-sources {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.ldr-sources-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.ldr-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ldr-source-link {
    color: var(--accent-primary) !important;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ldr-source-link:hover {
    background: var(--accent-primary);
    color: white !important;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.ldr-source-link i {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Make the entire sources section more compact */
.ldr-news-sources {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Active filter bar */
.ldr-active-filter-bar {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.ldr-filter-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.ldr-filter-info strong {
    color: var(--accent-primary);
}

.ldr-filter-info button {
    margin-left: auto;
    color: var(--text-secondary);
    text-decoration: none;
}

.ldr-filter-info button:hover {
    color: var(--accent-primary);
}

/* News-specific button styles */
.ldr-news-item .btn-primary {
    padding: 0.5rem 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.ldr-news-item .btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

/* Button Extensions */
.ldr-btn-full {
    width: 100%;
}

.ldr-btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.ldr-btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Loading States */
.ldr-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.ldr-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Subscription History Modal */
.ldr-subscription-stats {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    flex-wrap: wrap;
}

.ldr-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.ldr-stat-item i {
    color: var(--accent-primary);
}

.ldr-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.ldr-history-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.ldr-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ldr-history-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ldr-history-status.ldr-status-completed {
    background: var(--success-color);
    color: white;
}

.ldr-history-status.ldr-status-in_progress {
    background: var(--warning-color);
    color: #000;
}

.ldr-history-status.ldr-status-failed,
.ldr-history-status.ldr-status-error {
    background: var(--error-color);
    color: white;
}

.ldr-history-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ldr-history-query {
    margin: 0.5rem 0;
    font-weight: 500;
    color: var(--text-primary);
}

.ldr-history-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.ldr-history-actions .ldr-duration {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Modal overrides for dark theme */
.modal-content {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

.modal-title small {
    display: block;
    font-size: 0.85rem;
    font-weight: normal;
    margin-top: 0.25rem;
}

/* News Templates */
.ldr-news-templates {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ldr-template-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: left;
}

.ldr-template-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.ldr-template-btn i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Progress card specific styles */
.ldr-news-card.ldr-active-research-card .ldr-news-title i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.ldr-news-card.ldr-active-research-card .btn-outline-primary {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.ldr-news-card.ldr-active-research-card .btn-outline-primary:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ---- Filter Button (from news.html inline styles) ---- */
.ldr-filter-btn {
    background-color: var(--accent-tertiary);
    color: var(--bg-primary);
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.ldr-filter-btn:hover {
    filter: brightness(1.15);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
