/* =========================================================
   Admin Panel — Minimal Modern
   ========================================================= */

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

:root {
    --bg: #f5f4f1;
    --surface: #ffffff;
    --border: #e4e2dd;
    --accent: #1a1a1a;
    --muted: #888580;
    --danger: #c0392b;
    --success: #2e7d32;
    --sidebar-w: 240px;
    --radius: 8px;
    --font: "Inter", system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--accent);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden; /* no horizontal scroll at page level */
}

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

/* ── Auth / Login ─────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 48px;
    width: 100%;
    max-width: 400px;
}

.auth-card__logo {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 32px;
    display: block;
}

.auth-card__title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-card__sub {
    color: var(--muted);
    margin-bottom: 32px;
    font-size: 13px;
}

/* ── Form ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: 14px;
    font-family: var(--font);
    color: var(--accent);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        opacity 0.15s,
        background 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #fdf2f2;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ── Shell & Sidebar (legacy — kept for any residual use) ─── */
.shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar hidden by default in new layout — kept so old routes don't break */
.sidebar {
    display: none;
}
.main {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

/* ── Admin top header ────────────────────────────────────── */
.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 200;
}

.admin-header__brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.admin-header__brand-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    text-decoration: none;
}

.admin-header__brand-sub {
    font-size: 11px;
    color: var(--muted);
}

.admin-header__right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.admin-header__username {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.admin-header__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    text-decoration: none;
}

.admin-header__logout {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    padding: 5px 8px;
    border-radius: 6px;
    transition:
        color 0.12s,
        background 0.12s;
}

.admin-header__logout:hover {
    color: var(--danger);
    background: #fdf2f2;
}

.admin-header__hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--accent);
    border-radius: 6px;
    padding: 0;
    margin-left: auto;
}

.admin-header__hamburger:hover {
    background: var(--bg);
}

/* ── Sub-header navigation ───────────────────────────────── */
.admin-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    position: sticky;
    top: 54px;
    z-index: 190;
}

.admin-nav__list {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2px;
    margin: 0;
    padding: 0;
    height: 44px;
}

.admin-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 6px;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    transition:
        color 0.12s,
        background 0.12s;
    white-space: nowrap;
}

.admin-nav__link:hover,
.admin-nav__link.active {
    color: var(--accent);
    background: var(--bg);
}

.admin-nav__chevron {
    transition: transform 0.15s;
    flex-shrink: 0;
}

.admin-nav__has-dropdown {
    position: relative;
}

.admin-nav__has-dropdown.admin-nav__dropdown--open
    > .admin-nav__toggle
    .admin-nav__chevron {
    transform: rotate(180deg);
}

.admin-nav__has-dropdown.admin-nav__dropdown--open > .admin-nav__toggle {
    color: var(--accent);
    background: var(--bg);
}

.admin-nav__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 180px;
    padding: 6px;
    list-style: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 300;
}

.admin-nav__has-dropdown.admin-nav__dropdown--open > .admin-nav__dropdown {
    display: block;
}

.admin-nav__dropdown li a {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--muted);
    border-radius: 5px;
    text-decoration: none;
    transition:
        color 0.12s,
        background 0.12s;
}

.admin-nav__dropdown li a:hover,
.admin-nav__dropdown li a.active {
    color: var(--accent);
    background: var(--bg);
}

.admin-nav__badge {
    background: var(--danger);
    color: #fff;
    border-radius: 9999px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
}

/* ── Page wrapper (replaces .main) ──────────────────────── */
.admin-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 98px);
    min-width: 0;
    overflow-x: hidden;
}

.admin-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-topbar__title {
    font-size: 15px;
    font-weight: 600;
}

.admin-topbar__breadcrumb {
    font-size: 12px;
    color: var(--muted);
}

.admin-content {
    padding: 32px;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

/* ── Topbar (legacy for old pages that use .topbar) ──────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar__title {
    font-size: 15px;
    font-weight: 600;
}
.topbar__breadcrumb {
    font-size: 12px;
    color: var(--muted);
}
.topbar__menu-btn {
    display: none;
}
.content {
    padding: 32px;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 900px) {
    .admin-header {
        padding: 0 16px;
    }

    .admin-header__username {
        display: none;
    }
    .admin-header__brand-sub {
        display: none;
    }

    .admin-header__hamburger {
        display: flex;
        margin-left: auto;
    }

    .admin-header__right {
        gap: 8px;
        margin-left: 0;
    }

    /* Stack nav vertically on mobile — fixed overlay so it doesn't push content */
    .admin-nav {
        position: fixed;
        top: 54px;
        left: 0;
        right: 0;
        z-index: 195;
        max-height: calc(100vh - 54px);
        overflow-y: auto;
        padding: 0;
        display: none;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    }

    .admin-nav.admin-nav--open {
        display: block;
    }

    .admin-nav__list {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        padding: 8px 0;
        gap: 0;
    }

    .admin-nav__list > li {
        width: 100%;
    }

    .admin-nav__link {
        width: 100%;
        border-radius: 0;
        padding: 10px 20px;
    }

    /* Mobile dropdowns expand inline */
    .admin-nav__dropdown {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: var(--bg);
        padding: 0 0 4px 24px;
        min-width: unset;
    }

    .admin-nav__has-dropdown.admin-nav__dropdown--open > .admin-nav__dropdown {
        display: block;
    }

    .admin-nav__dropdown li a {
        padding: 8px 16px;
        border-radius: 0;
    }

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

    .admin-content {
        padding: 16px;
    }

    .content {
        padding: 16px;
    }
    .topbar {
        padding: 12px 16px;
    }

    /* Collapse 2-column form layouts */
    .admin-form-grid,
    .profile-grid {
        grid-template-columns: 1fr !important;
    }

    /* Collapse milestone year + title row */
    .milestone-entry .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    /* Force stat cards to stack on very small screens */
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Form layout: two-column (main + sidebar) ─────────────── */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.page-header__title {
    font-size: 20px;
    font-weight: 700;
}

.page-header__desc {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.page-header__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card__header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__title {
    font-size: 14px;
    font-weight: 600;
}

.card__body {
    padding: 24px;
}

/* ── Alert / flash ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border-color: #bbf7d0;
}

.alert-danger {
    background: #fdf2f2;
    color: var(--danger);
    border-color: #fecaca;
}

/* ── Detail rows ─────────────────────────────────────────── */
.detail-row {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row__label {
    width: 160px;
    flex-shrink: 0;
    color: var(--muted);
    font-weight: 500;
    padding-top: 1px;
}

.detail-row__value {
    flex: 1;
}

/* ── Milestones list ─────────────────────────────────────── */
.milestone-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.milestone-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg);
    border-radius: 6px;
    padding: 14px 16px;
}

.milestone-item__year {
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 2px;
    flex-shrink: 0;
}

.milestone-item__body {
}

.milestone-item__title {
    font-weight: 600;
    font-size: 13px;
}

.milestone-item__text {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Edit form milestones ────────────────────────────────── */
.milestone-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    padding-right: 44px;
    margin-bottom: 12px;
    position: relative;
}

.milestone-entry__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.12s;
    z-index: 10;
}

.milestone-entry__remove:hover {
    color: var(--danger);
}

.milestone-entry .form-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
}

/* ── Image preview ────────────────────────────────────────── */
.img-preview-wrap {
    position: relative;
    display: inline-block;
    margin-top: 8px;
}

.img-preview {
    display: block;
    width: 200px;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ── Dashboard welcome ───────────────────────────────────── */
.welcome-card {
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
}

.welcome-card__greeting {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}
.welcome-card__sub {
    font-size: 13px;
    opacity: 0.65;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-card__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}
.stat-card__value {
    font-size: 26px;
    font-weight: 700;
    margin-top: 6px;
}

/* ── Profile grid ────────────────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* ── Tables ──────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead tr {
    border-bottom: 1px solid var(--border);
}

.table th {
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg);
    text-align: left;
}

.table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: #fafaf8;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--accent);
}

/* ── Status badges ────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge--published {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.status-badge--draft {
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
}

/* ── Filter bar (berita index) ───────────────────────────── */
.berita-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Btn disabled ────────────────────────────────────────── */
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Responsive table wrapper ─────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
    min-width: 480px;
}

.table-responsive > .table th:first-child,
.table-responsive > .table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
}

.table-responsive > .table thead th:first-child {
    background: var(--bg);
    z-index: 3;
}

/* ── Table toolbar (search + export buttons) ──────────────── */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.table-toolbar .form-control {
    max-width: 280px;
    min-width: 160px;
    flex: 1;
}

.table-toolbar__actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
