/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f7fa; color: #1a1a2e; min-height: 100vh;
}
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 320px; background: #fff; border-right: 1px solid #e8ecf1;
  padding: 1.5rem 1.25rem; overflow-y: auto; display: flex;
  flex-direction: column; gap: 1.75rem; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; }
.sidebar-header h1 { font-size: 1.25rem; font-weight: 700; color: #6c63ff; }
.close-sidebar, .menu-toggle { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #8e99a4; padding: 0.25rem; border-radius: 6px; transition: all 0.2s; }
.close-sidebar:hover, .menu-toggle:hover { background: #f0f1f5; color: #1a1a2e; }
.main-content { flex: 1; margin-left: 320px; padding: 0; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem 2rem; background: #fff; border-bottom: 1px solid #e8ecf1; position: sticky; top: 0; z-index: 50; }
.search-box { flex: 1; max-width: 480px; position: relative; margin-left: auto; }
.search-box input { width: 100%; padding: 0.6rem 2.5rem 0.6rem 0.9rem; border: 1px solid #e0e3ea; border-radius: 8px; font-size: 0.9rem; background: #f8f9fb; transition: all 0.2s; }
.search-box input:focus { outline: none; border-color: #6c63ff; background: #fff; box-shadow: 0 0 0 3px rgba(108,99,255,0.1); }
.search-icon { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 0.9rem; }
.add-section { padding: 2rem; background: #fff; border-bottom: 1px solid #e8ecf1; }
.add-section h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #3d4450; }
#scrapeForm { display: flex; gap: 0.75rem; max-width: 640px; }
#scrapeUrl, .sidebar input[type=url] { flex: 1; padding: 0.7rem 1rem; border: 2px solid #e0e3ea; border-radius: 8px; font-size: 0.95rem; transition: all 0.2s; }
#scrapeUrl:focus, .sidebar input[type=url]:focus { outline: none; border-color: #6c63ff; box-shadow: 0 0 0 3px rgba(108,99,255,0.1); }
button { padding: 0.7rem 1.4rem; background: #6c63ff; color: #fff; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
button:hover { background: #5a52e0; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,99,255,0.3); }
button:active { transform: translateY(0); }
#quickAddBtn { padding: 0.7rem; background: #6c63ff; border-radius: 8px; font-size: 1.1rem; min-width: 44px; }
.input-group { display: flex; gap: 0.5rem; }
.sidebar section h2 { font-size: 0.95rem; color: #6c7580; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.saved-sources ul, .scrape-history ul { list-style: none; }
.saved-sources li, .scrape-history li { padding: 0.6rem 0.75rem; border-radius: 8px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: #3d4450; border-bottom: 1px solid #f2f4f7; }
.saved-sources li:last-child, .scrape-history li:last-child { border-bottom: none; }
.saved-sources li:hover, .scrape-history li:hover { background: #f8f9fb; color: #6c63ff; }
.saved-sources li a, .scrape-history li a { flex: 1; text-decoration: none; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.saved-sources li a:hover, .scrape-history li a:hover { color: #6c63ff; }
.remove-btn { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.5; padding: 2px 4px; border-radius: 4px; transition: all 0.15s; }
.remove-btn:hover { opacity: 1; background: #fee; color: #e74c3c; }
.empty-hint { font-size: 0.85rem; color: #a0aab4; text-align: center; padding: 1rem 0; }
#resultsArea { padding: 2rem; display: flex; flex-direction: column; gap: 2rem; max-width: 1200px; margin: 0 auto; }
.result-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; transition: all 0.3s; }
.result-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.1); transform: translateY(-2px); }
.result-header { padding: 1.5rem 1.75rem 0; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.result-source-icon { width: 36px; height: 36px; border-radius: 8px; background: #f0f1ff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; overflow: hidden; flex-shrink: 0; }
.result-source-icon img { width: 100%; height: 100%; object-fit: cover; }
.result-title-wrap { flex: 1; min-width: 0; }
.result-site-name { font-size: 0.8rem; color: #6c63ff; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.result-feed-title { font-size: 1.25rem; font-weight: 700; margin-top: 0.2rem; line-height: 1.3; }
.result-feed-title a { color: inherit; text-decoration: none; }
.result-feed-title a:hover { color: #6c63ff; }
.result-type-badge { padding: 0.25rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.result-type-badge.rss { background: #e8f5e9; color: #2e7d32; }
.result-type-badge.website { background: #e3f2fd; color: #1565c0; }
.result-description { padding: 0.75rem 1.75rem 0; font-size: 0.9rem; color: #6b7a8d; line-height: 1.6; }
.result-images { display: flex; gap: 0.75rem; padding: 1rem 1.75rem; overflow-x: auto; scroll-snap-type: x mandatory; }
.result-images img { height: 140px; width: auto; border-radius: 8px; object-fit: cover; flex-shrink: 0; scroll-snap-align: start; transition: transform 0.2s; cursor: pointer; }
.result-images img:hover { transform: scale(1.03); }
.result-content { padding: 1rem 1.75rem 1.5rem; font-size: 0.9rem; color: #4a5568; line-height: 1.7; max-height: 200px; overflow-y: auto; border-top: 1px solid #f0f1f5; }
.result-content h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.headline-list { list-style: none; padding: 0 1.75rem 1.5rem; }
.headline-list li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid #f2f4f7; font-size: 0.9rem; line-height: 1.4; }
.headline-list li:last-child { border-bottom: none; }
.headline-number { color: #6c63ff; font-weight: 700; flex-shrink: 0; width: 20px; text-align: right; font-size: 0.8rem; }
.headline-list a { color: #1a1a2e; text-decoration: none; transition: color 0.2s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; display: block; }
.headline-list a:hover { color: #6c63ff; }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 4rem; gap: 1rem; font-size: 0.95rem; color: #8e99a4; }
.spinner { width: 24px; height: 24px; border: 3px solid #e0e3ea; border-top-color: #6c63ff; border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { background: #fff5f5; color: #c53030; padding: 1rem 1.25rem; border-radius: 8px; border: 1px solid #fed7d7; font-size: 0.9rem; }
.success-msg { background: #f0fff4; color: #276749; padding: 1rem 1.25rem; border-radius: 8px; border: 1px solid #c6f6d5; font-size: 0.9rem; }
.empty-state { text-align: center; padding: 4rem 2rem; color: #a0aab4; }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: #6b7a8d; margin-bottom: 0.5rem; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
@media (max-width: 768px) { .sidebar { transform: translateX(-100%); width: 300px; box-shadow: none; } .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.15); } .main-content { margin-left: 0; } #resultsArea { padding: 1rem; } }
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #d1d8e0; border-radius: 3px; } ::-webkit-scrollbar-thumb:hover { background: #b0bac5; }
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 999; display: flex; flex-direction: column-reverse; gap: 0.75rem; }
.toast { background: #1a1a2e; color: #fff; padding: 0.85rem 1.25rem; border-radius: 8px; font-size: 0.9rem; box-shadow: 0 8px 30px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; max-width: 360px; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
