/* Link Hub Manager — habillage moderne clair (par-dessus Bootstrap 5) */

:root {
  --accent:        #2563eb;
  --accent-600:    #1d4ed8;
  --accent-soft:   #eff4ff;
  --bg:            #f6f8fc;
  --surface:       #ffffff;
  --border:        #e6eaf2;
  --text:          #1f2733;
  --muted:         #6b7688;
  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --shadow-hover:  0 2px 6px rgba(16, 24, 40, .06), 0 14px 34px rgba(37, 99, 235, .12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- En-tête / navigation ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(16,24,40,.02);
}
.site-header .brand {
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text) !important;
  gap: .6rem;
}
.site-header .brand svg { color: var(--accent); }
.nav-pills .nav-link {
  color: var(--muted);
  font-weight: 600;
  border-radius: 999px;
  padding: .4rem .95rem;
  transition: background .15s, color .15s;
}
.nav-pills .nav-link:hover { background: var(--accent-soft); color: var(--accent-600); }
.nav-pills .nav-link.active { background: var(--accent) !important; color: #fff !important; }

/* ---- Barre de recherche ---- */
.search-bar .form-control {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: .7rem 1.1rem;
  box-shadow: var(--shadow);
}
.search-bar .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.search-bar .btn {
  border-radius: 999px;
  padding: .7rem 1.4rem;
  font-weight: 600;
}

/* ---- Titre de page ---- */
.page-title { font-weight: 800; letter-spacing: -.02em; }
.page-title .badge {
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 600;
  border-radius: 999px;
  vertical-align: middle;
}

/* ---- Boutons ---- */
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn { border-radius: var(--radius-sm); }
.btn-sm { border-radius: 7px; }

/* ---- Cartes de liens ---- */
.link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #d6e0f5;
}
/* Site dégradé (parking / inaccessible) : tuile clairement hachurée. */
.link-card-degraded {
  background-color: #faf6ef;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(150, 110, 60, 0.22) 0,
    rgba(150, 110, 60, 0.22) 6px,
    transparent 6px,
    transparent 14px
  );
  border-color: #e0c9a6;
}
.link-card-degraded .card-body { background: transparent; }
.link-card-degraded:hover { border-color: #d3b487; }
.link-card .card-body { padding: 1.1rem 1.25rem; gap: .9rem; }

.link-favicon {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
  padding: 4px;
  flex: 0 0 auto;
}

.link-title {
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--text);
  text-decoration: none;
}
.link-title:hover { color: var(--accent-600); text-decoration: underline; }
.link-url { color: var(--muted); font-size: .82rem; word-break: break-all; }
.link-final { font-size: .8rem; color: #9a6a00; word-break: break-all; }
.link-final a { color: #9a6a00; text-decoration: none; }
.link-final a:hover { text-decoration: underline; }
.link-desc { color: #515c6e; font-size: .93rem; margin-bottom: .5rem !important; }

/* ---- Descriptif détaillé (Markdown rendu) ---- */
.link-notes {
  margin: .25rem 0 .75rem;
  padding: .6rem .9rem;
  background: #fafbfe;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: #404a5c;
}
.link-notes > :first-child { margin-top: 0; }
.link-notes > :last-child { margin-bottom: 0; }
.link-notes h1, .link-notes h2, .link-notes h3, .link-notes h4 {
  font-size: 1rem; font-weight: 700; margin: .6rem 0 .3rem;
}
.link-notes ul, .link-notes ol { padding-left: 1.25rem; margin-bottom: .4rem; }
.link-notes a { color: var(--accent-600); }
.link-notes code {
  background: var(--accent-soft); color: var(--accent-600);
  padding: .05rem .35rem; border-radius: 5px; font-size: .85em;
}
.link-notes pre {
  background: #0f172a; color: #e2e8f0; padding: .7rem .9rem;
  border-radius: 8px; overflow-x: auto; font-size: .82rem;
}
.link-notes pre code { background: none; color: inherit; padding: 0; }
.link-notes blockquote {
  border-left: 3px solid var(--border); margin: .4rem 0; padding-left: .8rem; color: var(--muted);
}

/* ---- Tags ---- */
.tag-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-600) !important;
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  padding: .18rem .6rem;
  font-size: .76rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .12s;
}
.tag-badge:hover { background: #e1ebff; }

.badge-overridden {
  background: #fff7e6;
  color: #b06b00 !important;
  border: 1px solid #ffe2a8;
  border-radius: 999px;
  font-weight: 600;
}

/* ---- Catégories ---- */
.category-nav .cat-pill {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.category-nav .cat-pill:hover { border-color: var(--accent); color: var(--accent-600); }
.category-nav .cat-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.category-nav .cat-count { opacity: .6; font-weight: 400; }

/* Annuaire façon ODP / DMOZ : sous-catégories en colonnes, compte entre parenthèses,
   aperçu des sous-sous-catégories en gris. */
.odp-section-title {
  font-size: .95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .35rem;
  margin: 1.6rem 0 .9rem;
}
.odp-subcats {
  list-style: none;
  padding: 0;
  margin: 0 0 1.6rem;
  column-width: 240px;
  column-gap: 2.2rem;
}
.odp-subcat { break-inside: avoid; margin-bottom: .75rem; }
.odp-subcat-link { font-weight: 700; color: var(--accent-600); text-decoration: none; }
.odp-subcat-link:hover { text-decoration: underline; }
.odp-subcat-count { color: var(--muted); font-size: .85rem; margin-left: .2rem; font-weight: 400; }
.odp-subcat-kids { font-size: .82rem; color: var(--muted); line-height: 1.45; margin-top: .12rem; }
.odp-subcat-kids a { color: var(--muted); text-decoration: none; }
.odp-subcat-kids a:hover { color: var(--accent-600); text-decoration: underline; }

/* Derniers articles RSS agrégés d'une catégorie. */
.odp-articles { list-style: none; padding: 0; margin: 0 0 1.6rem; column-width: 360px; column-gap: 2.2rem; }
.odp-article { break-inside: avoid; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.odp-article-title { font-weight: 600; color: var(--text); text-decoration: none; }
.odp-article-title:hover { color: var(--accent-600); text-decoration: underline; }
.odp-article-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.odp-article-meta a { color: var(--muted); text-decoration: none; }
.odp-article-meta a:hover { color: var(--accent-600); text-decoration: underline; }
.odp-article-date { font-variant-numeric: tabular-nums; }

/* Étoile « favori » sur les cartes de l'annuaire. */
.fav-star { color: #f5b50a; font-size: 1rem; line-height: 1; }

/* Accueil annuaire façon ODP : icône + classe en gras + sous-catégories en ligne. */
.odp-home-cat { display: flex; align-items: flex-start; gap: .65rem; }
.odp-home-icon { font-size: 1.6rem; line-height: 1.1; flex: none; }
.odp-home-title {
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--accent-600);
  text-decoration: underline;
}
.odp-home-title:hover { color: var(--accent); }
.odp-home-subs { margin-top: .15rem; font-size: .92rem; line-height: 1.5; }
.odp-home-subs a { color: var(--accent-600); text-decoration: underline; }
.odp-home-subs a:hover { color: var(--accent); }
.odp-home-more { font-weight: 700; text-decoration: none !important; }

/* Fil d'Ariane des catégories sur la fiche d'un lien : on expose toute la
   hiérarchie (parent › sous-catégorie) au lieu de masquer le chemin en infobulle. */
.cat-trails { margin: 0; }
.cat-trail { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.cat-trail + .cat-trail { margin-top: .45rem; padding-top: .45rem; border-top: 1px dashed var(--border); }
.cat-trail-sep { color: var(--muted); font-weight: 700; line-height: 1; }
.cat-trail-seg {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.cat-trail-seg:hover { border-color: var(--accent); color: var(--accent-600); }
.cat-trail-seg.is-leaf { background: var(--accent); border-color: var(--accent); color: #fff; }

.category-heading {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 1.1rem 0 .4rem;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--accent-soft);
}
.category-heading a { color: var(--text); text-decoration: none; }
.category-heading a:hover { color: var(--accent-600); }
.category-heading.category-none { color: var(--muted); font-weight: 700; border-bottom-color: var(--border); }

/* ---- Page éditoriale : cartes de thèmes ---- */
.theme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #d6e0f5; }
.theme-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .4rem; }
.theme-icon { font-size: 1.5rem; line-height: 1; }
.theme-title { font-weight: 700; font-size: 1.06rem; color: var(--text); text-decoration: none; }
.theme-title:hover { color: var(--accent-600); }
.theme-head .badge { margin-left: auto; background: var(--accent-soft); color: var(--accent-600); border-radius: 999px; font-weight: 600; }
.theme-desc { color: var(--muted); font-size: .88rem; margin-bottom: .6rem; }
.theme-samples { list-style: none; padding: 0; margin: 0 0 .7rem; }
.theme-samples li {
  font-size: .84rem; color: #515c6e; padding: .2rem 0;
  border-bottom: 1px dashed var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-samples li:last-child { border-bottom: none; }
.theme-more { margin-top: auto; font-weight: 600; font-size: .85rem; color: var(--accent-600); text-decoration: none; }
.theme-more:hover { text-decoration: underline; }

/* ---- Pagination ---- */
.pagination .page-link {
  color: var(--accent-600);
  border-radius: 8px;
  margin: 0 2px;
  border-color: var(--border);
}
.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---- Accueil (hero) ---- */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, var(--accent-soft) 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero h1 { font-weight: 800; letter-spacing: -.03em; }
.hero .lead { color: var(--muted); }

/* ---- Formulaires (add/edit) ---- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
}
.form-control, .form-control:focus { border-radius: var(--radius-sm); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }

/* ---- Sections d'édition (auto vs manuel) ---- */
fieldset.edit-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 1.2rem;
  background: #fcfdff;
}
fieldset.edit-section > legend {
  float: none; width: auto; padding: 0 .5rem; margin-bottom: 0;
  font-size: 1.02rem; font-weight: 700; color: var(--text);
}
.edit-collapse { border: 1px solid var(--border); border-radius: var(--radius); background: #fcfdff; }
.edit-collapse > summary {
  font-weight: 700; font-size: 1.02rem; padding: .9rem 1.2rem; cursor: pointer;
  list-style: none; color: var(--text);
}
.edit-collapse > summary::-webkit-details-marker { display: none; }
.edit-collapse > summary::before { content: '▸ '; color: var(--accent); }
.edit-collapse[open] > summary::before { content: '▾ '; }
.edit-collapse .edit-section-body { padding: 0 1.2rem 1.2rem; }

/* ---- Widget de catégories : recherche + chips (link-edit) ---- */
.cat-widget { display: flex; flex-direction: column; gap: .6rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-empty { color: var(--muted, #6b7280); font-size: .9rem; font-style: italic; }
.cat-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--accent-soft, #eff4ff); color: var(--accent, #2563eb);
  border: 1px solid var(--accent, #2563eb); border-radius: 999px;
  padding: .2rem .35rem .2rem .7rem; font-size: .88rem; line-height: 1.3;
}
.cat-chip-label { white-space: nowrap; }
.cat-chip-x {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: .85rem; line-height: 1; padding: .15rem .3rem; border-radius: 999px;
}
.cat-chip-x:hover { background: var(--accent, #2563eb); color: #fff; }

.cat-search-wrap { position: relative; }
.cat-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px);
  margin: 0; padding: .25rem; list-style: none; max-height: 17rem; overflow-y: auto;
  background: #fff; border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius-sm, 8px); box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.cat-result {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem;
  padding: .4rem .6rem; border-radius: var(--radius-sm, 8px); cursor: pointer;
}
.cat-result:hover, .cat-result.active { background: var(--accent-soft, #eff4ff); }
.cat-result-path { color: var(--muted, #6b7280); font-size: .82rem; }
.cat-result-name { font-weight: 600; color: var(--text, #111827); }
.cat-noresult { color: var(--muted, #6b7280); font-style: italic; cursor: default; }
.cat-noresult:hover { background: transparent; }

/* ---- Carte « j'aime » (link-detail) ---- */
.like-card { cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.like-card:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.like-card.liked { border-color: #16a34a; background: #f0fdf4; }
.like-card:active { transform: translateY(0); }
.important-card { cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.important-card:hover { border-color: #f59e0b; background: #fffbeb; transform: translateY(-1px); }
.important-card.important-on { border-color: #f59e0b; background: #fffbeb; }
.important-card:active { transform: translateY(0); }

/* ---- Utilitaires ---- */
.min-w-0 { min-width: 0; }

/* ---- Footer ---- */
footer.site-footer { color: var(--muted); }
footer.site-footer a { color: var(--muted); }
footer.site-footer a:hover { color: var(--accent-600); }

/* ---- Bouton « Écouter » des épisodes (lecteur global) ---- */
.ep-play.is-current { background: var(--accent-600); border-color: var(--accent-600); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
/* Épisode déjà écouté : bouton en retrait, action « Réécouter ». */
.ep-play.is-read { background: transparent; color: var(--muted); border-color: var(--border); opacity: .85; }
.ep-play.is-read:hover { color: var(--accent-600); border-color: var(--accent-600); opacity: 1; }
.ep-play-icon { font-size: .8em; line-height: 1; }
.ep-progress { white-space: nowrap; }
.ep-progress.is-read { color: #16a34a; font-weight: 600; }

/* Voile discret pendant un chargement PJAX. */
#app-main.pjax-loading { opacity: .55; transition: opacity .12s ease; pointer-events: none; }

/* ---- Barre de lecteur audio global (fixée en bas, persiste entre les pages) ---- */
body.has-gplayer { padding-bottom: 84px; }
.gplayer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(16, 24, 40, .10);
}
.gplayer[hidden] { display: none; }
.gplayer-inner {
  max-width: 1100px; margin: 0 auto; padding: .5rem .9rem;
  display: flex; align-items: center; gap: .75rem;
}
.gplayer-art { width: 46px; height: 46px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.gplayer-meta { min-width: 0; flex: 1 1 180px; display: flex; flex-direction: column; line-height: 1.2; }
.gplayer-title {
  font-weight: 600; color: var(--text); text-decoration: none; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gplayer-title:hover { color: var(--accent-600); text-decoration: underline; }
.gplayer-feed {
  color: var(--muted); font-size: .76rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gplayer-controls { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.gplayer-btn {
  border: none; background: transparent; color: var(--text); cursor: pointer;
  border-radius: 50%; width: 38px; height: 38px; font-size: 1rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.gplayer-btn small { font-size: .58em; font-weight: 700; }
.gplayer-btn:hover { background: var(--accent-soft); color: var(--accent-600); }
.gplayer-toggle { background: var(--accent); color: #fff; width: 44px; height: 44px; font-size: 1.05rem; }
.gplayer-toggle:hover { background: var(--accent-600); color: #fff; }
.gplayer-seek { flex: 2 1 220px; display: flex; align-items: center; gap: .5rem; min-width: 0; }
.gplayer-time { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.gplayer-range { flex: 1 1 auto; min-width: 60px; accent-color: var(--accent); cursor: pointer; }
.gplayer-rate { width: auto; padding: 0 .55rem; font-size: .82rem; font-weight: 600; border: 1px solid var(--border); }
.gplayer-close { font-size: .9rem; color: var(--muted); }

@media (max-width: 640px) {
  .gplayer-inner { flex-wrap: wrap; gap: .4rem .6rem; padding: .45rem .6rem; }
  .gplayer-meta { flex: 1 1 100%; order: 1; }
  .gplayer-controls { order: 2; }
  .gplayer-seek { order: 3; flex: 1 1 100%; }
  .gplayer-rate, .gplayer-close { order: 2; }
  .gplayer-art { width: 38px; height: 38px; }
  body.has-gplayer { padding-bottom: 132px; }
}

/* ---- Abonnements aux flux ---- */
.feed-follow { white-space: nowrap; }
.feed-follow .ff-icon { font-size: .9em; line-height: 1; }
/* Puce d'un flux suivi (page « Mes abonnements »). */
.followed-chip {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: .25rem .35rem .25rem .7rem;
  max-width: 100%;
}
.followed-chip > a { color: inherit; min-width: 0; }
.followed-chip > a span:last-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem;
}
.followed-chip .feed-follow { border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; }
/* Timeline agrégée des items. */
.ab-timeline .ab-item { border-bottom: 1px solid var(--border, #e2e8f0); }
.ab-timeline .ab-item:last-child { border-bottom: 0; }
.ab-timeline .link-title { font-weight: 600; }
