/* =====================================================================
   Petani Sawit Mandiri — Admin Panel Theme
   Dibangun di atas Bootstrap 5.3 (override) agar selaras dengan tema
   hijau website & dashboard. Tampilan profesional, rapi, modern.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    /* Palet hijau selaras website */
    --primary-color: #0ea640;
    --primary-dark: #0a8035;
    --primary-light: #13ec5b;
    --primary-soft: #e9f7ee;
    --secondary-color: #6366F1;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #0ea5e9;

    --text-dark: #0f1b13;
    --text-muted: #647067;
    --bg-light: #f3f7f4;
    --surface: #ffffff;
    --border-color: #e4ebe6;

    --shadow-sm: 0 1px 2px rgba(16, 24, 19, .05), 0 1px 3px rgba(16, 24, 19, .06);
    --shadow-card: 0 1px 3px rgba(16, 24, 19, .05), 0 12px 28px -16px rgba(16, 24, 19, .18);
    --shadow-pop: 0 18px 48px -18px rgba(16, 24, 19, .28);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;

    /* Override variabel Bootstrap agar konsisten tema hijau */
    --bs-primary: #0a8035;
    --bs-primary-rgb: 10, 128, 53;
    --bs-success: #0ea640;
    --bs-success-rgb: 14, 166, 64;
    --bs-link-color: #0a8035;
    --bs-link-color-rgb: 10, 128, 53;
    --bs-link-hover-color: #0ea640;
    --bs-body-color: #0f1b13;
    --bs-border-color: #e4ebe6;
    --bs-body-font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* Latar belakang halus untuk konten */
body.bg-light {
    background-color: var(--bg-light) !important;
}

/* Scrollbar halus */
* { scrollbar-width: thin; scrollbar-color: #cdd8d1 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #cdd8d1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b3c2b8; background-clip: content-box; }

/* ===================== Typography ===================== */
h1, h2, h3, h4, h5, h6 { color: var(--text-dark); letter-spacing: -.01em; }
.text-muted { color: var(--text-muted) !important; }
a { text-decoration: none; }

/* ===================== Login / brand logo ===================== */
.logo-circle {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================== Cards ===================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card.shadow-sm { box-shadow: var(--shadow-card) !important; }

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 700;
    border-top-left-radius: var(--radius) !important;
    border-top-right-radius: var(--radius) !important;
}

.card-header.bg-white { background: var(--surface) !important; }
.card-body { padding: 1.25rem; }

/* ===================== Buttons ===================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all .18s ease;
}

.btn-success,
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary { background-color: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success:hover,
.btn-primary:hover,
.btn-success:focus,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(14, 166, 64, .45);
}

.btn-primary:hover { background-color: var(--primary-color); border-color: var(--primary-color); }

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-dark);
    background: var(--surface);
}
.btn-outline-secondary:hover {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.btn-outline-success { color: var(--primary-dark); border-color: var(--primary-color); }
.btn-outline-success:hover { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }

/* ===================== Forms ===================== */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    color: var(--text-dark);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 .2rem rgba(14, 166, 64, .18);
}

.form-control-lg { padding: 0.75rem 1rem; font-size: 1rem; }
.form-label { font-weight: 600; color: var(--text-dark); margin-bottom: .4rem; }

/* ===================== Sidebar ===================== */
.sidebar {
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    transition: flex-basis 0.2s ease, max-width 0.2s ease, width 0.2s ease;
    box-shadow: 1px 0 0 rgba(16, 24, 19, .02);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .text-center.mb-4 {
    padding-bottom: 1rem;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid var(--border-color);
}
.sidebar .text-center.mb-4 img {
    box-shadow: 0 6px 16px -8px rgba(14, 166, 64, .5);
}
.sidebar h6.text-success { color: var(--primary-dark) !important; font-weight: 800; }

.container-fluid > .row.admin-layout-row { flex-wrap: nowrap; }

.sidebar .nav-link {
    color: var(--text-muted);
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.2rem;
    border-radius: var(--radius-sm);
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
}

.sidebar .nav-link .nav-label { line-height: 1.2; }

.sidebar .nav-link i.bi {
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: color .18s;
}

.sidebar .nav-link:hover {
    background-color: var(--primary-soft);
    color: var(--primary-dark);
}
.sidebar .nav-link:hover i.bi { color: var(--primary-dark); }

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(14, 166, 64, .6);
}
.sidebar .nav-link.active i.bi { color: #fff; }

.sidebar .nav-link.text-danger { color: var(--danger-color) !important; }
.sidebar .nav-link.text-danger:hover { background-color: #fef2f2; color: #dc2626 !important; }
.sidebar .nav-link.text-danger:hover i.bi { color: #dc2626; }

.sidebar .nav-link svg {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

/* Sidebar compact — icon only, default via admin-sidebar.js */
body.admin-sidebar-compact nav.sidebar {
    flex: 0 0 4.5rem !important;
    max-width: 4.5rem !important;
    width: 4.5rem !important;
}

body.admin-sidebar-compact main[role="main"],
body.admin-sidebar-compact main.col-md-10 {
    flex: 1 1 auto !important;
    max-width: calc(100% - 4.5rem) !important;
    width: auto !important;
}

body.admin-sidebar-compact .sidebar .sidebar-brand-text,
body.admin-sidebar-compact .sidebar .nav-label {
    display: none !important;
}

body.admin-sidebar-compact .sidebar .p-3 {
    padding: 0.75rem 0.35rem !important;
}

body.admin-sidebar-compact .sidebar .text-center.mb-4 img {
    width: 36px !important;
    height: 36px !important;
    margin-bottom: 0 !important;
}

body.admin-sidebar-compact .sidebar .text-center.mb-4 {
    border-bottom: none;
}

body.admin-sidebar-compact .sidebar .nav-link {
    justify-content: center;
    padding: 0.65rem 0.35rem;
}

body.admin-sidebar-compact .sidebar .nav-link i.bi {
    margin: 0;
    width: auto;
    font-size: 1.2rem;
}

.admin-sidebar-toggle { flex-shrink: 0; }

@media (min-width: 768px) {
    nav.sidebar {
        flex: 0 0 12rem;
        max-width: 12rem;
    }

    main[role="main"].col-md-10,
    main.col-md-10 {
        flex: 1 1 auto;
        max-width: calc(100% - 12rem);
    }

    body:not(.admin-sidebar-compact) nav.sidebar {
        flex: 0 0 12rem;
        max-width: 12rem;
    }
}

/* ===================== Stat cards ===================== */
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-light), var(--primary-color));
    opacity: 0;
    transition: opacity .2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-pop);
}
.stat-card:hover::before { opacity: 1; }

.stat-card h3 { font-size: 1.75rem; font-weight: 800; }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================== Tables ===================== */
.table { color: var(--text-dark); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.85rem 1rem; }
.table thead th {
    background: #f7faf8;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table tbody tr { transition: background .12s; }
.table-hover tbody tr:hover { background: var(--primary-soft); }
.table td, .table th { border-color: var(--border-color); vertical-align: middle; }

/* Tabel di dalam card: sudut membulat mengikuti card */
.card > .table-responsive { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); overflow: hidden; }

/* ===================== Badges ===================== */
.badge { font-weight: 700; letter-spacing: .01em; }

.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
}

/* ===================== Action buttons in tables ===================== */
.table-action-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ===================== Misc Bootstrap polish ===================== */
.nav-tabs .nav-link { color: var(--text-muted); font-weight: 600; border: none; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--primary-dark); background: transparent; border-bottom-color: var(--primary-color); }

.list-group-item { border-color: var(--border-color); }
.dropdown-menu { border-color: var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.dropdown-item:active { background-color: var(--primary-color); }

.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.modal-header, .modal-footer { border-color: var(--border-color); }

.progress { border-radius: 999px; background: #eef3f0; }
.progress-bar { background-color: var(--primary-color); }

.alert { border-radius: var(--radius); border: 1px solid transparent; }

/* Pill-style page header refinement */
main h2.fw-bold { font-weight: 800; }

/* ===================== Animations ===================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease-out; }

.card, .stat-card { animation: fadeIn .35s ease-out both; }

/* ===================== Mobile Responsive ===================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s;
        z-index: 1000;
        height: 100vh;
        box-shadow: var(--shadow-pop);
    }

    .sidebar.show { left: 0; }

    .stat-card h3 { font-size: 1.5rem; }
}

/* ===================== Footer ===================== */
.admin-app-version-footer {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8125rem;
    padding: 1.5rem 0 0.25rem;
    margin-top: 1rem;
    border-top: 1px solid transparent;
}
