/* =========================================================================
   TNP News - newsroom admin shell
   Layered on top of Bootstrap 5; only the chrome and a few components.
   ========================================================================= */

:root {
    --sidebar-w: 250px;
    --topbar-h: 60px;
    --ink: #0f172a;
    --ink-soft: #64748b;
    --line: #e2e8f0;
    --surface: #f6f7f9;
    --brand: #a31d20;
    --brand-dark: #7d1517;
    --side-bg: #14181f;
    --side-ink: #aab4c4;
    --side-ink-active: #ffffff;
}

body {
    background: var(--surface);
    color: var(--ink);
    font-size: 0.925rem;
}

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

/* ---------------------------------------------------------------- sidebar */

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--side-bg);
    color: var(--side-ink);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .02em;
}

.brand-text strong {
    display: block;
    color: #fff;
    font-size: .95rem;
    line-height: 1.15;
}

.brand-text small {
    color: var(--side-ink);
    font-size: .72rem;
}

.sidebar-nav {
    padding: .6rem 0 1rem;
    flex: 1 1 auto;
}

.nav-heading {
    padding: 1rem 1.25rem .35rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #5c6879;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .58rem 1.25rem;
    color: var(--side-ink);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}

.sidebar .nav-item i {
    font-size: 1.05rem;
    width: 1.15rem;
    text-align: center;
}

.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.sidebar .nav-item.active {
    background: rgba(163, 29, 32, .18);
    border-left-color: var(--brand);
    color: var(--side-ink-active);
    font-weight: 500;
}

.sidebar-foot {
    padding: .85rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .8rem;
}

.sidebar-foot a {
    color: #7c8798;
    text-decoration: none;
}

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

/* ------------------------------------------------------------- main column */

.main {
    flex: 1 1 auto;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: .55rem;
    border: 1px solid var(--line);
    background: #fff;
    padding: .28rem .6rem .28rem .32rem;
    border-radius: 999px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-initials {
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
}

.profile-meta {
    line-height: 1.1;
    text-align: left;
}

.profile-name {
    display: block;
    font-size: .84rem;
    font-weight: 600;
}

.profile-role {
    display: block;
    font-size: .7rem;
    color: var(--ink-soft);
}

.content {
    padding: 1.35rem 1.5rem 3rem;
    flex: 1 1 auto;
}

/* ------------------------------------------------------------- components */

.card {
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: .85rem 1.1rem;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.page-head .lead-text {
    color: var(--ink-soft);
    font-size: .875rem;
    margin: .15rem 0 0;
}

.page-head .actions {
    margin-left: auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* stat tiles */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .9rem;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.15rem;
    flex: 0 0 42px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.1;
}

.stat-label {
    font-size: .78rem;
    color: var(--ink-soft);
}

.tint-red    { background: #fdecec; color: #b42318; }
.tint-blue   { background: #e8f1fd; color: #1553a5; }
.tint-green  { background: #e7f6ec; color: #1a7f3d; }
.tint-amber  { background: #fdf3e2; color: #a55b09; }
.tint-purple { background: #f0ebfd; color: #5a34b8; }

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

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: .65rem .75rem;
    vertical-align: middle;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    white-space: nowrap;
}

.table td .row-title {
    font-weight: 550;
    display: block;
}

.table td .row-sub {
    font-size: .78rem;
    color: var(--ink-soft);
}

.thumb {
    width: 54px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: #eef1f5;
}

.thumb-empty {
    display: grid;
    place-items: center;
    color: #b6bfcc;
}

/* filter bar */
.filter-bar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}

/* forms */
.form-label {
    font-weight: 550;
    font-size: .82rem;
    margin-bottom: .3rem;
}

.form-hint {
    font-size: .78rem;
    color: var(--ink-soft);
}

.section-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-soft);
    font-weight: 600;
    margin: 0 0 .85rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: .8rem 1.1rem;
    display: flex;
    gap: .5rem;
    align-items: center;
    border-radius: 0 0 12px 12px;
}

.preview-box img {
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid var(--line);
    margin-top: .5rem;
}

/* empty state */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
}

.empty-state i {
    font-size: 2.5rem;
    color: #c3cbd7;
    display: block;
    margin-bottom: .75rem;
}

.empty-state h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #14181f 0%, #2a1113 100%);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    padding: 2rem 1.9rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .3);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.4rem;
}

.login-brand .brand-mark {
    width: 48px;
    height: 48px;
    margin: 0 auto .7rem;
    font-size: .95rem;
}

.login-brand h1 {
    font-size: 1.15rem;
    font-weight: 650;
    margin: 0;
}

.login-brand p {
    color: var(--ink-soft);
    font-size: .84rem;
    margin: .15rem 0 0;
}

/* permission matrix */
.perm-group + .perm-group {
    margin-top: 1.25rem;
}

.perm-group h3 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
    margin-bottom: .5rem;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

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

    .main {
        margin-left: 0;
    }

    .content {
        padding: 1rem;
    }
}
