/* ═══════════════════════════════════════════════════════════════
    AdminPanel — Layout (sidebar, topbar, main area)
   ═══════════════════════════════════════════════════════════════ */

/* Reset admin */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    /* Empêche le zoom auto des polices sur iOS lors de la rotation */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Scroll natif fluide sur iOS */
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scroll fluide dans la zone de contenu principale */
.admin-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
ul { list-style: none; }

/* ───────────────────────────────────────────────
    Structure principale
   ─────────────────────────────────────────────── */

.admin-layout {
    display: flex;
    height: 100vh;
    height: 100dvh; /* exclut la barre navigateur sur mobile */
    overflow: hidden;
}

/* ───────────────────────────────────────────────
    Sidebar
   ─────────────────────────────────────────────── */

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition);
    overflow: hidden;
    z-index: 100;
}

.admin-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Header sidebar */
.admin-sidebar__header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    flex-shrink: 0;
}

.admin-sidebar__logo {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.admin-sidebar__title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity var(--transition);
}

.admin-sidebar.collapsed .admin-sidebar__title {
    opacity: 0;
    width: 0;
}

/* Navigation */
.admin-sidebar__nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

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

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

.admin-sidebar.collapsed .admin-nav__section-label {
    opacity: 0;
}

.admin-nav__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    margin: 0.1rem 0.5rem;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

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

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

.admin-nav__item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    margin-left: -0.5rem;
}

.admin-nav__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.admin-nav__item:hover .admin-nav__icon,
.admin-nav__item.active .admin-nav__icon { opacity: 1; }

.admin-nav__label {
    opacity: 1;
    transition: opacity var(--transition);
    font-size: 0.88rem;
}

.admin-sidebar.collapsed .admin-nav__label {
    opacity: 0;
    width: 0;
}

.admin-sidebar.collapsed .admin-nav__item {
    justify-content: center;
}

.admin-nav__divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 1rem;
}

/* Footer sidebar */
.admin-sidebar__footer {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0;
    flex-shrink: 0;
}

.admin-sidebar__footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
}

.hidden { display: none; }

.admin-sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: all var(--transition);
}

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

/* ───────────────────────────────────────────────
    Zone principale
   ─────────────────────────────────────────────── */

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Topbar */
.admin-topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
}

.admin-topbar__breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex: 1;
}

.admin-topbar__breadcrumb a:hover { color: var(--accent); }
.admin-topbar__breadcrumb span { color: var(--text-main); font-weight: 500; }
.admin-topbar__sep { opacity: 0.4; }

.admin-topbar__user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.82rem;
    transition: background var(--transition);
}

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

.admin-topbar__avatar {
    width: clamp(32px, 4vw, 40px);
    height: clamp(32px, 4vw, 40px);
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
}

/* Contenu */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem;
}

.admin-content::-webkit-scrollbar { width: 6px; }
.admin-content::-webkit-scrollbar-track { background: transparent; }
.admin-content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* Page header */
.admin-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

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

.admin-page__subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Filter sidebar layout ── */
.admin-list__layout {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1.5rem;
    align-items: start;
    transition: grid-template-columns var(--transition);
}

.admin-list__layout.filter-collapsed {
    grid-template-columns: 1fr 36px;
}

.admin-list__layout.filter-collapsed .admin-filter__body { display: none; }
.admin-list__layout.filter-collapsed .admin-filter__title { opacity: 0; width: 0; }

/* Transition de page — fade-in au chargement */
/* TODO: remplacer par @view-transition { navigation: auto; } quand Firefox le supporte */
@keyframes adminFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.admin-content {
    animation: adminFadeIn 0.18s ease;
}
