/* Admin Malambi — sobre, dense, fonctionnel */

* { box-sizing: border-box; }

:root {
    --c-bg: #f8fafc;
    --c-card: #ffffff;
    --c-border: #e2e8f0;
    --c-text: #1e293b;
    --c-muted: #64748b;
    --c-muted-light: #94a3b8;
    --c-primary: #1d5c9a;
    --c-primary-light: #289de7;
    --c-success: #16a34a;
    --c-warning: #f59e0b;
    --c-danger: #dc2626;
    --c-darker: #0f172a;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-light); }

h1 { font-size: 1.6rem; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; font-weight: 700; }
h3 { font-size: 0.95rem; margin: 0 0 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-muted); font-weight: 700; }

.muted { color: var(--c-muted); }
.muted-small { color: var(--c-muted-light); font-size: 0.8rem; }
.hint { color: var(--c-muted-light); font-weight: 400; font-size: 0.85em; }
.req { color: var(--c-danger); font-style: normal; }

/* === Topbar === */
.admin-topbar {
    background: var(--c-darker);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-topbar .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}
.admin-topbar .brand img { height: 28px; }
.admin-topbar .brand span { font-size: 0.85rem; opacity: 0.7; }

.topnav {
    display: flex;
    gap: 0.25rem;
    margin-left: 2rem;
    flex: 1;
}
.topnav a {
    color: rgba(255,255,255,0.7);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
}
.topnav a:hover { background: rgba(255,255,255,0.08); color: white; }
.topnav a.active { background: var(--c-primary); color: white; }

.topnav-right { display: flex; gap: 0.5rem; align-items: center; }
.topnav-right .hello { font-size: 0.85rem; opacity: 0.7; margin-right: 0.5rem; }

.btn-ghost {
    color: rgba(255,255,255,0.85);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }

/* === Main === */
.admin-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    background: white;
    box-shadow: var(--shadow);
}
.flash-success { border-color: var(--c-success); }
.flash-error   { border-color: var(--c-danger); }
.flash-info    { border-color: var(--c-primary); }

/* === Login === */
.body-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1d5c9a 100%);
}
.body-login .admin-main { padding: 0; }
.login-card {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 360px;
    max-width: 92vw;
    text-align: center;
}
.login-logo { height: 50px; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.4rem; }

.form-stack { display: flex; flex-direction: column; gap: 0.85rem; text-align: left; margin-top: 1rem; }
.form-stack label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--c-muted); }
.form-stack input, .form-stack textarea, .form-stack select {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
}
.form-stack input:focus, .form-stack textarea:focus, .form-stack select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(29, 92, 154, 0.15);
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary {
    background: var(--c-primary);
    color: white;
}
.btn-primary:hover { background: var(--c-primary-light); transform: translateY(-1px); color: white; }
.btn-ghost {
    background: white;
    color: var(--c-muted);
    border: 1px solid var(--c-border);
}
.btn-ghost:hover { background: var(--c-bg); border-color: var(--c-primary); color: var(--c-primary); }
.btn-back {
    color: var(--c-muted);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}
.btn-back:hover { background: var(--c-bg); }
.btn-danger-ghost {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    color: var(--c-muted);
}
.btn-danger-ghost:hover { background: #fee; color: var(--c-danger); }

/* === KPI grid === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi {
    background: white;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}
.kpi-num { font-size: 2rem; font-weight: 800; color: var(--c-primary); line-height: 1; }
.kpi-lbl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c-muted); margin-top: 0.5rem; }

.actions-row { display: flex; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.section-title { margin-top: 2rem; }

/* === Card list === */
.card-list { display: flex; flex-direction: column; gap: 0.5rem; }
.card-row {
    display: flex;
    align-items: center;
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: inherit;
    transition: all 0.15s;
}
.card-row:hover { box-shadow: var(--shadow-md); transform: translateX(2px); }
.card-row-main { flex: 1; min-width: 0; }
.card-row-title { font-weight: 600; color: var(--c-text); }
.card-row-meta { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--c-muted); margin-top: 0.25rem; flex-wrap: wrap; }
.chevron { color: var(--c-muted-light); font-size: 1.2rem; }

/* === Status pills === */
.status {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-published { background: #dcfce7; color: #166534; }
.status-draft     { background: #fef3c7; color: #92400e; }
.status-archived  { background: #e2e8f0; color: #475569; }

.cat-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}
.badge-gold { color: #d97706; margin-left: 0.3rem; }

/* === Data table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th {
    background: var(--c-bg);
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-muted);
    border-bottom: 1px solid var(--c-border);
}
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.9rem;
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .td-sub { font-size: 0.75rem; color: var(--c-muted-light); margin-top: 2px; font-family: monospace; }
.data-table .link { color: inherit; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.filters-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.filters-row select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
}

/* === Post edit === */
.post-edit-form { padding-bottom: 2rem; }
.post-edit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.post-edit-header h1 { margin: 0; flex: 1; }
.header-actions { display: flex; gap: 0.5rem; }

.post-edit-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .post-edit-grid { grid-template-columns: 1fr; }
}

.post-edit-main { display: flex; flex-direction: column; gap: 1rem; }
.post-edit-side { display: flex; flex-direction: column; gap: 1rem; }
.side-card {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--c-muted); }
.field input, .field textarea, .field select {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: 7px;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(29, 92, 154, 0.15);
}
.field textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }

.field-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--c-muted);
}

.cover-preview {
    margin-top: 0.5rem;
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--c-border);
}

/* Editor tabs */
.editor-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0.5rem;
}
.editor-tabs .tab {
    padding: 0.4rem 0.85rem;
    background: var(--c-bg);
    color: var(--c-muted);
    border: 1px solid var(--c-border);
    border-radius: 6px 6px 0 0;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}
.editor-tabs .tab.active {
    background: white;
    color: var(--c-primary);
    border-bottom-color: white;
}
.editor-pane.hidden { display: none; }
.editor-pane.preview {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--c-border);
    border-radius: 0 8px 8px 8px;
    min-height: 400px;
    line-height: 1.7;
}
.editor-pane.preview h1 { font-size: 1.8rem; margin-top: 0; }
.editor-pane.preview h2 { font-size: 1.4rem; }
.editor-pane.preview pre { background: #f1f5f9; padding: 0.75rem; border-radius: 6px; overflow-x: auto; }
.editor-pane.preview code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.editor-pane.preview blockquote { border-left: 4px solid var(--c-primary); padding-left: 1rem; color: var(--c-muted); font-style: italic; }
.editor-pane.preview a { color: var(--c-primary); }
.editor-pane.preview img { max-width: 100%; border-radius: 6px; }

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 700px) {
    .profile-grid { grid-template-columns: 1fr; }
}
.kv { margin: 0; }
.kv dt { font-size: 0.75rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.5rem; }
.kv dd { margin: 0; font-weight: 500; }
