/* ==========================================================================
   MCODE CMS (admin area) styles
   Uses the same colours and font as the website (site.css variables are repeated here).
   ========================================================================== */
:root {
    --brand: #17803d;
    --brand-dark: #0b3d24;
    --brand-soft: #e8f4ec;
    --accent: #039bd7;
    --accent-soft: #e3f4fb;
    --ink: #11241a;
    --muted: #5c6c64;
    --line: #e3e9e5;
    --bg: #f3f6f4;
    --radius: 16px;
    --sidebar-w: 264px;
    --shadow-sm: 0 4px 14px rgba(17, 36, 26, .06);
    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 23, 128, 61;
}

body { font-family: var(--bs-body-font-family); background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; padding: .6rem 1.2rem; transition: all .2s ease; }
.btn-sm { padding: .35rem .75rem; border-radius: 8px; }
.btn-brand { --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-soft-danger { color: #c0392b; background: #fdecea; border: 0; }
.btn-soft-danger:hover { color: #fff; background: #c0392b; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); background: linear-gradient(180deg, var(--brand-dark), #082b19);
    color: rgba(255, 255, 255, .8);
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; }
    .admin-main { margin-left: var(--sidebar-w); }
}
.sidebar .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 22px 22px; color: #fff; }
.sidebar-brand img { width: 42px; height: 42px; background: #fff; border-radius: 12px; padding: 3px; }
.sidebar-brand strong { display: block; line-height: 1.1; }
.sidebar-brand small { color: rgba(255, 255, 255, .6); font-size: .75rem; }
.sidebar-nav { padding: 8px 14px 24px; overflow-y: auto; }
.sidebar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .45); margin: 18px 10px 8px; font-weight: 700; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; border-radius: 10px;
    color: rgba(255, 255, 255, .78); font-weight: 500; font-size: .93rem; transition: all .2s ease;
}
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar-nav a.active { color: #fff; background: rgba(255, 255, 255, .14); box-shadow: inset 3px 0 0 var(--accent); }

/* Top bar (glass) */
.admin-topbar {
    position: sticky; top: 0; z-index: 1020; min-height: 70px;
    background: rgba(255, 255, 255, .8); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--line);
}
.admin-topbar h1 { font-size: 1.2rem; margin: 0; }
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .3rem .8rem .3rem .3rem; border-radius: 999px; background: var(--brand-soft); font-weight: 600; font-size: .88rem; }
.user-chip span.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; }

.admin-content { padding: 28px; }

/* Cards */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-header h5 { margin: 0; font-size: 1.02rem; }
.panel-header small { color: var(--muted); }
.panel-body { padding: 22px; }

.stat-tile { display: flex; align-items: center; gap: 1rem; padding: 18px 20px; }
.stat-tile .icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-size: 1.25rem; }
.stat-tile .num { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-tile small { color: var(--muted); }

/* Forms */
.form-label { font-weight: 600; font-size: .88rem; }
.form-control, .form-select { border-radius: 10px; border-color: #d6e0da; padding: .62rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 128, 61, .12); }
.form-text { font-size: .8rem; }
.ck-editor__editable { min-height: 200px; }
.current-image { max-width: 100%; max-height: 180px; border-radius: 12px; object-fit: cover; }

/* Tables */
.table { margin: 0; vertical-align: middle; }
.table thead th { background: #f7faf8; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; }
.table td, .table th { padding: .85rem 1rem; }
.table .thumb { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; }
.table .thumb.contain { object-fit: contain; background: #f7faf8; padding: 4px; }
.table .excerpt { max-width: 320px; color: var(--muted); font-size: .9rem; }

.empty-row { text-align: center; padding: 40px 16px !important; color: var(--muted); }
.empty-row i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #a7bbb0; }

.toast-container { z-index: 1090; }
.toast { border: 0; border-radius: 12px; }

/* Login page */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: linear-gradient(120deg, rgba(8, 40, 23, .88), rgba(3, 90, 125, .6)), url('../../img/cms.jpg') center / cover no-repeat;
}
.login-card {
    width: 100%; max-width: 440px; padding: 40px; border-radius: 24px; color: #fff;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
    backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 30px 60px rgba(0, 0, 0, .25);
}
.login-card h1 { color: #fff; font-size: 1.6rem; }
.login-card p { color: rgba(255, 255, 255, .8); }
.login-card .form-label { color: #fff; }
.login-card .form-control { background: rgba(255, 255, 255, .92); border: 0; padding: .8rem 1rem; }
.login-card .input-group-text { background: rgba(255, 255, 255, .92); border: 0; color: var(--brand); }
.login-card img { width: 64px; height: 64px; background: #fff; border-radius: 16px; padding: 4px; }

@media (max-width: 767.98px) {
    .admin-content { padding: 18px 14px; }
    .login-card { padding: 28px 22px; }
    .table td, .table th { padding: .7rem .75rem; }
}

/* Toast messages (shared partials/flash.php) */
.toast { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .95); box-shadow: 0 24px 50px -24px rgba(17, 36, 26, .4); }
.toast .toast-body { color: var(--ink); font-weight: 500; padding: 14px 16px; }
.toast .toast-icon { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--brand-soft); color: var(--brand); }
.toast-danger .toast-icon { background: #fbeceb; color: #c8463d; }
