/*
 * Composants partagés des pages (issue #84) : en-tête de page d'administration, listes,
 * ligne fichier/dossier, badges, pagination, boutons. Les couleurs viennent des variables
 * de base.html.twig (:root) ; chaque page ne garde dans son bloc page_styles que ce qui
 * lui est propre.
 */

/* --- En-tête des pages d'administration ------------------------------------------- */
.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}
/* Sans paragraphe d'introduction, l'en-tête s'écarte du contenu qui suit. */
.admin-head:not(:has(+ .lead)) { margin-bottom: 1.2rem; }
.admin-head h1 { font-size: 1.3rem; margin: 0; word-break: break-word; }
.admin-head .count { color: var(--text-muted); font-size: 0.9rem; }
/* Élément poussé à droite de l'en-tête (lien retour, bouton d'action). */
.admin-head .head-end { margin-left: auto; }

.back { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.back:hover { text-decoration: underline; }

.lead { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.3rem; max-width: 46rem; }
.lead code {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.section-title { font-size: 0.95rem; font-weight: 700; margin: 1.6rem 0 0.7rem; }

/* --- Listes ------------------------------------------------------------------------ */
.listing {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.listing.scroll-x { overflow-x: auto; }
.empty-state { padding: 2.5rem 1.1rem; text-align: center; color: var(--text-muted); }

/* Ligne fichier/dossier (macro ui.entryRow : navigation et recherche). */
.listing-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.1rem;
    border-top: 1px solid var(--border);
}
.listing-row:first-child { border-top: none; }
.listing-row:hover { background: var(--accent-soft); }
.listing-row .icon { font-size: 1.15rem; line-height: 1; width: 1.4rem; text-align: center; }
.listing-row .name { font-weight: 500; word-break: break-word; }
.listing-row .file-link,
.listing-row .folder-link { color: inherit; text-decoration: none; }
.listing-row .file-link:hover,
.listing-row .folder-link:hover { color: var(--accent); text-decoration: underline; }
.listing-row .loc { color: var(--text-muted); font-size: 0.8rem; text-decoration: none; margin-left: 0.2rem; }
.listing-row .loc::before { content: "— "; }
.listing-row .loc:hover { color: var(--accent); text-decoration: underline; }
.listing-row .spacer { flex: 1; }
.listing-row .meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.listing-row .dl { color: var(--accent); font-size: 0.82rem; text-decoration: none; white-space: nowrap; }
.listing-row .dl:hover { text-decoration: underline; }

/* --- Badges : une palette (état neutre, accent, succès, avertissement, danger) ----- */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--neutral-soft);
    color: var(--text-muted);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* --- Boutons ----------------------------------------------------------------------- */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { filter: brightness(0.95); }
.btn-danger-outline {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover { background: var(--danger-soft); filter: none; }

/* Actions d'une ligne (liens et boutons d'apparence texte). */
.actions { display: flex; align-items: center; gap: 0.85rem; }
.actions form { display: inline; margin: 0; }
.actions a,
.actions button {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
.actions a:hover,
.actions button:hover { text-decoration: underline; }
.actions .muted { color: var(--text-muted); }
.actions .danger { color: var(--danger); }
.actions button:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }

/* --- Pagination (macro ui.pager) --------------------------------------------------- */
.pager {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.1rem;
    font-size: 0.88rem;
}
.pager a { color: var(--accent); text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager .muted { color: var(--text-muted); }

/* --- Bloc de code à copier (fond sombre) et encadré d'avertissement ---------------- */
.code-card {
    position: relative;
    background: #0f1b17;
    color: #e8efe9;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.code-card pre {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    white-space: pre;
}
.code-card .copy-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #e8efe9;
    border-radius: 7px;
    padding: 0.25rem 0.6rem;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.code-card .copy-btn:hover { background: rgba(255, 255, 255, 0.18); }

.callout-warning {
    background: var(--warning-soft);
    border: 1px solid var(--warning-border);
    color: var(--warning);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.86rem;
}
