/* =========================================================
   Bank Sampah Manado — Global Stylesheet
   Clean • Aesthetic • Responsive (Bootstrap 5 overlay)
   ========================================================= */

/* ── Design tokens ── */
:root {
    --brand-900: #10351f;
    --brand-800: #154a2a;
    --brand-700: #1d6b3b;
    --brand-600: #238a4b;
    --brand-500: #2ea55f;
    --brand-400: #58c87f;
    --brand-300: #9bddb0;
    --brand-100: #e3f4e9;

    --ink-900: #1a2b21;
    --ink-700: #31453a;
    --ink-500: #5c6f64;
    --ink-300: #93a39a;

    --surface: #ffffff;
    --body-bg: #f3f6f3;
    --border-soft: #e5ebe6;
    --border-strong: #d5ded7;

    --accent-amber: #e8a13c;
    --accent-sky: #4aa3d8;
    --accent-earth: #a06a3c;
    --accent-coral: #e2604b;
    --accent-violet: #7c6bd6;

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-soft: 0 1px 2px rgba(16, 53, 31, .05), 0 8px 24px -12px rgba(16, 53, 31, .14);
    --shadow-card: 0 1px 2px rgba(16, 53, 31, .04), 0 4px 16px -8px rgba(16, 53, 31, .10);
    --shadow-pop: 0 20px 50px -12px rgba(16, 53, 31, .25);

    --sb-width: 268px;
    --topbar-h: 66px;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    color: var(--ink-700);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5, h6 { color: var(--ink-900); font-weight: 700; letter-spacing: -.01em; }

/* =========================================================
   App shell
   ========================================================= */
.app-shell { min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sb-width);
    background:
        radial-gradient(120% 60% at -10% 0%, rgba(46, 165, 95, .18) 0%, transparent 55%),
        linear-gradient(180deg, var(--brand-900) 0%, #0c2a18 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow: hidden;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    color: var(--brand-900);
    background: linear-gradient(135deg, var(--brand-300), var(--brand-500));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.brand-name { font-weight: 800; font-size: 1.02rem; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; color: var(--brand-300); letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }

/* Nav container — scrollable middle area */
.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: .6rem .85rem .9rem;
    display: block;
    width: 100%;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 4px; }

/* Section groups — subtle, no labels */
.sidebar-nav .nav-block { padding-top: .55rem; margin-top: .55rem; border-top: 1px solid rgba(255, 255, 255, .08); }

/* Nav items — full-width pills, forced vertical stack */
.sidebar-nav .nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: .65rem;
    padding: .5rem .75rem;
    margin: 0 0 2px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .72);
    font-size: .89rem;
    font-weight: 500;
    line-height: 1.3;
    transition: background .15s ease, color .15s ease;
    position: relative;
    white-space: nowrap;
}
.sidebar-nav > .nav-item { display: flex; }
.sidebar-nav .nav-item i {
    width: 1.25rem;
    text-align: center;
    font-size: 1.02rem;
    color: rgba(255, 255, 255, .55);
    flex: 0 0 1.25rem;
}
.sidebar-nav .nav-item:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar-nav .nav-item:hover i { color: #fff; }
.sidebar-nav .nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(46, 165, 95, .30), rgba(46, 165, 95, .10));
    box-shadow: inset 0 0 0 1px rgba(130, 220, 170, .20);
}
.sidebar-nav .nav-item.active i { color: var(--brand-300); }

.sidebar .sidebar-foot {
    margin-top: auto;
    padding: .85rem 1.25rem 1rem;
    font-size: .74rem;
    color: rgba(255, 255, 255, .38);
    border-top: 1px solid rgba(255, 255, 255, .07);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Offcanvas mobile sidebar — same look ── */
.sidebar-offcanvas .offcanvas-body { overflow: hidden; }
.sidebar-offcanvas .sidebar-nav { padding-bottom: .5rem; }

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 0 1.5rem;
}

.topbar .burger {
    border: none;
    background: transparent;
    color: var(--ink-700);
    font-size: 1.4rem;
    line-height: 1;
    padding: .2rem .35rem;
    border-radius: 8px;
    display: none;
}
.topbar .burger:hover { background: var(--brand-100); }

.topbar .page-title {
    font-weight: 800;
    font-size: 1.02rem;
    color: var(--ink-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar .page-title small { display: block; font-weight: 500; font-size: .72rem; color: var(--ink-500); margin-top: -2px; }

.topbar .spacer { margin-left: auto; }

.user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: .3rem .55rem .3rem .35rem;
    background: #fff;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}
.user-chip:hover { box-shadow: var(--shadow-soft); border-color: var(--brand-400); }

.user-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
}
.user-meta { line-height: 1.1; min-width: 0; }
.user-meta b { display: block; font-size: .82rem; color: var(--ink-900); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: .7rem; color: var(--ink-500); }

.dropdown-menu { border: 1px solid var(--border-soft); border-radius: 12px; box-shadow: var(--shadow-pop); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .88rem; display: flex; align-items: center; gap: .55rem; }
.dropdown-item i { color: var(--ink-500); }
.dropdown-item:hover { background: var(--brand-100); }
.dropdown-divider { margin: .3rem 0; }

/* ── Content ── */
.page {
    margin-left: var(--sb-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content { flex: 1; padding: 1.6rem 1.9rem 2.5rem; width: 100%; max-width: 1440px; }

.offcanvas.sidebar-offcanvas {
    width: var(--sb-width) !important;
    background:
        radial-gradient(120% 60% at -10% 0%, rgba(46, 165, 95, .18) 0%, transparent 55%),
        linear-gradient(180deg, var(--brand-900) 0%, #0c2a18 100%);
    border-right: none;
}
.sidebar-offcanvas .offcanvas-header { padding: .9rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-offcanvas .offcanvas-header .btn-close { filter: invert(1) grayscale(1); opacity: .8; }

/* =========================================================
   Page header
   ========================================================= */
.page-header { display: flex; flex-wrap: wrap; gap: .9rem 1.2rem; align-items: center; justify-content: space-between; margin-bottom: 1.35rem; }
.page-header-title { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.page-header-icon {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    font-size: 1.35rem; color: var(--brand-700);
    background: linear-gradient(145deg, var(--brand-100), #d0ebdc);
    border: 1px solid var(--brand-300);
}
.page-header h1 { font-size: 1.35rem; margin: 0; font-weight: 800; }
.page-header p { margin: 2px 0 0; color: var(--ink-500); font-size: .85rem; }
.page-header .page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* =========================================================
   Cards
   ========================================================= */
.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.35rem;
    overflow: hidden;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    font-weight: 700;
    color: var(--ink-900);
    padding: 1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-body { padding: 1.3rem; }
.card-footer { background: var(--body-bg); border-top: 1px solid var(--border-soft); padding: .9rem 1.3rem; }

/* =========================================================
   Buttons
   ========================================================= */
.btn { border-radius: 10px; font-weight: 600; letter-spacing: .01em; transition: all .16s ease; }
.btn:focus { box-shadow: 0 0 0 .2rem rgba(46, 165, 95, .18); }
.btn i { vertical-align: -0.12em; }

.btn-primary {
    --bs-btn-bg: var(--brand-600);
    --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-700);
    --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-800);
    --bs-btn-active-border-color: var(--brand-800);
    --bs-btn-disabled-bg: var(--brand-400);
    --bs-btn-disabled-border-color: var(--brand-400);
    color: #fff;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-700);
    --bs-btn-border-color: var(--brand-500);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
}
.btn-outline-secondary {
    --bs-btn-color: var(--ink-500);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--ink-300);
    --bs-btn-hover-border-color: var(--ink-300);
    --bs-btn-hover-color: #fff;
}
.btn-danger {
    --bs-btn-bg: var(--accent-coral);
    --bs-btn-border-color: var(--accent-coral);
    --bs-btn-hover-bg: #cf4f3c;
    --bs-btn-hover-border-color: #cf4f3c;
    --bs-btn-active-bg: #b94333;
    --bs-btn-active-border-color: #b94333;
}
.btn-outline-danger {
    --bs-btn-color: var(--accent-coral);
    --bs-btn-border-color: var(--accent-coral);
    --bs-btn-hover-bg: var(--accent-coral);
    --bs-btn-hover-border-color: var(--accent-coral);
    --bs-btn-active-bg: #cf4f3c;
    --bs-btn-active-border-color: #cf4f3c;
}
.btn-soft {
    --bs-btn-bg: var(--brand-100);
    --bs-btn-border-color: var(--brand-100);
    --bs-btn-color: var(--brand-800);
    --bs-btn-hover-bg: #d4eedf;
    --bs-btn-hover-border-color: #d4eedf;
    --bs-btn-hover-color: var(--brand-900);
}
.btn-light {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-color: var(--ink-700);
    --bs-btn-hover-bg: var(--body-bg);
    --bs-btn-hover-border-color: var(--border-strong);
}

/* =========================================================
   Forms
   ========================================================= */
.form-label { font-weight: 600; font-size: .84rem; color: var(--ink-700); margin-bottom: .4rem; }
.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: .55rem .85rem;
    font-size: .92rem;
    color: var(--ink-900);
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--ink-300); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 .2rem rgba(46, 165, 95, .14);
    background-color: #fff;
}
.form-control-sm, .form-select-sm { border-radius: 8px; padding: .38rem .7rem; font-size: .84rem; }
.input-group-text { border-radius: 10px 0 0 10px; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(46,165,95,.15); border-color: var(--brand-500); }
.form-hint { font-size: .78rem; color: var(--ink-500); }
.invalid-feedback { font-size: .8rem; }
.is-invalid { border-color: var(--accent-coral) !important; }

/* =========================================================
   Tables
   ========================================================= */
.card > .table-responsive { overflow: hidden; }
.table { --bs-table-hover-bg: #f2f8f3; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem 1.25rem; vertical-align: middle; }
.table thead th {
    background: #f6f9f6;
    color: var(--ink-500);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}
.table tbody td { font-size: .9rem; border-bottom: 1px solid #f0f4f1; }
.table tbody tr:last-child td { border-bottom: none; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: #fafcfa; }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #f2f8f3; }

/* =========================================================
   Metric / stat cards
   ========================================================= */
.metric {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.15rem 1.3rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform .18s ease, box-shadow .18s ease;
}
.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.metric-icon {
    width: 52px; height: 52px; flex: 0 0 52px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-size: 1.5rem;
}
.metric-body { min-width: 0; }
.metric-body small { display: block; color: var(--ink-500); font-size: .76rem; font-weight: 600; letter-spacing: .02em; margin-bottom: .1rem; text-transform: uppercase; }
.metric-body .metric-value { font-size: 1.5rem; font-weight: 800; color: var(--ink-900); letter-spacing: -.02em; line-height: 1.1; word-break: break-word; }
.metric-body .metric-sub { font-size: .76rem; color: var(--ink-300); margin-top: .1rem; }

.tint-green  { background: #e8f5ec; color: var(--brand-700); }
.tint-sky    { background: #e9f3fa; color: #2f7fb0; }
.tint-amber  { background: #fcf3e3; color: #b37a1e; }
.tint-earth  { background: #f6ede4; color: #a06a3c; }
.tint-coral  { background: #fdecea; color: #d15440; }
.tint-violet { background: #efecfb; color: #6d5bd0; }

/* =========================================================
   Badges & pills
   ========================================================= */
.badge { font-weight: 600; padding: .42em .7em; border-radius: 999px; font-size: .72rem; letter-spacing: .02em; }
.badge.bg-primary { background: var(--brand-600) !important; }
.badge.bg-light { background: #eef3ef !important; color: var(--ink-700) !important; }
.badge.bg-secondary { background: #7a8b80 !important; }

.badge-organik   { background: var(--brand-500); color: #fff; }
.badge-anorganik { background: var(--accent-sky); color: #fff; }
.badge-residu    { background: var(--accent-earth); color: #fff; }

.status-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    border-radius: 999px; padding: .25rem .7rem;
    font-size: .74rem; font-weight: 600;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-aktif { background: #e7f6ec; color: var(--brand-700); }
.status-nonaktif { background: #fdecea; color: var(--accent-coral); }

/* =========================================================
   Flash / alerts
   ========================================================= */
.flash {
    display: flex; align-items: center; gap: .6rem;
    border-radius: var(--radius-md);
    padding: .85rem 1.1rem;
    margin-bottom: 1.1rem;
    font-size: .9rem; font-weight: 500;
    background: var(--brand-100); color: var(--brand-900);
    border: 1px solid var(--brand-300);
}
.flash-error { background: #fdecea; color: #a13a2a; border-color: #f5c6bf; }
.alert { border-radius: var(--radius-md); }

/* =========================================================
   Charts wrapper
   ========================================================= */
.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box canvas { max-height: 260px; }

/* =========================================================
   Login page (auth)
   ========================================================= */
body.auth-page {
    background: linear-gradient(120deg, var(--brand-900), #0e341f 55%, var(--brand-800));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
body.auth-page::before {
    content: "";
    position: absolute;
    width: 620px; height: 620px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(88, 200, 127, .28), transparent 65%);
    top: -180px; right: -160px;
}
body.auth-page::after {
    content: "";
    position: absolute;
    width: 520px; height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle at 60% 40%, rgba(74, 163, 216, .16), transparent 60%);
    bottom: -220px; left: -140px;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: rgba(255,255,255,.98);
    border-radius: 22px;
    box-shadow: var(--shadow-pop);
    position: relative; z-index: 2;
    overflow: hidden;
    padding: 2.4rem 2.3rem 2.1rem;
    border: 1px solid rgba(255,255,255,.4);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: .4rem; }
.auth-brand .auth-logo {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center; font-size: 1.5rem; color: #fff;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
}
.auth-brand h3 { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--ink-900); }
.auth-brand p { margin: 0; font-size: .72rem; color: var(--ink-500); letter-spacing: .08em; text-transform: uppercase; }
.auth-sub { text-align: center; color: var(--ink-500); font-size: .9rem; margin: 1.1rem 0 1.5rem; }

/* =========================================================
   Footer inside content pages
   ========================================================= */
.foot-note { font-size: .8rem; color: var(--ink-300); text-align: center; margin-top: 1rem; }

/* =========================================================
   Utility tweaks
   ========================================================= */
.gap-1 { gap: .25rem; }
.hidden-mobile { display: none; }
.photo-thumb img { cursor: pointer; }

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--ink-500);
}
.empty-state i { font-size: 2.6rem; color: var(--ink-300); display: block; margin-bottom: .7rem; }

/* Search / filter forms row */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (min-width: 992px) {
    .page { margin-left: var(--sb-width); }
    .sidebar { display: flex; }
    .topbar .burger { display: none; }
}

@media (max-width: 991.98px) {
    .sidebar { display: none; }
    .page { margin-left: 0; }
    .topbar .burger { display: inline-flex; }
    .topbar { padding: 0 1rem; }
    .content { padding: 1.2rem 1.1rem 2rem; }
    .metric { padding: 1rem 1.05rem; }
    .metric-body .metric-value { font-size: 1.25rem; }
    .page-header h1 { font-size: 1.2rem; }
    .page-header-icon { width: 40px; height: 40px; flex-basis: 40px; font-size: 1.15rem; }
    .user-meta { display: none; }
}
@media (max-width: 575.98px) {
    .topbar .page-title small { display: none; }
    .card-header { padding: .85rem 1rem; }
    .card-body { padding: 1rem; }
    .auth-card { padding: 2rem 1.5rem 1.7rem; }
    .table > :not(caption) > * > * { padding: .65rem .85rem; }
    .content { padding: 1rem .9rem 1.7rem; }
}
