/* Subscriptions Management Page Styles */
/* Note: Color variables inherited from themes.css */

.ldr-subscriptions-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
}

/* Header Section */
.ldr-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.ldr-header-content .ldr-subtitle {
    margin: 5px 0 0 0;
    color: var(--text-secondary);
}

.ldr-header-actions {
    display: flex;
    gap: 10px;
}

/* Stats Overview */
.ldr-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ldr-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ldr-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--shadow-color-rgb), 0.1);
}

.ldr-stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 5px;
}

.ldr-stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Scheduler Status Bar */
.ldr-scheduler-status-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ldr-scheduler-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.ldr-scheduler-label {
    font-weight: 500;
}

.ldr-scheduler-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ldr-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--btn-secondary-bg);
    display: inline-block;
}

.ldr-status-indicator.active {
    background: var(--success-color);
    box-shadow: 0 0 8px rgba(var(--success-color-rgb), 0.6);
}

.ldr-status-indicator.ldr-inactive {
    background: var(--error-color);
}

.ldr-status-indicator.ldr-checking {
    background: var(--warning-color);
    animation: pulse 1.5s infinite;
}

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

.ldr-scheduler-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 10px;
}

/* Main Container */
.ldr-subscriptions-container {
    display: flex;
    gap: 20px;
}

/* Folders Sidebar */
.ldr-folders-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
}

.ldr-folders-sidebar h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.ldr-folder-list {
    margin: 0 0 15px 0;
}

.ldr-folder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 0 -15px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

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

.ldr-folder-item.active {
    background-color: rgba(var(--accent-primary-rgb), 0.1);
    color: var(--accent-primary);
}

.ldr-folder-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.ldr-folder-item.active .ldr-folder-count {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* Main Content Area */
.ldr-subscriptions-main {
    flex: 1;
}

/* Filter Bar */
.ldr-filter-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.ldr-search-box {
    flex: 1;
    position: relative;
}

.ldr-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.ldr-search-box input {
    width: 100%;
    padding: 8px 15px 8px 35px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

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

.ldr-filter-options {
    display: flex;
    gap: 10px;
}

.ldr-filter-options select {
    min-width: 150px;
}

/* Subscriptions Grid */
.ldr-subscriptions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Subscription Card */
.ldr-subscription-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.ldr-subscription-card:hover {
    box-shadow: 0 4px 12px rgba(var(--shadow-color-rgb), 0.1);
}

.ldr-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
}

.ldr-card-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ldr-card-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.ldr-btn-icon {
    background: none;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.ldr-btn-icon:hover {
    color: var(--accent-primary);
}

.ldr-btn-icon.btn-danger {
    color: var(--error-color);
}

.ldr-btn-icon.btn-danger:hover {
    color: var(--error-color);
    background-color: rgba(var(--error-color-rgb), 0.1);
    border-radius: 4px;
}

.ldr-card-body {
    padding: 15px;
}

.ldr-query-text {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-style: italic;
}

.ldr-subscription-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.ldr-status-badge,
.ldr-frequency-badge,
.ldr-folder-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.ldr-status-badge.ldr-status-active {
    background: rgba(var(--success-color-rgb), 0.2);
    color: var(--success-color);
}

.ldr-status-badge.ldr-status-paused {
    background: rgba(var(--error-color-rgb), 0.2);
    color: var(--error-color);
}

.ldr-frequency-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.ldr-folder-badge {
    background: rgba(var(--accent-tertiary-rgb), 0.2);
    color: var(--accent-tertiary);
}

.ldr-subscription-stats {
    margin: 15px 0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ldr-stat-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ldr-stat-item i {
    margin-right: 5px;
}

.ldr-source-link {
    color: var(--accent-primary);
    text-decoration: none;
}

.ldr-source-link:hover {
    text-decoration: underline;
}

.ldr-last-updated,
.ldr-next-update {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.ldr-last-updated i,
.ldr-next-update i {
    margin-right: 5px;
}

/* History Modal Styles */
.ldr-history-summary {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ldr-history-summary p {
    margin: 5px 0;
}

.ldr-history-list {
    max-height: 400px;
    overflow-y: auto;
}

.ldr-history-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

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

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

.ldr-history-item-header a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.ldr-history-item-header a:hover {
    color: var(--accent-primary);
}

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

.ldr-history-item-meta {
    display: flex;
    gap: 10px;
}

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

.ldr-topics-list {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.ldr-topic-badge {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Empty State */
.ldr-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;  /* Span all grid columns */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ldr-empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.ldr-empty-state h3 {
    margin: 0 0 10px 0;
}

/* Loading State */
.ldr-loading-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;  /* Span all grid columns */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Modal Customizations */
.modal-body .form-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 767px) {
    .ldr-subscriptions-container {
        flex-direction: column;
    }

    .ldr-folders-sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .ldr-stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .ldr-subscriptions-grid {
        grid-template-columns: 1fr;
    }

    .ldr-filter-bar {
        flex-direction: column;
    }

    .ldr-filter-options {
        width: 100%;
        flex-direction: column;
    }

    .ldr-filter-options select {
        width: 100%;
    }
}

/* Mobile-specific fixes for small phones */
@media (max-width: 767px) {
    .ldr-subscriptions-page {
        padding: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

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

    .ldr-header-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .ldr-header-actions .btn {
        width: 100%;
    }

    .ldr-header-content h1 {
        font-size: 1.5rem;
    }

    .ldr-stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ldr-stat-card {
        padding: 15px 10px;
    }

    .ldr-stat-value {
        font-size: 1.75rem;
    }

    .ldr-scheduler-status-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .ldr-scheduler-info {
        flex-wrap: wrap;
    }

    .ldr-subscriptions-container {
        flex-direction: column;
        gap: 15px;
    }

    .ldr-folders-sidebar {
        width: 100%;
        padding: 15px;
    }

    .ldr-folder-item {
        padding: 12px 15px;
        min-height: 44px;
    }

    .ldr-filter-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

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

    .ldr-search-box input {
        width: 100%;
        min-height: 44px;
    }

    .ldr-filter-options {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .ldr-filter-options select {
        width: 100%;
        min-width: unset;
        min-height: 44px;
    }

    .ldr-subscriptions-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .ldr-subscription-card {
        max-width: 100%;
    }

    .ldr-card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ldr-card-header h4 {
        white-space: normal;
        text-overflow: clip;
    }

    .ldr-card-actions {
        justify-content: flex-end;
    }

    .ldr-subscription-meta {
        flex-direction: column;
        gap: 5px;
    }

    .ldr-subscription-stats {
        flex-direction: column;
        gap: 5px;
    }

    /* Ensure no horizontal overflow */
    .ldr-subscriptions-main {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .ldr-subscriptions-page {
        padding: 8px;
    }

    .ldr-stats-overview {
        grid-template-columns: 1fr;
    }

    .ldr-stat-value {
        font-size: 1.5rem;
    }

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

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