/* =============================================================================
   BPDLH LOS — Design System
   Framework: Bootstrap 5.3 + custom tokens
   Font: Plus Jakarta Sans
   =============================================================================

   INDEX
   1.  Design Tokens
   2.  Typography utilities
   3.  Color utilities
   4.  Component: Page Header
   5.  Component: Section Card
   6.  Component: Data Field
   7.  Component: Status Badge
   8.  Component: Empty State
   9.  Component: Progress Tracker
   10. Component: Form Section
   11. Component: Sidebar
   12. Alert overrides
   13. Table tweaks
   14. Misc helpers
   ============================================================================= */

/* ── 1. Design Tokens ─────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --los-green:         #1a6b3c;
    --los-green-light:   #2d9e5f;
    --los-green-dark:    #0f4526;
    --los-green-bg:      #e8f5ee;
    --los-gold:          #c8972e;
    --los-gold-light:    #e8b94a;

    /* Spacing */
    --los-page-px:       1rem;
    --los-page-px-md:    1.5rem;

    /* Sidebar */
    --sidebar-width:     260px;

    /* Shadow */
    --los-shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);

    /* Backwards compat */
    --bpdlh-green:       var(--los-green);
    --bpdlh-green-light: var(--los-green-light);
    --bpdlh-green-dark:  var(--los-green-dark);
    --bpdlh-gold:        var(--los-gold);
    --bpdlh-gold-light:  var(--los-gold-light);
}


/* ── 2. Typography utilities ──────────────────────────────────────────────── */
* { font-family: 'Plus Jakarta Sans', sans-serif; }

.los-title    { font-weight: 700; color: var(--los-green); line-height: 1.3; }
.los-subtitle { font-size: .85rem; color: #6c757d; line-height: 1.4; }

.los-label {
    font-size: .8125rem;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.los-section-title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--los-green);
    border-bottom: 2px solid var(--los-green-bg);
    padding-bottom: .5rem;
    margin-bottom: 1rem;
}


/* ── 3. Color utilities ───────────────────────────────────────────────────── */
.text-los-primary   { color: var(--los-green) !important; }
.text-los-gold      { color: var(--los-gold) !important; }
.bg-los-primary     { background-color: var(--los-green) !important; }
.bg-los-primary-bg  { background-color: var(--los-green-bg) !important; }
.border-los-primary { border-color: var(--los-green) !important; }
.border-los-accent  { border-left: 4px solid var(--los-green) !important; }


/* ── 4. Component: Page Header ────────────────────────────────────────────── */
.los-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.los-page-header__title   { margin: 0; }
.los-page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; flex-shrink: 0; }


/* ── 5. Component: Section Card ───────────────────────────────────────────── */
.los-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    box-shadow: var(--los-shadow);
    margin-bottom: 1.25rem;
}

.los-card__header {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    font-size: .9375rem;
    color: #1e293b;
}

.los-card__header-icon { color: var(--los-green); font-size: 1rem; }

.los-card__header--collapsible { cursor: pointer; }
.los-card__header--collapsible:hover { background-color: #f8fafc; }

.los-card__chevron { transition: transform .2s ease; }
.los-card__header--collapsible[aria-expanded="true"] .los-card__chevron { transform: rotate(180deg); }

.los-card__body   { padding: 1.25rem; }

.los-card__footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    border-radius: 0 0 .5rem .5rem;
}


/* ── 6. Component: Data Field ─────────────────────────────────────────────── */
.los-data-row {
    display: flex;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .9rem;
}

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

.los-data-row__label {
    flex: 0 0 38%;
    max-width: 38%;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-right: .5rem;
    padding-top: .1rem;
}

.los-data-row__value { flex: 1; font-weight: 600; font-size: 0.9rem; color: #1e293b; word-break: break-word; }

/* 2-column grid for dense data */
.los-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
}

@media (max-width: 576px) {
    .los-data-row__label { flex: 0 0 45%; max-width: 45%; }
    .los-data-grid        { grid-template-columns: 1fr; }
}


/* ── 7. Component: Status Badge ───────────────────────────────────────────── */
/* Pill-style, softer than Bootstrap's solid badges */
.los-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* One class per status value */
.los-badge--draft              { background: #f1f5f9; color: #475569; }
.los-badge--da_pl              { background: #dbeafe; color: #1d4ed8; }
.los-badge--waiting_da_penelaah{ background: #fef9c3; color: #92400e; }
.los-badge--waiting_approval_da{ background: #fff7ed; color: #c2410c; }
.los-badge--fa                 { background: #ede9fe; color: #6d28d9; }
.los-badge--waiting_review_fa  { background: #ecfdf5; color: #065f46; }
.los-badge--waiting_keputusan  { background: var(--los-green-bg); color: var(--los-green-dark); }
.los-badge--approved           { background: #dcfce7; color: #15803d; }
.los-badge--rejected           { background: #fee2e2; color: #b91c1c; }
.los-badge--aktif              { background: #dcfce7; color: #15803d; }
.los-badge--lunas              { background: #f0fdf4; color: #166534; }
.los-badge--macet              { background: #fff1f2; color: #be123c; }

/* Legacy status support (ApplicationStatus enum) */
.los-badge--submitted       { background: #dbeafe; color: #1d4ed8; }
.los-badge--fa_pending      { background: #fef9c3; color: #92400e; }
.los-badge--fa_inprogress   { background: #fff7ed; color: #c2410c; }
.los-badge--fa_submitted    { background: #ede9fe; color: #6d28d9; }
.los-badge--da_review       { background: #ecfdf5; color: #065f46; }
.los-badge--verifikasi_final{ background: var(--los-green-bg); color: var(--los-green-dark); }
.los-badge--signature       { background: var(--los-green-bg); color: var(--los-green-dark); }
.los-badge--disetujui       { background: #dcfce7; color: #15803d; }
.los-badge--bersyarat       { background: #ecfdf5; color: #065f46; }
.los-badge--ditolak         { background: #fee2e2; color: #b91c1c; }


/* ── 8. Component: Empty State ────────────────────────────────────────────── */
.los-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1.5rem;
    text-align: center;
}

.los-empty__icon  { font-size: 2.75rem; color: #cbd5e1; margin-bottom: .875rem; }
.los-empty__title { font-weight: 600; color: #475569; margin-bottom: .375rem; font-size: .9375rem; }
.los-empty__desc  { font-size: .875rem; color: #94a3b8; max-width: 28rem; line-height: 1.5; }


/* ── 9. Component: Progress Tracker ──────────────────────────────────────── */
.los-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: .875rem 0;
}

.los-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4%;
    right: 4%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
    transform: translateY(-50%);
    pointer-events: none;
}

.los-steps__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.los-steps__dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    transition: all .2s;
}

.los-steps__dot--done    { background: var(--los-green); color: #fff; }
.los-steps__dot--active  { background: var(--los-green); color: #fff; box-shadow: 0 0 0 4px var(--los-green-bg); }
.los-steps__dot--pending { background: #f1f5f9; color: #94a3b8; }

.los-steps__label {
    margin-top: .4rem;
    font-size: .7rem;
    text-align: center;
    line-height: 1.2;
    max-width: 60px;
}

.los-steps__label--done    { color: var(--los-green); font-weight: 600; }
.los-steps__label--active  { color: var(--los-green); font-weight: 700; }
.los-steps__label--pending { color: #94a3b8; }

@media (max-width: 576px) {
    .los-steps__label { display: none; }
    .los-steps__dot   { width: 26px; height: 26px; font-size: .7rem; }
}


/* ── 10. Component: Form Section ──────────────────────────────────────────── */
.los-form-section { margin-bottom: 1.75rem; }

.los-form-section__title {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--los-green);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-bottom: .5rem;
    margin-bottom: .875rem;
    border-bottom: 2px solid var(--los-green-bg);
}

.los-form-section__desc {
    font-size: .85rem;
    color: #64748b;
    margin-bottom: 1rem;
    margin-top: -.375rem;
}


/* ── 11. Sidebar ──────────────────────────────────────────────────────────── */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--los-green-dark);
    z-index: 1040;
    overflow-y: auto;
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand img          { height: 40px; }
.sidebar-brand-text         { font-size: .85rem; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand-sub          { font-size: .7rem; color: rgba(255,255,255,.6); }

.sidebar-nav { padding: .75rem 0; flex: 1; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem 1.5rem;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sidebar-nav-item:hover  { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.sidebar-nav-item .bi    { font-size: 1.1rem; opacity: .85; }

.sidebar-nav-divider { border-top: 1px solid rgba(255,255,255,.1); margin: .5rem 1rem; }
.sidebar-nav-label   { padding: .5rem 1.5rem .25rem; font-size: .7rem; font-weight: 700; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .06em; }

.main-content        { margin-left: var(--sidebar-width); min-height: 100vh; background: #f8fafc; }
.main-content__inner { padding: 1.5rem var(--los-page-px-md); }

@media (max-width: 992px) {
    #sidebar              { transform: translateX(-100%); }
    #sidebar.show         { transform: translateX(0); }
    .main-content         { margin-left: 0; }
    .main-content__inner  { padding: 1rem var(--los-page-px); }
}


/* ── 12. Alert overrides ──────────────────────────────────────────────────── */
.alert           { border: none; border-radius: .5rem; font-size: .9rem; }
.alert-success   { background: #dcfce7; color: #15803d; }
.alert-danger    { background: #fee2e2; color: #b91c1c; }
.alert-warning   { background: #fff7ed; color: #c2410c; }
.alert-info      { background: #dbeafe; color: #1d4ed8; }


/* ── 13. Table tweaks ─────────────────────────────────────────────────────── */
.table-los th {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    background: #fafafa;
}

.table-los td { vertical-align: middle; font-size: .9rem; }


/* ── 14. Misc helpers ─────────────────────────────────────────────────────── */
.los-back-btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: #64748b;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    padding: .375rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: .375rem;
    background: #fff;
    transition: all .15s;
}

.los-back-btn:hover { border-color: var(--los-green); color: var(--los-green); background: var(--los-green-bg); }

.los-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #94a3b8;
    font-size: .8rem;
    font-weight: 500;
    margin: 1rem 0;
}

.los-divider::before,
.los-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

.los-currency { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Small progress bar height (replaces style="height:8px") */
.los-progress-sm { height: 8px; }

/* Extra-small badge text (replaces style="font-size:10px") */
.los-badge-xs { font-size: 10px !important; }

/* Leaflet map container (replaces style="height:400px;border-radius:8px") */
.los-map-container { height: 400px; border-radius: 8px; }

/* A79 toggle column min-width (replaces style="min-width:50px") */
.los-switch-col { min-width: 50px; }
