/* =================================================================
   Styles des pages "sous-catégorie" et du tableau CRUD
   (chargé en plus de style.css)
   ================================================================= */

.subpage {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.4rem 2.4rem 4.5rem;
    /* --accent défini par la classe de catégorie ci-dessous */
    --accent: var(--c-materiel);
}
.subpage--materiel    { --accent: var(--c-materiel); }
.subpage--metiers     { --accent: var(--c-metiers); }
.subpage--licence     { --accent: var(--c-licence); }
.subpage--specifiques { --accent: var(--c-specifiques); }
.subpage--doc         { --accent: var(--c-doc); }
.subpage--admin       { --accent: var(--plum); }

/* Page « Bientôt disponible » */
.coming-soon {
    text-align: center;
    max-width: 560px;
    margin: 3.5rem auto;
    padding: 3rem 2rem;
}
.coming-soon__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 90px; height: 90px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--accent) 12%, #fff);
    margin-bottom: 1.6rem;
}
.coming-soon__icon svg {
    width: 46px; height: 46px;
    stroke: var(--accent); fill: none;
    stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.coming-soon h1 {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--title);
    margin-bottom: .9rem;
}
.coming-soon__badge {
    display: inline-block;
    white-space: nowrap;
    font-weight: 700;
    font-size: .92rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, #fff);
    padding: .35rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.4rem;
}
.coming-soon__text {
    color: #6a6675;
    font-size: 1.08rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

/* Bannière lecture seule */
.ro-banner {
    display: flex;
    align-items: center;
    gap: .7rem;
    background: #fbf4ec;
    border: 1px solid #f1ddc6;
    color: #8a4a1d;
    padding: .8rem 1.1rem;
    border-radius: 10px;
    margin-bottom: 1.4rem;
    font-size: 1rem;
}
.ro-banner svg { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; }
.ro-banner a { color: var(--accent, #8a4a1d); font-weight: 700; }

/* Encadré « connecté en tant que » */
.callout-inline {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #f3eff5;
    border: 1px solid #e3dce9;
    color: #4a4655;
    padding: .65rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.3rem;
    font-size: .98rem;
}
.callout-inline svg { width: 20px; height: 20px; stroke: var(--accent); flex-shrink: 0; }
.callout-inline code { font-family: ui-monospace, monospace; font-size: .9em; color: var(--accent); }

/* Badges de statut admin */
.badge {
    display: inline-block;
    font-size: .82rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: #ece7f0;
    color: #5a5168;
}
.badge--root { background: color-mix(in srgb, var(--plum) 14%, #fff); color: var(--plum); }

/* Liens utilitaires de la page admin */
.admin-links { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.admin-links .btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* Fil d'Ariane */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .98rem;
    color: #6a6675;
    margin-bottom: 1.7rem;
}
.breadcrumb a { color: #6a6675; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .45; }
.breadcrumb .current { color: var(--accent); font-weight: 600; }

/* En-tête de page */
.subpage__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem 1.1rem;
}
.subpage__badge {
    width: 56px; height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px -12px var(--accent);
}
.subpage__badge svg {
    width: 32px; height: 32px;
    stroke: #fff; fill: none;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.subpage__head h1 {
    font-size: 2.35rem;
    font-weight: 800;
    color: var(--title);
    line-height: 1.1;
    text-wrap: balance;
}
.subpage__sub {
    color: #6a6675;
    font-size: 1.06rem;
    margin: 1rem 0 2.1rem;
}

/* Barre d'outils */
.toolbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
    margin-bottom: 1.3rem;
}
.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 400px;
}
.search-box svg {
    position: absolute;
    left: .85rem; top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: #9a96a4;
}
.search-box input {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    padding: .72rem .9rem .72rem 2.55rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
}
.search-box input::placeholder { color: #a8a4b2; }
.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: .72rem 1.2rem;
    cursor: pointer;
    transition: filter .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
    text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--nav-grey); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: .5rem .95rem; font-size: .95rem; border-radius: 8px; }
.toolbar .btn--primary { margin-left: auto; }

/* Tableau */
.table-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 38px -26px rgba(40,15,40,.42);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.02rem;
}
.data-table thead th {
    background: var(--accent);
    color: #fff;
    text-align: left;
    font-weight: 600;
    font-size: .96rem;
    letter-spacing: .01em;
    padding: 1rem 1.3rem;
    white-space: nowrap;
}
.data-table th.num, .data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.data-table th.actions, .data-table td.actions {
    text-align: right;
    width: 110px;
}
.data-table tbody td {
    padding: .85rem 1.3rem;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}
.data-table tbody tr:hover td { background: #faf7fb; }
.data-table td.empty {
    text-align: center;
    color: #8a8694;
    padding: 2.6rem;
    font-size: 1.02rem;
}
.data-table tbody tr:hover td.empty { background: #fff; }

/* Champs éditables dans le tableau */
.cell-input {
    width: 100%;
    font: inherit;
    font-size: .98rem;
    padding: .5rem .65rem;
    border: 1px solid #cfcbd8;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
}
td.num .cell-input { text-align: right; }
.cell-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* Ligne d'ajout / d'édition mises en évidence */
.add-row td { background: #faf7fb !important; border-top: 2px solid var(--accent); }
.edit-row td { background: color-mix(in srgb, var(--accent) 7%, #fff) !important; }

/* Actions par ligne */
.row-actions {
    display: inline-flex;
    gap: .35rem;
    justify-content: flex-end;
}
.icon-btn {
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #7a7686;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.icon-btn svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn:hover { background: #f1eef5; color: var(--accent); }
.icon-btn--danger:hover { background: #fdeceb; color: #c0392b; }
.icon-btn--ok:hover { background: #e8f5ee; color: #1e8a54; }

/* Pied du tableau : compteur + total */
.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1rem;
    padding: 0 .3rem;
    color: #6a6675;
    font-size: .98rem;
}
.table-foot strong { color: var(--ink); font-weight: 700; }

/* Petit formulaire de suppression inline */
.inline-form { display: inline; }

@media (max-width: 620px) {
    .subpage__head h1 { font-size: 1.85rem; }
    .data-table { font-size: .94rem; }
    .data-table thead th,
    .data-table tbody td { padding: .7rem .8rem; }
    .toolbar .btn--primary { margin-left: 0; }
}
