/*
 * ═══════════════════════════════════════════════════════════════════
 *  Blog de Guillaume — CSS Interface d'administration
 *  Layout sidebar + contenu, composants admin spécifiques
 * ═══════════════════════════════════════════════════════════════════
 */

/* ── Layout admin ────────────────────────────────────────────────────────── */
.admin-body {
    display: flex;
    min-height: 100vh;
    background: #f0f4fc;
    font-family: var(--font-sans);
}

/* Sidebar */
.admin-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #0f172a;
    color: rgba(255,255,255,0.85);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
}

.sidebar-logo i {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #1a56db, #0ea5e9);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.1rem; }

/* Profil sidebar */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-top: 0.5rem;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1a56db, #0ea5e9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.profile-name { display: block; font-size: 0.85rem; font-weight: 600; color: white; }
.profile-role { font-size: 0.7rem; color: rgba(255,255,255,0.4); }

/* Navigation sidebar */
.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    padding: 0.75rem 0.5rem 0.25rem;
    margin-top: 0.25rem;
}

.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.65);
    transition: all 0.15s ease;
    text-decoration: none;
}

.admin-sidebar .nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.admin-sidebar .nav-item.active {
    background: rgba(26, 86, 219, 0.3);
    color: #93c5fd;
}

.admin-sidebar .nav-item i { width: 16px; text-align: center; font-size: 0.85rem; }

.admin-sidebar .nav-item-accent {
    background: rgba(26, 86, 219, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(26, 86, 219, 0.3);
}

.admin-sidebar .nav-item-accent:hover {
    background: rgba(26, 86, 219, 0.25);
    color: #bfdbfe;
}

.admin-sidebar .nav-item-danger:hover { background: rgba(220, 38, 38, 0.15); color: #fca5a5; }

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

/* Zone principale */
.admin-main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

.topbar-burger {
    display: none;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #64748b;
    padding: 0.25rem;
}

.topbar-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.topbar-breadcrumb i { font-size: 0.85rem; }
.topbar-breadcrumb a { color: #1a56db; }
.topbar-breadcrumb .fa-chevron-right { font-size: 0.6rem; }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.topbar-btn {
    width: 36px;
    height: 36px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.topbar-btn:hover { background: #1a56db; color: white; border-color: #1a56db; }

/* Contenu admin */
.admin-content {
    padding: 1.5rem;
    flex: 1;
}

/* ── Composants communs admin ────────────────────────────────────────────── */
.page-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
}

/* Cartes stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.stat-blue::before { background: #1a56db; }
.stat-card.stat-green::before { background: #059669; }
.stat-card.stat-purple::before { background: #7c3aed; }
.stat-card.stat-amber::before { background: #d97706; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-card.stat-blue .stat-icon { background: #dbeafe; color: #1a56db; }
.stat-card.stat-green .stat-icon { background: #d1fae5; color: #059669; }
.stat-card.stat-purple .stat-icon { background: #ede9fe; color: #7c3aed; }
.stat-card.stat-amber .stat-icon { background: #fef3c7; color: #d97706; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label { font-size: 0.8rem; color: #64748b; font-weight: 500; }

.stat-trend {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.trend-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.trend-badge.published { background: #d1fae5; color: #065f46; }
.trend-badge.draft { background: #fef3c7; color: #92400e; }
.trend-info { font-size: 0.75rem; color: #64748b; }

/* Cards dashboard */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 i { color: #1a56db; }

.card-action {
    font-size: 0.78rem;
    color: #1a56db;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: gap 0.15s;
}

.card-action:hover { gap: 0.5rem; }

.chart-wrapper { padding: 1rem; height: 160px; }
.chart-wrapper-lg { padding: 1rem; height: 260px; }

.chart-loading { color: #94a3b8; font-size: 0.8rem; }

/* Actions rapides */
.quick-actions-card .quick-actions {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    transition: all 0.15s ease;
    text-decoration: none;
}

.quick-action-btn i { font-size: 1.1rem; color: #1a56db; }
.quick-action-btn:hover { background: #dbeafe; border-color: #1a56db; color: #1a56db; transform: translateY(-2px); }

/* Tables */
.table-responsive { overflow-x: auto; }

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

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
}

.table-row-hover:hover td { background: #f8faff; }

.title-cell .article-title-link {
    font-weight: 600;
    color: #0f172a;
    transition: color 0.15s;
}

.title-cell .article-title-link:hover { color: #1a56db; }

.article-slug-preview { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; font-family: monospace; }

/* Badges statut */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.published { background: #d1fae5; color: #065f46; }
.status-badge.draft { background: #fef3c7; color: #92400e; }
.status-badge.archived { background: #f1f5f9; color: #64748b; }

.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0.15rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.views-count { font-size: 0.82rem; color: #64748b; display: flex; align-items: center; gap: 3px; }

/* Actions de table */
.actions-cell { display: flex; gap: 0.35rem; align-items: center; }

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}

.action-btn.edit { background: #dbeafe; color: #1a56db; }
.action-btn.edit:hover { background: #1a56db; color: white; }
.action-btn.view { background: #d1fae5; color: #059669; }
.action-btn.view:hover { background: #059669; color: white; }
.action-btn.publish { background: #dbeafe; color: #0891b2; }
.action-btn.publish:hover { background: #0891b2; color: white; }
.action-btn.unpublish { background: #fef3c7; color: #d97706; }
.action-btn.unpublish:hover { background: #d97706; color: white; }
.action-btn.delete { background: #fee2e2; color: #dc2626; }
.action-btn.delete:hover { background: #dc2626; color: white; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: #64748b; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.7rem; }

.empty-table { text-align: center; padding: 2rem; color: #94a3b8; font-size: 0.875rem; }
.empty-table i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.empty-table a { color: #1a56db; }

/* Pagination table */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* ── Filtre bar ───────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s;
    text-decoration: none;
    cursor: pointer;
}

.filter-btn:hover, .filter-btn.active {
    background: #dbeafe;
    border-color: #1a56db;
    color: #1a56db;
}

.filter-select {
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    outline: none;
}

.filter-select:focus { border-color: #1a56db; }

/* ── Éditeur d'article ───────────────────────────────────────────────────── */
.editor-toolbar-bar {
    position: sticky;
    top: 60px;
    z-index: 50;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -1.5rem -1.5rem 1.5rem;
}

.editor-status { display: flex; align-items: center; gap: 0.75rem; }

.autosave-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.published { background: #059669; }
.status-dot.draft { background: #d97706; }
.status-dot.saving { background: #3b82f6; animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.autosave-time { font-size: 0.75rem; color: #94a3b8; }

.editor-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Layout éditeur */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

.editor-main { display: flex; flex-direction: column; gap: 1rem; }

/* Titre */
.editor-title-wrapper { position: relative; }

.editor-title-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.6rem;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: 10px;
    background: white;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    font-family: var(--font-display);
}

.editor-title-input:focus { border-color: #1a56db; }
.editor-title-input::placeholder { color: #cbd5e1; font-weight: 400; }

.title-char-count {
    position: absolute;
    right: 0.75rem;
    bottom: 0.5rem;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* Slug */
.editor-slug-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}

.slug-prefix {
    padding: 0.4rem 0.75rem;
    background: #f1f5f9;
    border-right: 1px solid #e2e8f0;
    font-size: 0.78rem;
    color: #94a3b8;
    font-family: monospace;
    white-space: nowrap;
}

.slug-input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: none;
    outline: none;
    font-size: 0.82rem;
    font-family: monospace;
    color: #475569;
    background: transparent;
}

.slug-regenerate {
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    border-left: 1px solid #e2e8f0;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s;
}

.slug-regenerate:hover { color: #1a56db; }

/* Éditeur Quill */
.quill-wrapper {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    border: 1px solid #e2e8f0;
}

.quill-wrapper .ql-toolbar {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0.5rem;
}

.quill-wrapper .ql-container {
    border: none;
    font-size: 1rem;
    font-family: var(--font-sans);
    min-height: 400px;
}

.quill-wrapper .ql-editor {
    padding: 1.5rem;
    line-height: 1.8;
    min-height: 400px;
    color: #0f172a;
}

.quill-wrapper .ql-editor.ql-blank::before { color: #cbd5e1; font-style: normal; }

/* Champs textarea éditeur */
.editor-field-group { display: flex; flex-direction: column; gap: 0.4rem; }
.editor-label { font-size: 0.82rem; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 0.2rem; }
.label-hint { font-size: 0.72rem; font-weight: 400; color: #94a3b8; }
.editor-textarea { padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.875rem; resize: vertical; outline: none; transition: border-color 0.15s; background: white; color: #0f172a; }
.editor-textarea:focus { border-color: #1a56db; }
.editor-textarea.sm { font-size: 0.82rem; min-height: 70px; }

/* Sidebar éditeur */
.editor-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(60px + 60px + 1.5rem); max-height: calc(100vh - 180px); overflow-y: auto; padding-right: 4px; }

.editor-panel {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}

.panel-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Image mise en avant */
.featured-image-zone { display: flex; flex-direction: column; gap: 0.5rem; }

.featured-image-preview { position: relative; border-radius: 8px; overflow: hidden; }
.featured-image-preview img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

.remove-image {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-image-placeholder {
    aspect-ratio: 16/9;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: #cbd5e1;
    font-size: 0.75rem;
}

.featured-image-placeholder i { font-size: 1.5rem; }

.featured-image-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid #1a56db;
    color: #1a56db;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.upload-label:hover { background: #dbeafe; }

/* Formulaires éditeur */
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #475569;
    background: #f8fafc;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.form-select:focus { border-color: #1a56db; background: white; }

/* Tags dans l'éditeur */
.tags-input-wrapper { display: flex; flex-direction: column; gap: 0.5rem; }

.selected-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag-selected {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: #dbeafe;
    color: #1239a0;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-remove { background: none; border: none; cursor: pointer; color: #1a56db; font-size: 1rem; line-height: 1; padding: 0; margin-left: 1px; }

/* Toggle switch */
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle-label { font-size: 0.82rem; color: #475569; }

.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #e2e8f0;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: #1a56db; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Meta description */
.char-counter { font-size: 0.7rem; color: #94a3b8; font-weight: 400; float: right; }

/* Info panel */
.article-info-panel .info-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.75rem; font-size: 0.78rem; }
.info-list dt { color: #94a3b8; font-weight: 600; }
.info-list dd { color: #475569; }

.mt-2 { margin-top: 0.5rem; }

.form-label-sm { font-size: 0.78rem; font-weight: 600; color: #64748b; }

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #0f172a;
    background: white;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus { border-color: #1a56db; box-shadow: 0 0 0 3px #dbeafe; }
.form-input.sm { padding: 0.4rem 0.65rem; font-size: 0.82rem; }

/* ── Modale médiathèque ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(15,23,42,0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-modal { width: 100%; max-width: 860px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.modal-header h3 i { color: #1a56db; }

.modal-close {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover { background: #fee2e2; color: #dc2626; }

/* Onglets modal */
.media-modal-tabs {
    display: flex;
    border-bottom: 1px solid #f1f5f9;
    padding: 0 1.5rem;
    flex-shrink: 0;
    gap: 0.25rem;
}

.modal-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: -1px;
}

.modal-tab.active { color: #1a56db; border-bottom-color: #1a56db; }
.modal-tab:hover { color: #0f172a; }

/* Contenu onglets */
.modal-tab-content { display: none; padding: 1rem 1.5rem; overflow-y: auto; max-height: calc(90vh - 200px); }
.modal-tab-content.active { display: block; }

/* Filtre médias dans modal */
.media-filter-bar { display: flex; gap: 0.35rem; margin-bottom: 1rem; flex-wrap: wrap; }
.media-filter-btn { padding: 0.3rem 0.75rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 0.75rem; font-weight: 500; color: #64748b; cursor: pointer; transition: all 0.15s; }
.media-filter-btn.active { background: #dbeafe; border-color: #1a56db; color: #1a56db; }

/* Grille médias dans modal */
.media-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.media-grid-item {
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    aspect-ratio: 1;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-grid-item:hover { border-color: #1a56db; transform: scale(1.02); }
.media-grid-item.selected { border-color: #1a56db; box-shadow: 0 0 0 3px #dbeafe; }

.media-grid-item img { width: 100%; height: 100%; object-fit: cover; }

.media-loading { text-align: center; padding: 2rem; color: #94a3b8; font-size: 0.875rem; }

/* Zone d'upload */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    color: #94a3b8;
    transition: all 0.2s;
}

.upload-zone.drag-active {
    border-color: #1a56db;
    background: #dbeafe;
    color: #1a56db;
}

.upload-zone > i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.upload-zone > p { font-size: 0.9rem; }
.upload-hint { font-size: 0.78rem; color: #b0b8c5; margin: 0.35rem 0; }

.upload-file-label { cursor: pointer; }

.progress-bar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 1rem 0 0.5rem; }
.progress-fill { height: 100%; background: #1a56db; border-radius: 999px; transition: width 0.3s ease; }

/* YouTube input */
.youtube-input-zone { display: flex; flex-direction: column; gap: 1rem; }

/* ── Éditeur Page À propos ───────────────────────────────────────────────── */
.about-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-heading { font-size: 1.4rem; font-weight: 700; color: #1e293b; margin: 0 0 0.25rem; }
.page-subheading { font-size: 0.85rem; color: #64748b; margin: 0; }

.about-tabs {
    display: flex;
    gap: 0.25rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.4rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.about-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s;
    font-family: inherit;
}

.about-tab:hover { background: #f1f5f9; color: #1e293b; }
.about-tab.active { background: #1a56db; color: white; }

.about-section-panel { display: none; flex-direction: column; gap: 1.25rem; }
.about-section-panel.active { display: flex; }

.about-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Lignes répétables (badges, cartes, points…) */
.repeat-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 0.75rem;
}

.repeat-row-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.repeat-remove {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 1px solid #fecaca;
    background: #fff5f5;
    color: #dc2626;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
    margin-top: 1.6rem;
}

.repeat-remove:hover { background: #dc2626; color: white; border-color: #dc2626; }

/* Cartes d'expertise (layout spécial) */
.expertise-row { flex-direction: column; }
.expertise-row-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.expertise-row-header .repeat-remove { margin-top: 0; margin-left: auto; }
.expertise-row-num {
    width: 24px;
    height: 24px;
    background: #1a56db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.expertise-row-fields { grid-template-columns: 1fr 1fr; }

@media (max-width: 768px) {
    .about-fields-grid { grid-template-columns: 1fr; }
    .repeat-row-fields { grid-template-columns: 1fr; }
    .expertise-row-fields { grid-template-columns: 1fr; }
    .about-tabs { gap: 0.15rem; }
    .about-tab { padding: 0.4rem 0.65rem; font-size: 0.78rem; }
}

/* ── Modal Assistant IA ──────────────────────────────────────────────────── */
.llm-modal { width: 100%; max-width: 700px; }

.llm-modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.llm-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #475569;
}

.llm-options input[type="checkbox"] { cursor: pointer; accent-color: #1a56db; width: 15px; height: 15px; }

.llm-result-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #1e293b;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.llm-result-preview h2,
.llm-result-preview h3 { margin: 0.75rem 0 0.35rem; font-size: 1rem; }

.llm-result-preview p { margin: 0 0 0.5rem; }
.llm-result-preview ul, .llm-result-preview ol { padding-left: 1.4rem; margin: 0.4rem 0; }
.llm-result-preview li { margin-bottom: 0.2rem; }
.llm-result-preview code { background: #e2e8f0; border-radius: 4px; padding: 0.1em 0.35em; font-size: 0.85em; }
.llm-result-preview pre { background: #1e293b; color: #e2e8f0; border-radius: 8px; padding: 0.75rem 1rem; overflow-x: auto; }
.llm-result-preview pre code { background: none; padding: 0; color: inherit; }
.youtube-input-row { display: flex; gap: 0.75rem; }
.youtube-input-row .form-input { flex: 1; }
.youtube-preview img { width: 100%; border-radius: 8px; }
.youtube-preview p { font-size: 0.75rem; color: #64748b; font-family: monospace; margin-top: 0.5rem; }

/* ── Médiathèque (page) ──────────────────────────────────────────────────── */
.media-stats-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: #64748b;
}

.media-stat { display: flex; align-items: center; gap: 0.4rem; }
.media-stat i { color: #1a56db; }

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 2.5rem;
    text-align: center;
    color: #94a3b8;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone.drag-active { border-color: #1a56db; background: #f0f7ff; color: #1a56db; }
.drop-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }

.upload-progress-zone { max-width: 400px; margin: 1rem auto 0; }

.media-library-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.media-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.15s;
    position: relative;
    cursor: pointer;
}

.media-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,0.1); border-color: #1a56db; }

.media-thumbnail {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.media-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.media-icon-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.media-icon-thumb.video { color: #7c3aed; background: #ede9fe; }
.media-icon-thumb.doc { color: #dc2626; background: #fee2e2; }

.media-type-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
}

.media-type-badge.image { background: #059669; }
.media-type-badge.video { background: #7c3aed; }
.media-type-badge.document { background: #dc2626; }
.media-type-badge.youtube { background: #ef4444; }

.media-info {
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.media-name { font-size: 0.72rem; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { font-size: 0.65rem; color: #94a3b8; }
.media-date { font-size: 0.65rem; color: #b0b8c5; }

.media-actions {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-card:hover .media-actions { opacity: 1; }

.media-action-btn {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    text-decoration: none;
}

.media-action-btn.copy-url:hover { background: #1a56db; }
.media-action-btn.view:hover { background: #059669; }
.media-action-btn.delete:hover { background: #dc2626; }

/* ── Analytiques ─────────────────────────────────────────────────────────── */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card-lg { }

.period-selector { display: flex; gap: 0.25rem; }

.period-btn {
    padding: 0.4rem 0.9rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.period-btn.active, .period-btn:hover { background: #1a56db; color: white; border-color: #1a56db; }

.rank-cell { width: 40px; }

.rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.rank-badge.top-1 { background: #fef3c7; color: #92400e; }
.rank-badge.top-2 { background: #f1f5f9; color: #475569; }
.rank-badge.top-3 { background: #fef3c7; color: #b45309; }

.popularity-bar { height: 6px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.popularity-fill { height: 100%; border-radius: 999px; }

/* ── Catégories ─────────────────────────────────────────────────────────── */
.create-form-card { padding: 1.5rem; margin-bottom: 1.5rem; }
.card-form-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; color: #0f172a; }

.form-row { display: grid; grid-template-columns: 2fr 1.5fr 1.5fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-row .form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.form-group-sm { min-width: 80px; }
.form-group.form-group-xs { min-width: 60px; }

.form-label { font-size: 0.8rem; font-weight: 600; color: #475569; }
.form-actions { display: flex; gap: 0.5rem; padding-top: 0.5rem; }
.form-actions.sm { gap: 0.35rem; }

.color-input-group { display: flex; gap: 0.4rem; align-items: center; }
.color-picker { width: 36px; height: 36px; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; padding: 2px; }
.color-hex { flex: 1; font-family: monospace; }

.categories-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.category-admin-card {
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cat-card-header { display: flex; align-items: flex-start; gap: 0.75rem; }
.cat-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.cat-card-info { flex: 1; min-width: 0; }
.cat-card-info h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.cat-slug { font-size: 0.7rem; color: #94a3b8; font-family: monospace; }
.cat-card-stats { flex-shrink: 0; }

.stat-bubble { font-size: 0.72rem; padding: 0.2rem 0.6rem; background: #f1f5f9; color: #64748b; border-radius: 999px; font-weight: 600; }
.cat-card-desc { font-size: 0.8rem; color: #64748b; }

.cat-edit-form { border-top: 1px solid #f1f5f9; padding-top: 0.75rem; }
.inline-form.compact { }

.cat-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.btn-outline.xs, .btn-primary.xs { padding: 0.25rem 0.65rem; font-size: 0.72rem; border-radius: 6px; }
.btn-danger.xs {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger.xs:hover { background: #dc2626; color: white; }
.btn-disabled.xs { padding: 0.25rem 0.65rem; background: #f1f5f9; color: #94a3b8; border-radius: 6px; font-size: 0.72rem; display: inline-flex; align-items: center; cursor: not-allowed; border: 1px solid #e2e8f0; }

/* ── Sélecteur de tags / projets (pills cliquables) ─────────────────────── */
.tags-picker, .projects-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    min-height: 3rem;
    background: white;
}

.tag-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8fafc);
    font-size: 0.8rem;
    transition: all 0.15s;
    user-select: none;
}

.tag-pick input { display: none; }

.tag-pick.active,
.tag-pick:has(input:checked) {
    background: var(--color-primary, #1a56db);
    color: #fff;
    border-color: var(--color-primary, #1a56db);
}

.tag-pick:hover { border-color: var(--color-primary, #1a56db); }

/* ── Page de connexion ───────────────────────────────────────────────────── */
.login-body { background: #f0f4fc; }

.login-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 2fr 3fr;
}

.login-brand {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
    padding: 2rem;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #1a56db, #0ea5e9);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1.5rem;
}

.login-brand-content h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem; }
.login-brand-content p { font-size: 0.9rem; opacity: 0.65; }

.deco-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.deco-1 { width: 300px; height: 300px; top: -100px; right: -100px; }
.deco-2 { width: 200px; height: 200px; bottom: -50px; left: -50px; }
.deco-3 { width: 150px; height: 150px; top: 50%; left: 20%; transform: translate(-50%, -50%); }

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-form-wrapper { width: 100%; max-width: 400px; }

.login-header { margin-bottom: 2rem; }
.login-header h2 { font-size: 1.75rem; font-weight: 700; color: #0f172a; }
.login-header p { color: #64748b; margin-top: 0.25rem; }

.alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

.login-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; color: #475569; margin-bottom: 0.4rem; }

.input-with-toggle { position: relative; }
.input-with-toggle .form-input { padding-right: 2.5rem; }

.input-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem;
}

.btn-full { width: 100%; justify-content: center; padding: 0.75rem; font-size: 0.95rem; margin-top: 0.5rem; }

.login-back { text-align: center; margin-top: 1.5rem; }
.back-link { font-size: 0.85rem; color: #64748b; display: inline-flex; align-items: center; gap: 0.4rem; transition: color 0.15s; }
.back-link:hover { color: #1a56db; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: #0f172a;
    color: white;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(15,23,42,0.25);
    pointer-events: auto;
    animation: slideInToast 0.3s ease;
    max-width: 380px;
}

.toast.success { border-left: 4px solid #059669; }
.toast.error { border-left: 4px solid #dc2626; }
.toast.info { border-left: 4px solid #1a56db; }

.toast i { font-size: 1rem; flex-shrink: 0; }
.toast.success i { color: #34d399; }
.toast.error i { color: #f87171; }
.toast.info i { color: #60a5fa; }

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Responsive admin ────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .media-library-grid { grid-template-columns: repeat(4, 1fr); }
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-sidebar { position: static; max-height: none; overflow: visible; }
    .dashboard-row { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay.visible { display: block; }
    .admin-main { margin-left: 0; }
    .topbar-burger { display: block; }
    .hide-mobile { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .media-library-grid { grid-template-columns: repeat(3, 1fr); }
    .categories-grid { grid-template-columns: 1fr; }
    .login-container { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .form-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .admin-content { padding: 0.75rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .media-library-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Assistance IA — bouton sur champs texte ─────────────────────────────── */
.ai-field-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.ai-field-wrapper input,
.ai-field-wrapper textarea {
    padding-right: 2rem !important;
    width: 100%;
    box-sizing: border-box;
}

.ai-field-btn {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.65rem;
    border-radius: 4px;
    z-index: 1;
    line-height: 1;
}

.ai-field-wrapper:hover .ai-field-btn,
.ai-field-btn:focus {
    opacity: 1;
}

.ai-field-btn:hover {
    color: #1a56db;
    background: #eff6ff;
    opacity: 1;
}

.ai-field-btn:disabled {
    opacity: 0.7 !important;
    cursor: wait;
}

/* Popover suggestion */
.ai-popover {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
    overflow: hidden;
}

.ai-popover-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    background: #f0f7ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1a56db;
}

.ai-popover-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.ai-popover-close:hover { color: #475569; }

.ai-popover-text {
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.55;
    white-space: pre-wrap;
    max-height: 130px;
    overflow-y: auto;
}

.ai-popover-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid #f1f5f9;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Articles proposés (file de relecture) et PWA d'administration
   Préfixe .pq- (publish queue). Conçu en priorité pour le téléphone :
   l'essentiel de l'usage se fait depuis l'application installée.
   ═══════════════════════════════════════════════════════════════════════════ */

/* L'attribut « hidden » ne pèse qu'un display:none de la feuille du navigateur :
   il est écrasé par les display:flex / inline-flex déclarés plus bas. Cette règle
   lui rend la priorité — sans elle, les boutons et messages masqués par le
   JavaScript restent visibles. */
.admin-body [hidden] { display: none !important; }

.pq-intro {
    color: #64748b;
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 60ch;
    margin: -0.75rem 0 1.5rem;
}

/* ── Cloche d'accès aux réglages de rappel ──────────────────────────────── */
.pq-bell {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}

.pq-bell:hover { background: #f8fafc; color: #1a56db; border-color: #cbd5e1; }
.pq-bell[aria-expanded="true"] { background: #eff6ff; color: #1a56db; border-color: #bfdbfe; }

.pq-bell-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid white;
}

/* ── Panneau des rappels ────────────────────────────────────────────────── */
.pq-panel {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    padding: 1.25rem;
    margin-bottom: 1.75rem;
}

.pq-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.125rem;
}

.pq-panel-title {
    font-family: var(--font-display, inherit);
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pq-panel-title i { color: #1a56db; font-size: 0.9375rem; }

.pq-panel-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.pq-panel-close:hover { color: #475569; background: #f1f5f9; }

/* ── Bandeau d'état des notifications ───────────────────────────────────── */
.pq-status {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.9375rem 1.125rem;
    border-radius: 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

.pq-status.on { background: #f0fdf4; border-color: #86efac; }
.pq-status.off { background: #fffbeb; border-color: #fcd34d; }

.pq-status-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: white;
    color: #64748b;
    font-size: 0.9375rem;
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}

.pq-status.on .pq-status-icon { color: #16a34a; }
.pq-status.off .pq-status-icon { color: #d97706; }

.pq-status-text { display: flex; flex-direction: column; gap: 0.1875rem; min-width: 0; }
.pq-status-text strong { font-size: 0.9375rem; font-weight: 600; color: #0f172a; }
.pq-status-text small { font-size: 0.8125rem; color: #64748b; line-height: 1.45; }

/* ── Rangées de boutons ─────────────────────────────────────────────────── */
.pq-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pq-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.pq-btn-ghost:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.pq-btn-ghost:disabled { opacity: 0.6; cursor: default; }

.pq-hint {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 0;
    padding: 0.8125rem 1rem;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.8125rem;
    line-height: 1.55;
}

.pq-hint i { margin-top: 0.15rem; flex-shrink: 0; }

/* ── Programmation des rappels ──────────────────────────────────────────── */
.pq-schedule {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.pq-schedule-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.625rem;
}

.pq-schedule-state {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.3125rem 0.6875rem;
    border-radius: 999px;
}

.pq-schedule-state.on { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.pq-schedule-state.off { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.pq-schedule-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1a56db;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.pq-schedule-link:hover { text-decoration: underline; }

.pq-schedule-desc {
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0 0 1rem;
}

.pq-next, .pq-devices { margin-bottom: 1rem; }

.pq-next-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.pq-next-items, .pq-device-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.pq-next-items li, .pq-device-items li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #334155;
}

.pq-next-items i, .pq-device-items i { color: #94a3b8; font-size: 0.75rem; width: 1rem; }
.pq-device-items small { color: #94a3b8; font-size: 0.75rem; }

.pq-devices {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
    margin-bottom: 0;
}

/* ── Cartes de brouillon ────────────────────────────────────────────────── */
.pq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pq-card {
    display: flex;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    overflow: hidden;
    transition: box-shadow 0.18s, border-color 0.18s;
}

.pq-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.09); border-color: #cbd5e1; }

.pq-card-media {
    width: 168px;
    flex-shrink: 0;
    background: #f1f5f9;
}

.pq-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pq-card-body { padding: 1.125rem 1.25rem; flex: 1; min-width: 0; }

.pq-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.875rem;
    margin-bottom: 0.625rem;
}

.pq-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.pq-meta-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    padding: 0.1875rem 0.5rem;
    border-radius: 6px;
}

.pq-card-title {
    font-family: var(--font-display, inherit);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
    margin: 0 0 0.5rem;
    letter-spacing: -0.01em;
}

.pq-card-excerpt {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0 0 0.75rem;
}

.pq-card-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.875rem; }

.pq-tag {
    font-size: 0.75rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.1875rem 0.5rem;
    border-radius: 6px;
}

.pq-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pq-inline-form { display: inline-flex; margin: 0; }

.pq-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4375rem;
    padding: 0.5625rem 0.9375rem;
    border-radius: 9px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.pq-action.lg { padding: 0.6875rem 1.375rem; font-size: 0.875rem; }

.pq-action.read { background: #0f172a; color: white; }
.pq-action.read:hover { background: #1e293b; }

.pq-action.publish { background: #16a34a; color: white; }
.pq-action.publish:hover { background: #15803d; }

.pq-action.edit { background: white; color: #475569; border-color: #e2e8f0; }
.pq-action.edit:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }

.pq-action.dismiss { background: white; color: #94a3b8; border-color: #e2e8f0; }
.pq-action.dismiss:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* ── File vide ──────────────────────────────────────────────────────────── */
.pq-empty { padding: 3.5rem 1.5rem; text-align: center; }
.pq-empty i { font-size: 2.25rem; color: #cbd5e1; margin-bottom: 1rem; display: block; }

.pq-empty h2 {
    font-family: var(--font-display, inherit);
    font-size: 1.125rem;
    color: #0f172a;
    margin: 0 0 0.5rem;
}

.pq-empty p { color: #64748b; font-size: 0.9375rem; margin: 0 0 1.5rem; }

.pq-archived-note {
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pq-archived-note a { color: #1a56db; }

/* ── Lecteur plein écran ────────────────────────────────────────────────── */
body.pq-no-scroll { overflow: hidden; }

.pq-reader {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: white;
    display: flex;
    flex-direction: column;
}

.pq-reader[hidden] { display: none; }

.pq-reader-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
    /* Encoche des téléphones en mode application */
    padding-top: max(0.875rem, env(safe-area-inset-top));
}

.pq-reader-close {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 0.9375rem;
    cursor: pointer;
    flex-shrink: 0;
}

.pq-reader-close:hover { background: #f8fafc; color: #0f172a; }

.pq-reader-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.pq-reader-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.75rem 1.25rem 2.5rem;
}

.pq-reader-title,
.pq-reader-content { max-width: 68ch; margin-left: auto; margin-right: auto; }

.pq-reader-title {
    font-family: var(--font-display, inherit);
    font-size: 1.625rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 auto 1.5rem;
}

.pq-reader-content { color: #1e293b; font-size: 1.0625rem; line-height: 1.75; }
.pq-reader-content > *:first-child { margin-top: 0; }
.pq-reader-content p { margin: 0 0 1.25rem; }

.pq-reader-content h2,
.pq-reader-content h3,
.pq-reader-content h4 {
    font-family: var(--font-display, inherit);
    color: #0f172a;
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
}

.pq-reader-content h2 { font-size: 1.375rem; }
.pq-reader-content h3 { font-size: 1.1875rem; }
.pq-reader-content h4 { font-size: 1.0625rem; }
.pq-reader-content img { max-width: 100%; height: auto; border-radius: 10px; margin: 1.5rem 0; }
.pq-reader-content ul, .pq-reader-content ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.pq-reader-content li { margin-bottom: 0.5rem; }

.pq-reader-content blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 0 0.75rem 1.25rem;
    border-left: 3px solid #1a56db;
    color: #475569;
    font-style: italic;
}

.pq-reader-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem 1.125rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 1.5rem 0;
}

.pq-reader-content a { color: #1a56db; }
.pq-reader-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9375rem; }
.pq-reader-content th, .pq-reader-content td { border: 1px solid #e2e8f0; padding: 0.5rem 0.75rem; text-align: left; }
.pq-reader-content iframe { max-width: 100%; border-radius: 10px; }

.pq-read-empty { color: #94a3b8; font-style: italic; }

.pq-reader-bar {
    display: flex;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(15,23,42,0.06);
    /* Barre gestuelle des téléphones en mode application */
    padding-bottom: max(0.875rem, env(safe-area-inset-bottom));
}

.pq-reader-bar .pq-action.edit { flex: 0 0 auto; }
.pq-reader-bar .pq-inline-form { flex: 1; }
.pq-reader-bar .pq-action.publish { width: 100%; }

/* ── Téléphones ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .pq-card { flex-direction: column; }
    .pq-card-media { width: 100%; height: 150px; }
    .pq-card-body { padding: 1rem; }
    .pq-card-title { font-size: 1.0625rem; }

    /* Deux colonnes de boutons : cibles tactiles confortables */
    .pq-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .pq-card-actions .pq-inline-form { width: 100%; }
    .pq-card-actions .pq-action { width: 100%; padding: 0.6875rem 0.75rem; }

    .pq-panel { padding: 1rem; }
    .pq-actions-row .btn-primary,
    .pq-actions-row .pq-btn-ghost { flex: 1 1 auto; justify-content: center; }
    .pq-reader-scroll { padding: 1.25rem 1rem 2rem; }
    .pq-reader-title { font-size: 1.375rem; }
    .pq-reader-content { font-size: 1rem; }
    .pq-intro { display: none; }
}
