:root {
    --red: #c8102e;
    --red-dark: #9c0b22;
    --ink: #14161c;
    --muted: #6b7280;
    --line: #e4e7ec;
    --bg: #f3f4f7;
    --white: #fff;
    --ok: #0f7b4f;
    --ok-bg: #e7f6ee;
    --err: #b42318;
    --err-bg: #fdeceb;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

h1, h2, h3 {
    font-family: "Archivo", "Inter", Arial, sans-serif;
    margin: 0;
}

button, input, select, textarea {
    font: inherit;
}

.admin-body {
    min-height: 100vh;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: #111318;
    color: #c7ccd6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 60;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px;
    border-bottom: 1px solid #232833;
    color: #fff;
    font-family: "Archivo", Arial, sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -.3px;
    text-transform: uppercase;
}

.admin-brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--red);
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    flex: 0 0 auto;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    gap: 3px;
    flex: 1;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    color: #b9c0cc;
}

.admin-nav a:hover {
    background: #1b1f27;
    color: #fff;
}

.admin-nav a.is-active {
    background: var(--red);
    color: #fff;
    font-weight: 600;
}

.admin-nav-icon {
    width: 18px;
    text-align: center;
    opacity: .9;
}

.admin-sidebar-foot {
    padding: 16px 20px 22px;
    border-top: 1px solid #232833;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
}

.admin-sidebar-foot a {
    color: #9aa1ad;
}

.admin-sidebar-foot a:hover {
    color: #fff;
}

/* Main */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-topbar h1 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.2px;
}

.admin-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.admin-burger span {
    display: block;
    width: 17px;
    height: 2px;
    margin-inline: auto;
    background: #222;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    font-weight: 600;
}

.admin-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #111318;
    color: #fff;
    font-family: "Archivo", Arial, sans-serif;
    font-weight: 800;
}

.admin-content {
    padding: 26px 28px 46px;
    flex: 1;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 7px;
    font-size: 13px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--ok-bg);
    color: var(--ok);
    border-color: #bfe6d2;
}

.alert-error {
    background: var(--err-bg);
    color: var(--err);
    border-color: #f5c6c1;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 17px 18px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--red);
}

.stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-value {
    font-family: "Archivo", Arial, sans-serif;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.1;
}

.stat-sub {
    display: block;
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--muted);
}

/* Panels */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    margin-bottom: 22px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    font-size: 15px;
    font-weight: 800;
}

.panel-body {
    padding: 18px;
}

.panel-body.p-0 {
    padding: 0;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.toolbar .spacer {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-red {
    background: var(--red);
    color: #fff;
}

.btn-red:hover {
    background: var(--red-dark);
}

.btn-dark {
    background: #111318;
    color: #fff;
}

.btn-dark:hover {
    background: #000;
}

.btn-outline {
    background: #fff;
    border-color: var(--line);
    color: #303644;
}

.btn-outline:hover {
    border-color: var(--red);
    color: var(--red);
}

.btn-danger {
    background: #fdeceb;
    border-color: #f5c6c1;
    color: var(--err);
}

.btn-danger:hover {
    background: var(--err);
    border-color: var(--err);
    color: #fff;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 11.5px;
    border-radius: 5px;
}

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

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.admin-table th {
    text-align: left;
    padding: 11px 14px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #6b7280;
    white-space: nowrap;
}

.admin-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef0f4;
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background: #fafbfc;
}

.table-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
}

.table-thumb {
    width: 54px;
    height: 38px;
    border-radius: 5px;
    object-fit: cover;
    background: var(--bg);
    flex: 0 0 auto;
}

.table-title strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    max-width: 380px;
}

.table-title span {
    display: block;
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 2px;
}

.badge-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.badge-published {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge-draft {
    background: #f1f2f5;
    color: #5b6270;
}

.badge-featured {
    background: #fff4e5;
    color: #b45309;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    align-items: start;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #4b5260;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d9dde4;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-size: 13.5px;
    outline: none;
}

.form-control:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, .1);
}

textarea.form-control {
    resize: vertical;
    min-height: 150px;
    line-height: 1.65;
}

.form-control-lg {
    min-height: 260px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: #303644;
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
}

.image-preview {
    border: 1px dashed #cfd4dd;
    border-radius: 8px;
    padding: 8px;
    background: #fafbfc;
    margin-bottom: 10px;
}

.image-preview img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 5px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 5px;
}

.required {
    color: var(--red);
}

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(200, 16, 46, .35), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(200, 16, 46, .22), transparent 40%),
        #0c0e13;
}

.login-card {
    width: min(100%, 410px);
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-family: "Archivo", Arial, sans-serif;
    font-weight: 900;
    font-size: 23px;
    text-transform: uppercase;
    letter-spacing: -.5px;
}

.login-brand .admin-brand-mark {
    background: var(--red);
}

.login-sub {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 12.5px;
}

.login-card .btn {
    width: 100%;
    margin-top: 6px;
    padding: 11px;
}

.login-back {
    display: block;
    margin-top: 18px;
    text-align: center;
    font-size: 11.5px;
    color: var(--muted);
}

.login-back:hover {
    color: var(--red);
}

/* Misc */
.muted {
    color: var(--muted);
}

.small {
    font-size: 11.5px;
}

.list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 6px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    background: #fff;
}

.page-link:hover {
    border-color: var(--red);
    color: var(--red);
}

.page-link.is-active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1080px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-burger {
        display: flex;
    }

    .admin-topbar {
        padding: 12px 18px;
    }

    .admin-content {
        padding: 20px 18px 40px;
    }
}

@media (max-width: 620px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .admin-user-name {
        display: none;
    }

    .toolbar .spacer {
        display: none;
    }
}
