
/* =========================================
   LAYOUT UTAMA UPTAJ
   ========================================= */

:root {
    --brand: #0d6efd;
    --navy: #103d7a;
    --ink: #172033;
    --muted: #7a8494;
    --page-bg: #f3f6fa;
    --sidebar-width: 220px;
    --header-height: 60px;
    --sidebar-mobile: 70px;
    --header-mobile: 56px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--page-bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

/* =========================================
   SIDEBAR
   ========================================= */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1040;

    display: flex;
    flex-direction: column;

    background: #fff;
    border-right: 1px solid #e5eaf1;
    box-shadow: 4px 0 22px rgba(15, 23, 42, .04);

    overflow-x: hidden;
    overflow-y: auto;
}

.app-sidebar-brand {
    min-height: 86px;
    padding: 22px 18px;

    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;

    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #084298);
}

.app-sidebar-brand .brand-mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;
    background: #ffffff26;
    font-size: 22px;
}

.app-sidebar-brand .brand-text {
    min-width: 0;
}

.app-sidebar-brand strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
}

.app-sidebar-brand small {
    display: block;
    margin-top: 3px;
    color: #dceaff;
    font-size: 11px;
}

.app-nav-label {
    padding: 22px 20px 8px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-nav {
    display: grid;
    gap: 5px;
    padding: 0 12px;
}

.app-nav a {
    min-height: 44px;
    padding: 12px 13px;

    display: flex;
    align-items: center;
    gap: 12px;

    border-radius: 10px;
    color: #526078;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: .18s;
}

.app-nav a i {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-size: 18px;
}

.app-nav a:hover {
    background: #f1f6ff;
    color: var(--brand);
}

.app-nav a.active {
    background: linear-gradient(90deg, #e8f1ff, #f3f7ff);
    color: var(--brand);
    box-shadow: inset 3px 0 var(--brand);
}

.app-sidebar-bottom {
    margin-top: auto;
    padding: 15px 17px;
    border-top: 1px solid #edf0f4;
    color: #8a94a6;
    font-size: 10px;
    line-height: 1.6;
    flex-shrink: 0;
}

/* =========================================
   HEADER
   ========================================= */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;

    flex: 0 0 var(--header-height);
    width: calc(100% - var(--sidebar-width));
    height: var(--header-height);
    min-height: var(--header-height);

    margin: 0 0 0 var(--sidebar-width);
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    background: linear-gradient(110deg, #0d6efd, #084298);
    color: #fff;
    box-shadow: 0 4px 18px rgba(13, 110, 253, .15);
}

.app-topbar-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.app-topbar-title i {
    flex-shrink: 0;
}

.app-topbar-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 6px 10px;
    border: 1px solid #ffffff38;
    border-radius: 20px;

    background: #ffffff18;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

/* =========================================
   KONTEN UTAMA
   ========================================= */

.app-content {
    flex: 1 0 auto;

    display: block;
    width: calc(100% - var(--sidebar-width));
    min-width: 0;

    margin: 0 0 0 var(--sidebar-width);
    padding: 0;

    background: var(--page-bg);
}

/* Dashboard menggunakan dashboard-wrap */
.dashboard-wrap {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 24px 22px 32px;
}

/* Halaman yang menggunakan main-container */
.main-container {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 20px 18px 28px;
}

/* =========================================
   KARTU DAN TABEL
   ========================================= */

.table-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 14px;
    box-shadow: 0 5px 22px rgba(15, 23, 42, .035);
}

.table-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #edf0f4;
}

.table-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.table-subtitle {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    color: var(--ink);
    font-size: 12px;
}

.data-table th {
    padding: 12px 10px;
    background: #f7f9fc;
    color: #526078;
    border-bottom: 1px solid #e5eaf1;
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #edf0f4;
    font-size: 12px;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.form-control,
.form-select {
    max-width: 100%;
    border-color: #dfe5ee;
    border-radius: 8px;
}

.btn {
    border-radius: 8px;
}

/* =========================================
   FOOTER
   ========================================= */

.app-footer {
    flex: 0 0 auto;

    width: calc(100% - var(--sidebar-width));
    margin: 0 0 0 var(--sidebar-width);
    padding: 15px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;

    background: var(--navy);
    color: #eaf2ff;
    font-size: 11px;
    line-height: 1.6;
}

.app-footer > div {
    min-width: 0;
}

/* =========================================
   MODAL BOOTSTRAP
   ========================================= */

.modal {
    z-index: 1060;
}

.modal-backdrop {
    z-index: 1050;
}

/* =========================================
   TAMPILAN TABLET DAN HP
   ========================================= */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 70px;
        --header-height: 56px;
    }

    .app-sidebar {
        width: var(--sidebar-width);
    }

    .app-sidebar-brand {
        min-height: 66px;
        padding: 12px 10px;
        justify-content: center;
    }

    .app-sidebar-brand .brand-mark {
        width: 40px;
        height: 40px;
    }

    .app-sidebar-brand .brand-text,
    .app-nav-label,
    .app-nav a span,
    .app-sidebar-bottom {
        display: none;
    }

    .app-nav {
        padding: 12px 8px;
    }

    .app-nav a {
        justify-content: center;
        padding: 12px 4px;
    }

    .app-nav a i {
        width: auto;
        font-size: 20px;
    }

    .app-topbar {
        width: calc(100% - var(--sidebar-width));
        height: var(--header-height);
        min-height: var(--header-height);
        flex-basis: var(--header-height);
        margin-left: var(--sidebar-width);
        padding: 0 12px;
        gap: 8px;
    }

    .app-topbar-title {
        gap: 6px;
        font-size: 12px;
    }

    .app-topbar-status {
        padding: 5px 7px;
        font-size: 9px;
    }

    .app-content {
        width: calc(100% - var(--sidebar-width));
        margin-left: var(--sidebar-width);
    }

    .dashboard-wrap {
        padding: 14px 10px 24px;
    }

    .main-container {
        padding: 12px 8px 20px;
    }

    .table-header {
        padding: 13px 12px;
    }

    .data-table th {
        padding: 10px 8px;
        font-size: 10px;
    }

    .data-table td {
        padding: 9px 8px;
        font-size: 11px;
    }

    .app-footer {
        width: calc(100% - var(--sidebar-width));
        margin-left: var(--sidebar-width);
        padding: 12px;
        gap: 6px;
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .app-topbar {
        padding: 0 8px;
    }

    .app-topbar-title {
        font-size: 11px;
    }

    .app-topbar-status {
        padding: 4px 6px;
        font-size: 8px;
    }

    .dashboard-wrap {
        padding: 10px 6px 18px;
    }

    .main-container {
        padding: 8px 5px 16px;
    }

    .app-footer {
        padding: 10px 8px;
    }
}
