/* ═══════════════════════════════════════════════════════
   sources.css — Sources tab, RSS feeds, Drive config
   ═══════════════════════════════════════════════════════ */

.sources-container { padding: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }
.sources-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; height: 100%; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.section-header h2 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }

.feeds-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.feed-item { display: flex; flex-direction: column; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; transition: all 0.15s; }
.feed-item:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.feed-info { flex: 1; margin-bottom: 12px; }
.feed-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.feed-url { font-size: 11px; font-family: var(--mono); color: var(--text-dim); word-break: break-all; line-height: 1.4; }
.feed-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.feed-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.feed-actions button { padding: 4px 12px; font-size: 12px; background: none; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); cursor: pointer; }
.feed-actions button:hover { background: var(--bg-hover); color: var(--text); }
.feed-actions button.btn-remove:hover { border-color: var(--red); color: var(--red); }

.drive-config { padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; }
.drive-config-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.drive-config-item:last-child { border-bottom: none; }
.drive-config-label { font-size: 13px; color: var(--text-dim); }
.drive-config-value { font-size: 13px; font-family: var(--mono); color: var(--text); }
.drive-status { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 500; }
.drive-status.active { background: rgba(40,167,69,0.1); color: var(--green); }
.drive-status.inactive { background: rgba(220,53,69,0.1); color: var(--red); }

.sources-section:has(#ingestion-history-wrap) { grid-column: 1 / -1; }
#ingestion-history-wrap { overflow-x: auto; }
#ingestion-history-table { width: 100%; }
#ingestion-history-table td { padding: 10px 12px; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 500; }
.status-badge.success { background: rgba(40,167,69,0.1); color: var(--green); }
.status-badge.pending { background: rgba(253,126,20,0.1); color: var(--orange); }
.status-badge.failed { background: rgba(220,53,69,0.1); color: var(--red); }

.history-actions { display: flex; gap: 4px; }
.history-actions button { padding: 4px 8px; font-size: 11px; background: none; border: 1px solid var(--border); border-radius: 3px; color: var(--text-dim); cursor: pointer; }
.history-actions button:hover { background: var(--bg-hover); color: var(--text); }
.history-actions button.btn-retry:hover { border-color: var(--accent); color: var(--accent); }

#add-rss-form label, #configure-drive-form label { display: block; font-size: 12px; font-weight: 500; color: var(--text-dim); margin: 16px 0 4px; }
#add-rss-form label:first-of-type, #configure-drive-form label:first-of-type { margin-top: 0; }
#add-rss-form input, #configure-drive-form input[type="text"], #configure-drive-form input[type="url"], #configure-drive-form input[type="number"] { width: 100%; padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; font-size: 14px; color: var(--text); font-family: var(--sans); }
#add-rss-form input:focus, #configure-drive-form input:focus { outline: none; border-color: var(--accent); }
#configure-drive-form label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
#configure-drive-form input[type="checkbox"] { width: auto; }

/* Responsive */
@media (max-width: 1024px) {
  .sources-container { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; padding: 16px; }
  .feeds-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .feed-item, .sources-section { padding: 14px; }
}
@media (max-width: 767px) {
  .feeds-list, .sources-container { grid-template-columns: 1fr; gap: 12px; }
  .sources-container { padding: 12px; }
  .feed-item, .sources-section { padding: 12px; }
  .feed-name { font-size: 13px; }
  .section-header h2 { font-size: 14px; }
}
