/* ═══════════════════════════════════════════════════════════════
    AdminPanel — Composants (cards, table, badges, alerts, etc.)
   ═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────
    Stat cards (dashboard)
   ─────────────────────────────────────────────── */

.admin-stats__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-stats__card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-stats__card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.admin-stats__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.admin-stats__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.admin-stats__meta         { font-size: 0.78rem; color: var(--text-muted); }
.admin-stats__meta--up     { color: var(--success); }
.admin-stats__meta--down   { color: var(--danger); }

/* ───────────────────────────────────────────────
    Card générique
   ─────────────────────────────────────────────── */

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.admin-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.admin-card__body { padding: 1.25rem; }

.admin-card__section {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.admin-card__section:first-child {
    border-top: none;
}

.admin-card__label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.6rem 0;
}

/* ───────────────────────────────────────────────
    Barre de recherche
   ─────────────────────────────────────────────── */

.admin-search__wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-search__input {
    flex: 1;
    max-width: 360px;
    min-width: 0;
    padding: 0.6rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-main);
    font: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-search__input::placeholder { color: var(--text-muted); }

.admin-search__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.admin-search__btn { flex-shrink: 0; }

/* ───────────────────────────────────────────────
    Table
   ─────────────────────────────────────────────── */

.admin-table__wrapper { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table thead { background: var(--bg-main); }

.admin-table th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    text-align: left;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

/* Cellules de données : tronquées et dépliables au clic */
.admin-table td.admin-table__td-data {
    max-width: 260px;
    cursor: pointer;
    user-select: none;
    vertical-align: top;
}

.admin-table td.admin-table__td-data .admin-table__td-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

.admin-table td.admin-table__td-data.expanded {
    max-width: 400px;
    white-space: normal;
}

.admin-table td.admin-table__td-data.expanded .admin-table__td-content {
    display: block;
    overflow: visible;
    line-clamp:unset;
    -webkit-line-clamp: unset;
    word-break: break-word;
}

.admin-table tbody tr { transition: background var(--transition); }
.admin-table tbody tr:hover { background: var(--bg-hover); }

.admin-table__actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-badge--id {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: ui-monospace, monospace;
    color: var(--text-muted);
}

/* ───────────────────────────────────────────────
    Pagination
   ─────────────────────────────────────────────── */

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}

.admin-pagination__info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.admin-pagination__controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-pagination__btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.82rem;
    transition: all var(--transition);
}

.admin-pagination__btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.admin-pagination__btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.admin-pagination__btn:disabled { opacity: 0.35; pointer-events: none; }

/* ───────────────────────────────────────────────
    Alerts / Flash messages
   ─────────────────────────────────────────────── */

.admin-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    border: 1px solid transparent;
    margin-bottom: 1rem;
}

.admin-alert--success { background: var(--success-light); border-color: rgba(34, 197, 94, 0.25);  color: #86efac; }
.admin-alert--danger  { background: var(--danger-light);  border-color: rgba(239, 68, 68, 0.25);  color: #fca5a5; }
.admin-alert--warning { background: var(--warning-light); border-color: rgba(245, 158, 11, 0.25); color: #fde68a; }
.admin-alert--info    { background: var(--accent-light);  border-color: rgba(59, 130, 246, 0.25); color: #93c5fd; }

/* ───────────────────────────────────────────────
    Badges
   ─────────────────────────────────────────────── */

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 2;
}

.admin-badge--blue    { background: var(--accent-light);  color: var(--accent); }
.admin-badge--green   { background: var(--success-light); color: var(--success); }
.admin-badge--red     { background: var(--danger-light);  color: var(--danger); }
.admin-badge--yellow  { background: var(--warning-light); color: var(--warning); }
.admin-badge--neutral { background: var(--bg-input);      color: var(--text-muted); }

/* ───────────────────────────────────────────────
    Search bar (legacy)
   ─────────────────────────────────────────────── */

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input { padding-left: 2.25rem; min-width: 220px; }

.search-icon {
    position: absolute;
    left: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

/* ───────────────────────────────────────────────
    Empty state
   ─────────────────────────────────────────────── */

.admin-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    gap: 0.75rem;
    text-align: center;
}

.admin-empty-state__icon   { width: 48px; height: 48px; opacity: 0.3; }
.admin-empty-state__title  { font-size: 1rem; font-weight: 500; color: var(--text-main); }
.admin-empty-state__desc   { font-size: 0.85rem; max-width: 300px; }

/* ───────────────────────────────────────────────
    Kebab menu (actions ligne tableau)
   ─────────────────────────────────────────────── */

.admin-table__td-actions {
    width: 36px;
    padding: 0 0.25rem !important;
    vertical-align: middle;
}

.admin-menu {
    position: relative;
    justify-content: center;
}

.admin-menu__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.admin-menu__trigger:hover,
.admin-menu__trigger.active {
    background: var(--bg-hover);
    color: var(--text-main);
}

.admin-menu__dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 100;
    overflow: hidden;
}

.admin-menu__dropdown.open { display: block; }

.admin-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.875rem;
    background: none;
    border: none;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.admin-menu__item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.admin-menu__item--danger { color: var(--danger); }
.admin-menu__item--danger:hover { background: var(--danger-light); color: var(--danger); }

.admin-menu__separator {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* ───────────────────────────────────────────────
    Delete zone (confirmation suppression)
   ─────────────────────────────────────────────── */

.admin-danger-zone {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-danger-zone__text   { font-size: 0.88rem; color: #fca5a5; }
.admin-danger-zone__title  { font-weight: 600; color: var(--danger); margin-bottom: 0.25rem; }

/* ───────────────────────────────────────────────
    Warning box (page de suppression)
   ─────────────────────────────────────────────── */

.admin-warning {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    color: #fca5a5;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.admin-warning strong { color: var(--danger); }

/* ───────────────────────────────────────────────
    Utilitaires (remplacent les style= inline)
   ─────────────────────────────────────────────── */

.admin-page__actions    { display: flex; gap: 0.6rem; height: 25px; }
.admin-form--inline     { display: inline; }
.admin-text--muted      { color: var(--text-muted); }
.admin-table__actions--end { justify-content: flex-end; }

.admin-card--full-width { grid-column: 1 / -1; }
.mt-sm                  { margin-top: 0.5rem; }

.admin-table__key {
    width: 200px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Filter sidebar ── */
.admin-filter__header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 0.5rem;
}

.admin-filter__title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity var(--transition);
}

.admin-filter__body {
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-filter__body::-webkit-scrollbar { width: 4px; }
.admin-filter__body::-webkit-scrollbar-track { background: transparent; }
.admin-filter__body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.admin-filter__sidebar {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
}

.admin-filter__group {
    padding: 0.15rem 0;
}

.admin-filter__group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0.55rem 1rem;
    margin: 0.1rem 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-sidebar);
    transition: background var(--transition), color var(--transition);
}

.admin-filter__group-title:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.admin-filter__chevron {
    flex-shrink: 0;
    transition: transform var(--transition);
}

.admin-filter__option {
    display: flex;
    align-items: center;
    padding: 0.45rem 1rem;
    margin: 0.1rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--text-sidebar);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--transition), color var(--transition);
}

.admin-filter__option:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.admin-filter__option.admin-filter__option--active {
    background: var(--bg-active);
    color: var(--accent);
    font-weight: 500;
}

.admin-filter__option.admin-filter__option--clear {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.admin-filter__option.admin-filter__option--clear:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.admin-filter__pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1rem 0.1rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}

.admin-filter__page-info {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.admin-filter__page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition);
}

.admin-filter__page-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--accent);
}

.admin-filter__page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

@media (max-width: 480px) {
    .admin-card--form { max-width: 100%; }
}

@media (min-width: 480px) and (max-width: 768px){
    .admin-card--form { max-width: 80%; }
}

/* ───────────────────────────────────────────────
    Group actions (bulk)
   ─────────────────────────────────────────────── */

.admin-group-action__bar {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.admin-group-action__bar.admin-group-action__bar--visible { display: flex; }

.admin-group-action__info {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
}

.admin-group-action__btns {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-group-action__selects {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-group-action__select {
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
    height: 30px;
    outline: none;
}

.admin-group-action__select:focus { border-color: var(--accent); }

.admin-table__th-bulk,
.admin-table__td-bulk {
    width: 2.5rem;
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.admin-table__bulk-check,
#bulk-check-all {
    cursor: pointer;
    accent-color: var(--accent);
}

/* ───────────────────────────────────────────────
    Modale de confirmation — rq-modal
   ─────────────────────────────────────────────── */

.rq-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.rq-modal-overlay.open {
    display: flex;
}

.rq-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.rq-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.rq-modal-msg {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.rq-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ── Group edit sections ─────────────────────────────────────── */

.admin-group-edit__section {
    margin-bottom: 1rem;
}

.admin-group-edit__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-group-edit__section-hint {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.admin-group-edit__toggle-row {
    margin-top: 0.75rem;
}
