/* ============================================================
   SINERGI — stylesheet bersama (responsive & adaptif)
   Mobile-first: HP 360px → tablet 768px → desktop 1280px+
   ============================================================ */
:root {
    --sinergi-primary: #1F4E79;
    --sinergi-primary-dark: #14405f;
    --sinergi-accent: #0E7C7B;
    --sinergi-bg: #F4F7FB;
    --sinergi-card-shadow: 0 1px 4px rgba(16, 42, 67, .08);
    --sinergi-radius: .9rem;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--sinergi-bg); }
img, table { max-width: 100%; }

/* ---------- Kartu & judul ---------- */
.card { border: none; box-shadow: var(--sinergi-card-shadow); border-radius: var(--sinergi-radius); overflow: hidden; }
.card-header { border-bottom: 1px solid rgba(16, 42, 67, .08); }
.page-title { font-weight: 700; letter-spacing: .2px; font-size: clamp(1.15rem, 2.5vw + .8rem, 1.5rem); }
.page-subtitle { color: #6c7a89; font-size: .9rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }

/* ---------- Sidebar admin → offcanvas di HP/tablet ---------- */
.sidebar { min-height: 100vh; background: linear-gradient(180deg, var(--sinergi-primary), var(--sinergi-primary-dark)); width: 250px; }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.3rem; letter-spacing: 1px; }
.sidebar .tagline { color: #9fc2e0; font-size: .72rem; }
.sidebar .nav-link { color: #cfe0ef; border-radius: .5rem; padding: .6rem .9rem; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--sinergi-primary); font-weight: 600; }
.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
    .app-shell { display: block !important; }
    .sidebar-toggle { display: inline-flex; align-items: center; gap: .45rem; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 1050;
        transform: translateX(-105%);
        transition: transform .25s ease;
        width: min(280px, 84vw);
        border-radius: 0 1rem 1rem 0;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 1040; background: rgba(15, 30, 45, .45);
        opacity: 0; pointer-events: none; transition: opacity .25s ease;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    body.sidebar-open { overflow: hidden; }
}

/* ---------- Area konten adaptif ---------- */
.content-wrap { padding: .9rem; }
@media (min-width: 576px) { .content-wrap { padding: 1.25rem; } }
@media (min-width: 992px) { .content-wrap { padding: 1.5rem; } }

/* Header halaman: tombol full-width di HP */
.page-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; justify-content: space-between; }
.page-actions { display: grid; gap: .5rem; width: 100%; }
.page-actions .btn { width: 100%; }
@media (min-width: 576px) {
    .page-actions { display: flex; width: auto; }
    .page-actions .btn { width: auto; }
}

/* ---------- Tabel ---------- */
.table-responsive { -webkit-overflow-scrolling: touch; }
.table thead th { white-space: nowrap; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table tbody td { vertical-align: top; }
.table .cell-actions { white-space: nowrap; text-align: right; }
.table .cell-actions .btn { min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; }
.table-merge { min-width: 640px; }

/* Sel merge: nilai ke-2 dst tampil sebagai baris visual lanjutan */
.merged-first { font-weight: 600; }
.merged-row {
    margin-top: .3rem; padding-top: .3rem;
    border-top: 1px dashed rgba(31, 78, 121, .28);
    padding-left: .65rem; position: relative; color: #33475c;
}
.merged-row::before {
    content: "↳"; position: absolute; left: 0; top: .28rem;
    color: var(--sinergi-accent); font-weight: 700; font-size: .8rem;
}
.merged-row .merged-tag {
    display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .04em;
    color: #5b6b7c; text-transform: uppercase; margin-right: .3rem;
}
.cell-ellipsis { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (min-width: 768px) { .cell-ellipsis { max-width: 320px; } }

/* ---------- Repeater nilai ganda ---------- */
.repeater-item .btn { min-height: 44px; min-width: 44px; }
.repeater-add { min-height: 44px; }
.repeater-count { font-size: .75rem; color: #6c7a89; }

/* ---------- Form adaptif ---------- */
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
.form-grid > .mb-3 { min-width: 0; }
@media (min-width: 768px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-grid .span-2 { grid-column: 1 / -1; }
}
.form-control, .form-select { min-height: 44px; }

/* ---------- Login & gerbang ---------- */
body.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #16466E 0%, #0E7C7B 100%);
    background-attachment: fixed;
}
.login-main {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1.75rem; padding: 2rem 1rem;
}
.auth-card {
    width: 100%; max-width: 540px;
    border-radius: 1.35rem;
    box-shadow: 0 24px 55px rgba(9, 40, 66, .35);
}
.auth-card .card-body { padding: 2.75rem 2.5rem; }
@media (max-width: 575.98px) { .auth-card .card-body { padding: 2rem 1.25rem; } }
.auth-hero {
    color: var(--sinergi-primary);
    font-size: clamp(1.9rem, 4vw + 1rem, 2.4rem);
    font-weight: 800; letter-spacing: 2px;
}
.auth-hero .auth-logo { font-size: .85em; margin-right: .55rem; position: relative; top: -2px; }
.auth-tagline { color: #6B7A8C; font-size: .95rem; margin-top: .35rem; }
.login-page .form-label { font-weight: 500; color: #33475B; margin-bottom: .45rem; }
.login-page .input-group-text { background: #F5F8FC; border-color: #D8E2EE; color: #41586F; }
.login-page .form-control { background: #F8FAFD; border-color: #D8E2EE; min-height: 48px; }
.login-page .form-control:focus {
    background: #EEF4FD; border-color: #9DC1F5;
    box-shadow: 0 0 0 .28rem rgba(66, 133, 244, .18);
}
.login-page .btn-primary {
    --bs-btn-bg: #0D6EFD; --bs-btn-border-color: #0D6EFD;
    --bs-btn-hover-bg: #0B5ED7; --bs-btn-hover-border-color: #0B5ED7;
    --bs-btn-active-bg: #0A58CA; --bs-btn-active-border-color: #0A58CA;
    border-radius: .55rem; font-size: 1.05rem; padding: .7rem 1rem;
    box-shadow: 0 8px 18px rgba(13, 110, 253, .28);
    transition: transform .15s ease, box-shadow .15s ease;
}
.login-page .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(13, 110, 253, .35); }
.login-page .alert { border-radius: .55rem; }
.login-foot { color: rgba(255, 255, 255, .8); font-size: .85rem; margin: 0; text-align: center; }
.gate-card { max-width: 560px; margin-inline: auto; }

/* ---------- Navbar publik ---------- */
.navbar-sinergi { background: linear-gradient(90deg, var(--sinergi-primary), var(--sinergi-accent)); }
.navbar-sinergi .cat-name { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal di layar kecil ---------- */
@media (max-width: 575.98px) {
    #confirmModal .modal-dialog, #flashModal .modal-dialog { margin: .6rem; }
}
