/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-tertiary); }

.btn-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn-lg { padding: 10px 20px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.form-input::placeholder { color: var(--text-faint); }

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--danger);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-body {
  padding: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2, .card-header h3 {
  font-size: 0.9375rem;
  margin: 0;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Article card ── */
.article-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.article-card:last-child { border-bottom: none; }

.article-card:hover .article-title {
  color: var(--accent);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.article-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color var(--transition);
}

.article-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-thumb {
  width: 80px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.article-card.is-read .article-title {
  color: var(--text-muted);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-blue   { background: var(--accent-subtle);  color: var(--accent); }
.badge-green  { background: var(--success-subtle); color: var(--success); }
.badge-red    { background: var(--danger-subtle);  color: var(--danger); }
.badge-yellow { background: var(--warn-subtle);    color: var(--warn); }
.badge-gray   { background: var(--bg-tertiary);    color: var(--text-muted); }

/* ── Collection card ── */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.collection-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  transition: box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow);
}

.collection-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.collection-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.collection-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.collection-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Alerts / Flash messages ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-subtle); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--danger-subtle);  color: var(--danger);  border-color: var(--danger); }
.alert-warn    { background: var(--warn-subtle);    color: var(--warn);    border-color: var(--warn); }

/* ── Feed list ── */
.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.feed-item:last-child { border-bottom: none; }

.feed-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.feed-info { flex: 1; min-width: 0; }

.feed-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-url {
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Comments ── */
.comment {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.comment-content {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.6;
}

.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.comment-action-btn {
  font-size: 0.75rem;
  color: var(--text-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}

.comment-action-btn:hover { color: var(--accent); }

.comment-replies {
  margin-top: 8px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--transition);
}

.pagination a:hover { background: var(--bg-secondary); color: var(--text); }
.pagination span.current { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pagination span.dots { border: none; cursor: default; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 320px;
  margin: 0 auto 20px;
}

/* ── Member list ── */
.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.member-item:last-child { border-bottom: none; }

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.member-info { flex: 1; }

.member-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.member-email {
  font-size: 0.8125rem;
  color: var(--text-faint);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-link {
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}

.tab-link:hover { color: var(--text); text-decoration: none; }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── Danger zone ── */
.danger-zone {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 20px;
}

.danger-zone h3 {
  color: var(--danger);
  font-size: 0.9375rem;
  margin-bottom: 8px;
}

.danger-zone p {
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* ── View tabs (Articles / Sites) ── */
.view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.view-tab:hover { color: var(--text); text-decoration: none; }
.view-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Site cards ── */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.site-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.site-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }

.site-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.site-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-title:hover { color: var(--accent); text-decoration: underline; }

.site-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.site-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.site-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ── Flairs (Reddit-style tags) ── */
.flair {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.flair--payant         { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.flair--freemium       { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.flair--gratuit        { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.flair--avec-IA        { background: #ede9fe; color: #4c1d95; border-color: #c4b5fd; }
.flair--sans-IA        { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.flair--open-source    { background: #ecfdf5; color: #064e3b; border-color: #6ee7b7; }
.flair--outil          { background: #fff7ed; color: #92400e; border-color: #fed7aa; }
.flair--ressource      { background: #f0fdf4; color: #166534; border-color: #86efac; }
.flair--inspiration    { background: #fdf4ff; color: #701a75; border-color: #e879f9; }

/* Dark mode flair overrides */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .flair--payant         { background: #44270a; color: #fcd34d; border-color: #78350f; }
  :root:not([data-theme="light"]) .flair--freemium       { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }
  :root:not([data-theme="light"]) .flair--gratuit        { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
  :root:not([data-theme="light"]) .flair--avec-IA        { background: #2e1065; color: #c4b5fd; border-color: #4c1d95; }
  :root:not([data-theme="light"]) .flair--sans-IA        { background: #1f2937; color: #d1d5db; border-color: #374151; }
  :root:not([data-theme="light"]) .flair--open-source    { background: #022c22; color: #6ee7b7; border-color: #064e3b; }
  :root:not([data-theme="light"]) .flair--inspiration    { background: #2d1b37; color: #e879f9; border-color: #701a75; }
}
:root[data-theme="dark"] .flair--payant         { background: #44270a; color: #fcd34d; border-color: #78350f; }
:root[data-theme="dark"] .flair--freemium       { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }
:root[data-theme="dark"] .flair--gratuit        { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
:root[data-theme="dark"] .flair--avec-IA        { background: #2e1065; color: #c4b5fd; border-color: #4c1d95; }
:root[data-theme="dark"] .flair--sans-IA        { background: #1f2937; color: #d1d5db; border-color: #374151; }
:root[data-theme="dark"] .flair--open-source    { background: #022c22; color: #6ee7b7; border-color: #064e3b; }
:root[data-theme="dark"] .flair--inspiration    { background: #2d1b37; color: #e879f9; border-color: #701a75; }

/* ── Tag checkboxes (add site form) ── */
.tag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-checkbox { cursor: pointer; }
.tag-checkbox input[type="checkbox"] { display: none; }
.tag-checkbox input:checked + .flair {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Feed row with delete button ── */
.sidebar-feed-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-feed-row .sidebar-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon-danger {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  display: none;
}
.sidebar-feed-row:hover .btn-icon-danger { display: block; }
.btn-icon-danger:hover { color: var(--danger); background: var(--danger-subtle); }

.feed-remove-form { display: contents; }

/* ── Danger link button ── */
.btn-link-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  opacity: 0.7;
  transition: opacity var(--transition);
}
.btn-link-danger:hover { opacity: 1; }

/* ── Utility ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.overflow-x-auto { overflow-x: auto; }
