/* ================================================================
   PMB STAI – Mobile-App Design System
   Dark / Light mode  |  Responsive sidebar  |  Bottom nav
   ================================================================ */

/* ----------------------------------------------------------------
   1.  CSS CUSTOM PROPERTIES (THEMES)
   ---------------------------------------------------------------- */
:root {
    --c-primary:   #1a5276;
    --c-secondary: #2980b9;
    --c-accent:    #f39c12;
    --c-success:   #27ae60;
    --c-danger:    #e74c3c;
    --c-warning:   #f39c12;

    /* Light theme */
    --bg-body:     #f0f4f8;
    --bg-surface:  #ffffff;
    --bg-surface2: #f8fafc;
    --bg-sidebar:  linear-gradient(170deg, #0a1929 0%, #0d2137 40%, #1a3a52 100%);
    --bg-topbar:   #ffffff;
    --border:      #e5eaf0;
    --text:        #1a2332;
    --text-sub:    #5a6988;
    --text-muted:  #9aaabf;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.05), 0 4px 18px rgba(0,0,0,0.07);
    --shadow-top:  0 2px 12px rgba(0,0,0,0.06);
    --input-bg:    #f8fafc;
}

[data-theme="dark"] {
    --bg-body:     #0d1520;
    --bg-surface:  #162030;
    --bg-surface2: #1c2a3e;
    --bg-sidebar:  linear-gradient(170deg, #050c14 0%, #080f1c 40%, #0d1929 100%);
    --bg-topbar:   #162030;
    --border:      #233044;
    --text:        #dce8f4;
    --text-sub:    #7a9ab8;
    --text-muted:  #4a6580;
    --shadow-card: 0 2px 6px rgba(0,0,0,0.25), 0 6px 22px rgba(0,0,0,0.3);
    --shadow-top:  0 2px 12px rgba(0,0,0,0.35);
    --input-bg:    #1c2a3e;
    --c-primary:   #2980b9;
    --c-secondary: #3ea6e6;
}

/* ----------------------------------------------------------------
   2.  BASE RESET
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-body);
    color: var(--text);
    margin: 0; padding: 0;
    transition: background-color .25s, color .25s;
    -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------------
   3.  APP LAYOUT (SIDEBAR + MAIN)
   ---------------------------------------------------------------- */
.app-wrap { display: flex; min-block-size: 100vh; }

.app-sidebar {
    inline-size: 260px;
    block-size: 100vh;
    background: var(--bg-sidebar);
    position: fixed;
    inset-block-start: 0; inset-inline-start: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.app-sidebar::-webkit-scrollbar            { inline-size: 4px; }
.app-sidebar::-webkit-scrollbar-thumb      { background: rgba(255,255,255,.12); border-radius: 4px; }

.app-main {
    margin-inline-start: 260px;
    flex: 1;
    min-block-size: 100vh;
    transition: margin-left .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

/* ----------------------------------------------------------------
   4.  SIDEBAR COMPONENTS
   ---------------------------------------------------------------- */

/* Brand */
.sb-brand {
    padding: 20px 18px 16px;
    border-block-end: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}
.sb-brand-icon {
    inline-size: 42px; block-size: 42px;
    border-radius: 12px;
    background: rgba(243,156,18,.15);
    border: 1.5px solid rgba(243,156,18,.35);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #f39c12;
    font-size: 1.15rem;
}
.sb-brand-name  { color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.25; }
.sb-brand-sub   { color: rgba(255,255,255,.4); font-size: .68rem; }

/* User mini-profile */
.sb-user {
    padding: 12px 18px;
    border-block-end: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.sb-avatar {
    inline-size: 38px; block-size: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-secondary), var(--c-primary));
    border: 2px solid rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .88rem;
    flex-shrink: 0;
}
.sb-user-name  { color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role  { color: rgba(255,255,255,.4); font-size: .65rem; }

/* Nav */
.sb-nav       { flex: 1; padding: 6px 0 8px; }
.sb-nav-label {
    color: rgba(255,255,255,.25);
    font-size: .62rem; font-weight: 700; letter-spacing: 1.4px;
    text-transform: uppercase;
    padding: 14px 18px 4px;
}

.sb-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px;
    color: rgba(255,255,255,.6);
    text-decoration: none !important;
    font-size: .84rem; font-weight: 500;
    border-inline-start: 3px solid transparent;
    transition: all .18s;
    position: relative;
}
.sb-link .sb-icon {
    inline-size: 32px; block-size: 32px; border-radius: 8px;
    background: rgba(255,255,255,.05);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; flex-shrink: 0;
    transition: all .18s;
}
.sb-link:hover               { color: #fff; background: rgba(255,255,255,.07); border-inline-start-color: rgba(243,156,18,.5); }
.sb-link:hover .sb-icon      { background: rgba(255,255,255,.12); }
.sb-link.active              { color: #fff; background: rgba(255,255,255,.1);  border-inline-start-color: var(--c-accent); }
.sb-link.active .sb-icon     { background: rgba(243,156,18,.22); color: var(--c-accent); }

.sb-badge {
    margin-inline-start: auto; background: var(--c-accent); color: #000;
    padding: 1px 7px; border-radius: 10px; font-size: .6rem; font-weight: 700;
}

/* Sidebar footer */
.sb-footer { padding: 12px 18px 18px; flex-shrink: 0; }
.sb-footer .sb-link { border-radius: 8px; }

/* ----------------------------------------------------------------
   5.  TOP BAR
   ---------------------------------------------------------------- */
.app-topbar {
    background: var(--bg-topbar);
    padding: 12px 24px;
    box-shadow: var(--shadow-top);
    border-block-end: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; inset-block-start: 0; z-index: 100;
    transition: background .25s, border-color .25s, box-shadow .25s;
    flex-shrink: 0;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-weight: 700; font-size: .98rem; color: var(--text); line-height: 1.2; }
.topbar-sub   { font-size: .72rem; color: var(--text-sub); }

/* Topbar icon buttons */
.tb-btn {
    inline-size: 36px; block-size: 36px; border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-surface2);
    color: var(--text-sub);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .88rem;
    transition: all .2s; text-decoration: none;
}
.tb-btn:hover { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.tb-btn:focus { outline: none; }
.tb-btn-sidebar { display: none; }

/* Topbar user chip */
.tb-user {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 5px;
    background: var(--bg-surface2);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: all .2s;
}
.tb-user:hover { border-color: var(--c-secondary); }
.tb-user-avatar {
    inline-size: 28px; block-size: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .75rem; flex-shrink: 0;
}
.tb-user-name { font-size: .78rem; font-weight: 600; color: var(--text); }

/* ----------------------------------------------------------------
   6.  PAGE CONTENT
   ---------------------------------------------------------------- */
.app-page { padding: 22px 24px; flex: 1; }

/* ----------------------------------------------------------------
   7.  CARDS
   ---------------------------------------------------------------- */
.app-card {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: background .25s, border-color .25s, box-shadow .25s;
}
.app-card-hd {
    padding: 15px 20px;
    border-block-end: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.app-card-hd-title { font-weight: 700; font-size: .88rem; color: var(--text); margin: 0; }
.app-card-bd { padding: 20px; }

/* Bootstrap .card dark mode fix */
[data-theme="dark"] .card {
    background: var(--bg-surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
[data-theme="dark"] .card-header {
    background: var(--bg-surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
[data-theme="dark"] .card-body { color: var(--text) !important; }

/* ----------------------------------------------------------------
   8.  STAT CARDS
   ---------------------------------------------------------------- */
.stat-card {
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    transition: transform .2s, box-shadow .2s, background .25s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.14); }
.stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: .72rem; color: var(--text-sub); margin-block-start: 4px; }
.stat-icon {
    inline-size: 46px; block-size: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}

/* ----------------------------------------------------------------
   9.  FORMS (dark mode compatible)
   ---------------------------------------------------------------- */
.form-control, .form-select {
    background: var(--input-bg) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .9rem;
    transition: border-color .2s, background .25s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--c-secondary) !important;
    box-shadow: 0 0 0 3px rgba(41,128,185,.12) !important;
    background: var(--bg-surface) !important;
    outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--text-sub); }
.input-group-text {
    background: var(--input-bg) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-sub) !important;
    transition: background .25s, border-color .25s;
}
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background: var(--bg-surface2) !important;
    color: var(--text-muted) !important;
}

/* ----------------------------------------------------------------
   10. BUTTONS
   ---------------------------------------------------------------- */
.btn-primary-app {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    border: none; color: #fff;
    border-radius: 10px; padding: 11px 22px;
    font-weight: 600; font-size: .88rem;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(41,128,185,.3);
}
.btn-primary-app:hover { filter: brightness(1.1); transform: translateY(-1px); color: #fff; }

/* Bootstrap btn dark overrides */
[data-theme="dark"] .btn-outline-secondary  { border-color: var(--border); color: var(--text-sub); }
[data-theme="dark"] .btn-outline-secondary:hover { background: var(--bg-surface2); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-light { background: var(--bg-surface2) !important; border-color: var(--border) !important; color: var(--text) !important; }

/* ----------------------------------------------------------------
   11. TABLE
   ---------------------------------------------------------------- */
[data-theme="dark"] .table {
    --bs-table-bg:          var(--bg-surface);
    --bs-table-color:       var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg:  var(--bg-surface2);
    --bs-table-hover-bg:    var(--bg-surface2);
}
[data-theme="dark"] .table th { color: var(--text-sub); }

/* ----------------------------------------------------------------
   12. ALERTS
   ---------------------------------------------------------------- */
[data-theme="dark"] .alert-success { background: #0b2218; border-color: #1a4d32; color: #52c27a; }
[data-theme="dark"] .alert-danger  { background: #250a0a; border-color: #5c2020; color: #e06060; }
[data-theme="dark"] .alert-warning { background: #241808; border-color: #5c4010; color: #d4a030; }
[data-theme="dark"] .alert-info    { background: #091624; border-color: #0e315c; color: #4090c4; }
[data-theme="dark"] .alert-primary { background: #091a2e; border-color: #124070; color: #4a9fdb; }

/* ----------------------------------------------------------------
   13. MODAL
   ---------------------------------------------------------------- */
[data-theme="dark"] .modal-content   { background: var(--bg-surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .modal-header    { border-color: var(--border); }
[data-theme="dark"] .modal-footer    { border-color: var(--border); }

/* ----------------------------------------------------------------
   14. DROPDOWN
   ---------------------------------------------------------------- */
[data-theme="dark"] .dropdown-menu     { background: var(--bg-surface); border-color: var(--border); }
[data-theme="dark"] .dropdown-item     { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover { background: var(--bg-surface2); }
[data-theme="dark"] .dropdown-divider  { border-color: var(--border); }

/* ----------------------------------------------------------------
   15. PROGRESS / BADGE / MISC
   ---------------------------------------------------------------- */
[data-theme="dark"] .progress                 { background: var(--bg-surface2); }
[data-theme="dark"] .text-muted               { color: var(--text-sub) !important; }
[data-theme="dark"] .border                   { border-color: var(--border) !important; }
[data-theme="dark"] .border-bottom            { border-color: var(--border) !important; }
[data-theme="dark"] .bg-light                 { background: var(--bg-surface2) !important; }
[data-theme="dark"] .bg-white                 { background: var(--bg-surface) !important; }
[data-theme="dark"] hr                        { border-color: var(--border); }
[data-theme="dark"] .list-group-item          { background: var(--bg-surface); border-color: var(--border); color: var(--text); }

/* ----------------------------------------------------------------
   16. THEME TOGGLE ICON SWITCH
   ---------------------------------------------------------------- */
.icon-sun  { display: none; }
.icon-moon { display: inline; }
[data-theme="dark"] .icon-sun  { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }

/* ----------------------------------------------------------------
   17. SIDEBAR OVERLAY (mobile)
   ---------------------------------------------------------------- */
.sb-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1039;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sb-overlay.show { display: block; }

/* ----------------------------------------------------------------
   18. BOTTOM NAV (mobile  ≤991px)
   ---------------------------------------------------------------- */
.bottom-nav {
    display: none;
    position: fixed; inset-block-end: 0; inset-inline-start: 0; inset-inline-end: 0;
    z-index: 1050;
    background: var(--bg-surface);
    border-block-start: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0,0,0,.1);
    padding-block-end: env(safe-area-inset-bottom);
    transition: background .25s, border-color .25s;
}
.bn-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 6px 4px 4px;
    text-decoration: none !important;
    color: var(--text-muted);
    font-size: .6rem; font-weight: 500; gap: 2px;
    transition: color .2s;
}
.bn-item .bni {
    inline-size: 36px; block-size: 28px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; transition: all .2s;
}
.bn-item.active { color: var(--c-secondary); }
.bn-item.active .bni { background: rgba(41,128,185,.13); color: var(--c-secondary); }

/* ----------------------------------------------------------------
   19. STEP TIMELINE (user dashboard / formulir)
   ---------------------------------------------------------------- */
.step-timeline { display: flex; flex-direction: column; gap: 0; }
.step-row { display: flex; align-items: flex-start; gap: 14px; position: relative; }
.step-col { display: flex; flex-direction: column; align-items: center; }
.step-circle {
    inline-size: 40px; block-size: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; flex-shrink: 0;
    position: relative; z-index: 1;
}
.step-circle.done    { background: #27ae60; color: #fff; }
.step-circle.active  { background: var(--c-accent); color: #fff; box-shadow: 0 0 0 4px rgba(243,156,18,.25); }
.step-circle.pending { background: var(--bg-surface2); color: var(--text-muted); border: 2px solid var(--border); }
.step-vline          { inline-size: 2px; flex: 1; min-block-size: 18px; background: var(--border); margin: 2px 0; }
.step-vline.done     { background: #27ae60; }
.step-info { padding-block-start: 9px; flex: 1; padding-block-end: 8px; }
.step-info-label { font-size: .84rem; font-weight: 600; color: var(--text); }
.step-info-label.done    { color: var(--c-success); }
.step-info-label.active  { color: var(--c-accent); }
.step-info-label.pending { color: var(--text-muted); }

/* ----------------------------------------------------------------
   20. RESPONSIVE
   ---------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar      { transform: translateX(-100%); padding-block-end: 80px; }
    .app-sidebar.open { transform: translateX(0); }
    .app-main         { margin-inline-start: 0 !important; }
    .bottom-nav       { display: flex; }
    .tb-btn-sidebar   { display: flex; }
    .app-page         { padding: 14px; padding-block-end: 76px; }
}

@media (max-width: 767.98px) {
    .app-topbar { padding: 10px 14px; }
    .topbar-title { font-size: .9rem; }
    .app-page { padding: 10px; padding-block-end: 76px; }
    .stat-value { font-size: 1.5rem; }
}

@media (max-width: 575.98px) {
    .app-page { padding: 8px; padding-block-end: 76px; }
}

/* ----------------------------------------------------------------
   21. AUTH PAGES (login / daftar)
   ---------------------------------------------------------------- */
.auth-wrap {
    min-block-size: 100vh;
    background: var(--bg-body);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    transition: background .25s;
}

/* Two-panel auth layout */
.auth-panel {
    inline-size: 100%; max-inline-size: 960px;
    display: flex; border-radius: 24px; overflow: hidden;
    box-shadow: 0 24px 72px rgba(0,0,0,.25);
}
.auth-panel-left {
    flex: 0 0 45%;
    background: linear-gradient(160deg, #0a1929 0%, #1a3a52 100%);
    padding: 48px 40px;
    display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-panel-left::before {
    content: '';
    position: absolute; inset-block-start: -80px; inset-inline-end: -80px;
    inline-size: 250px; block-size: 250px; border-radius: 50%;
    background: rgba(41,128,185,.15);
}
.auth-panel-left::after {
    content: '';
    position: absolute; inset-block-end: -60px; inset-inline-start: -60px;
    inline-size: 180px; block-size: 180px; border-radius: 50%;
    background: rgba(243,156,18,.1);
}
.auth-panel-right {
    flex: 1;
    background: var(--bg-surface);
    padding: 44px 40px;
    overflow-y: auto;
}

[data-theme="dark"] .auth-panel-left {
    background: linear-gradient(160deg, #050c14 0%, #0d1928 100%);
}

@media (max-width: 767.98px) {
    .auth-panel { flex-direction: column; max-inline-size: 460px; border-radius: 20px; }
    .auth-panel-left { flex: none; padding: 32px 28px; }
    .auth-panel-right { padding: 32px 24px; }
    .auth-panel-left::before, .auth-panel-left::after { display: none; }
}
@media (max-width: 480px) {
    .auth-panel { border-radius: 16px; }
    .auth-panel-right { padding: 24px 18px; }
}

/* ----------------------------------------------------------------
   22. BADGE OVERRIDES (dark theme)
   ---------------------------------------------------------------- */
[data-theme="dark"] .badge.bg-light  { background: var(--bg-surface2) !important; color: var(--text) !important; }
[data-theme="dark"] .badge.bg-secondary { background: #2a3a50 !important; }

/* ----------------------------------------------------------------
   23. SCROLLBAR (for webkit, subtle)
   ---------------------------------------------------------------- */
::-webkit-scrollbar       { inline-size: 6px; block-size: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,160,200,.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,160,200,.5); }
