/* ==========================================================================
   CSS TAMBAHAN
   Bootstrap sudah mengurus sebagian besar tampilan. File ini hanya mengurus
   hal yang khas aplikasi kita: sidebar, topbar, dan penyesuaian kecil.
   ========================================================================== */

:root {
    --sidebar-width: 250px;
    --sidebar-bg: #16202c;
    --sidebar-bg-soft: #1f2c3c;
    --sidebar-text: #b9c6d6;
    --accent: #2f7dd1;
}

body {
    background: #f2f5f9;
    font-size: 0.925rem;
}

/* ---------- Kerangka: sidebar + area utama ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Bagian atas sidebar (logo + nama aplikasi) ---------- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    letter-spacing: 0.5px;
}

.brand-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ---------- Menu ---------- */
.sidebar-nav {
    padding: 12px 10px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.nav-group {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.45;
    padding: 14px 10px 6px;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: block;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-bg-soft);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ---------- Bagian bawah sidebar (info user + tombol keluar) ---------- */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: var(--sidebar-bg-soft);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.user-info {
    min-width: 0;
}

.user-name {
    color: #fff;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    opacity: 0.55;
    text-transform: capitalize;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 7px;
    border-radius: 8px;
    color: var(--sidebar-text);
    background: var(--sidebar-bg-soft);
    text-decoration: none;
    font-size: 0.85rem;
}

.btn-logout:hover {
    background: #7a2b2b;
    color: #fff;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: #fff;
    border-bottom: 1px solid #e3e8ef;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.content {
    padding: 22px;
    flex: 1 1 auto;
}

.app-footer {
    padding: 14px 22px;
    font-size: 0.8rem;
    color: #8b98a8;
    border-top: 1px solid #e3e8ef;
    background: #fff;
}

/* ---------- Kartu statistik di dashboard ---------- */
.stat-card {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    padding: 16px 18px;
    height: 100%;
}

.stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b98a8;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.2;
    color: #16202c;
}

.stat-link {
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
}

/* ---------- Kartu panel (form & tabel) ---------- */
.panel {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-bottom: 1px solid #e3e8ef;
    background: #fbfcfe;
}

.panel-head h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.panel-body {
    padding: 18px;
}

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

/* ---------- Tabel ---------- */
.table-app {
    margin: 0;
    font-size: 0.875rem;
}

.table-app thead th {
    background: #f7f9fc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5b6b7d;
    white-space: nowrap;
    border-bottom: 1px solid #e3e8ef;
}

.table-app td,
.table-app th {
    padding: 10px 14px;
    vertical-align: middle;
}

.table-app tbody tr:hover {
    background: #f9fbfe;
}

/* ---------- Label kecil di bawah input ---------- */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3f4c5c;
    margin-bottom: 4px;
}

.form-control,
.form-select {
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(47, 125, 209, 0.15);
}

/* ---------- Halaman login ---------- */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #16202c 0%, #24405e 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    padding: 28px;
}

/* ---------- Overlay sidebar untuk layar HP ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 20;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

    .sidebar-open .sidebar-overlay {
        display: block;
    }

    .content {
        padding: 16px;
    }
}
