/**
 * D I L A N — Digitalisasi Laporan Keuangan
 * Modern Leaf-Green & Crisp White Theme
 */

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

:root {
    --dilan-primary: #15803d;         /* Leaf Green 700 */
    --dilan-primary-hover: #166534;   /* Leaf Green 800 */
    --dilan-primary-light: #22c55e;   /* Leaf Green 500 */
    --dilan-primary-subtle: #f0fdf4;  /* Leaf Green 50 */
    --dilan-primary-border: #bbf7d0;  /* Leaf Green 200 */
    
    --dilan-forest: #0d381e;          /* Deep Forest Green */
    --dilan-forest-light: #14532d;    /* Mid Forest Green */
    
    --dilan-accent-amber: #f59e0b;
    --dilan-accent-red: #ef4444;
    --dilan-accent-teal: #0d9488;
    --dilan-accent-blue: #0284c7;

    --dilan-bg: #f7faf8;              /* Soft clean mint-white background */
    --dilan-surface: #ffffff;         /* Pure white cards */
    --dilan-border: #e6ede8;          /* Light subtle card border */
    
    --dilan-text-main: #0f172a;       /* Deep slate */
    --dilan-text-muted: #64748b;      /* Slate 500 */
    --dilan-text-light: #94a3b8;      /* Slate 400 */
    
    --dilan-shadow-sm: 0 1px 3px rgba(15, 61, 34, 0.05);
    --dilan-shadow: 0 4px 14px rgba(15, 61, 34, 0.07);
    --dilan-shadow-lg: 0 12px 30px -4px rgba(15, 61, 34, 0.12);
    
    --dilan-radius-sm: 8px;
    --dilan-radius: 14px;
    --dilan-radius-lg: 20px;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --navbar-height: 68px;
}

/* Base & Typography */
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--dilan-bg);
    color: var(--dilan-text-main);
    letter-spacing: -0.01em;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout Container */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================================================
   SIDEBAR - Deep Forest & Leaf Green Branding
   ========================================================================== */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(185deg, var(--dilan-forest) 0%, #114b28 50%, var(--dilan-forest-light) 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    box-shadow: 4px 0 20px rgba(13, 56, 30, 0.18);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#sidebar::-webkit-scrollbar {
    width: 4px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Sidebar Brand Header */
.sidebar-brand {
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

.brand-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
    flex-shrink: 0;
}

/* Logo image box in sidebar (replaces icon box when custom logo is set) */
.brand-logo-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.brand-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.brand-text-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
}

.brand-text-subtitle {
    font-size: 0.72rem;
    color: #86efac;
    font-weight: 500;
    margin: 0;
}

/* Navigation Section Headers */
.sidebar-nav-header {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #86efac;
    opacity: 0.75;
    padding: 1.25rem 1.25rem 0.4rem;
}

/* Navigation Items */
#sidebar .nav-pills {
    padding: 0.5rem 0.85rem;
}

#sidebar .nav-link {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.65rem 0.95rem;
    border-radius: 10px;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease-in-out;
}

#sidebar .nav-link i {
    font-size: 1.15rem;
    margin-right: 0.75rem;
    width: 1.35rem;
    text-align: center;
    color: #86efac;
    transition: transform 0.2s ease;
}

#sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

#sidebar .nav-link:hover i {
    transform: scale(1.1);
    color: #ffffff;
}

#sidebar .nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
    font-weight: 600;
}

#sidebar .nav-link.active i {
    color: #ffffff;
}

/* Sidebar User Footer */
.sidebar-footer {
    padding: 0.85rem 1rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
}

.sidebar-logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    color: #ff3333 !important;
    font-weight: 700;
    font-size: 0.88rem;
    text-shadow: 1px 1px 2px #000000, 0 0 3px #000000;
    text-decoration: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 51, 51, 0.35);
    transition: all 0.2s ease;
}

.sidebar-logout-link:hover {
    color: #ff6666 !important;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(255, 51, 51, 0.6);
    text-shadow: 1px 1px 3px #000000, 0 0 5px #000000;
}

.user-mini-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.user-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.user-role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    margin-top: 2px;
}

/* ==========================================================================
   APP CONTENT & NAVBAR
   ========================================================================== */
.app-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-top {
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--dilan-border);
    padding: 0.5rem 1.75rem;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.btn-sidebar-toggle {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--dilan-border);
    background: var(--dilan-surface);
    color: var(--dilan-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.2s ease;
}

.btn-sidebar-toggle:hover {
    background: var(--dilan-primary-subtle);
    color: var(--dilan-primary-hover);
    border-color: var(--dilan-primary-border);
}

/* Year Selector Pill */
.year-badge-selector {
    background: var(--dilan-primary-subtle);
    border: 1px solid var(--dilan-primary-border);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dilan-primary-hover);
    font-weight: 600;
    font-size: 0.85rem;
}

.year-select-native {
    background: transparent;
    border: none;
    font-weight: 700;
    color: var(--dilan-primary);
    cursor: pointer;
    outline: none;
    padding-right: 0.25rem;
}

/* User Menu Dropdown */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: var(--dilan-text-main);
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    background: #ffffff;
    box-shadow: var(--dilan-shadow-sm);
    border-color: var(--dilan-primary-border);
}

/* ==========================================================================
   CARDS & DASHBOARD WIDGETS
   ========================================================================== */
.card {
    background: var(--dilan-surface);
    border: 1px solid var(--dilan-border);
    border-radius: var(--dilan-radius);
    box-shadow: var(--dilan-shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
    box-shadow: var(--dilan-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--dilan-border);
    padding: 1.1rem 1.4rem;
    font-weight: 600;
    color: var(--dilan-text-main);
}

.card-body {
    padding: 1.4rem;
}

/* Interactive Stat Metric Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--dilan-radius);
    border: 1px solid var(--dilan-border);
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -6px rgba(15, 61, 34, 0.1);
    border-color: var(--dilan-primary-border);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.stat-green::before { background: linear-gradient(90deg, #15803d, #22c55e); }
.stat-card.stat-amber::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.stat-card.stat-red::before   { background: linear-gradient(90deg, #dc2626, #ef4444); }
.stat-card.stat-teal::before  { background: linear-gradient(90deg, #0d9488, #14b8a6); }

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.stat-green .stat-icon-wrapper {
    background: #dcfce7;
    color: #15803d;
}

.stat-amber .stat-icon-wrapper {
    background: #fef3c7;
    color: #b45309;
}

.stat-red .stat-icon-wrapper {
    background: #fee2e2;
    color: #b91c1c;
}

.stat-teal .stat-icon-wrapper {
    background: #ccfbf1;
    color: #0f766e;
}

.stat-number {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--dilan-text-main);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dilan-text-muted);
    margin-bottom: 0.35rem;
}

/* Banner Hero */
.dashboard-hero-banner {
    background: linear-gradient(135deg, #0f5132 0%, #15803d 60%, #16a34a 100%);
    border-radius: var(--dilan-radius-lg);
    padding: 1.75rem 2rem;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(21, 128, 61, 0.25);
    margin-bottom: 1.75rem;
}

.dashboard-hero-banner::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.hero-pill {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ==========================================================================
   BUTTONS & FORMS - Leaf-Green Overhaul
   ========================================================================== */
.btn-primary {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border-color: #15803d;
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--dilan-radius-sm);
    padding: 0.55rem 1.15rem;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
    transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
    border-color: #14532d;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.35);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--dilan-primary);
    border-color: var(--dilan-primary);
    font-weight: 600;
    border-radius: var(--dilan-radius-sm);
}

.btn-outline-primary:hover {
    background-color: var(--dilan-primary);
    border-color: var(--dilan-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
}

.btn-success {
    background-color: #16a34a;
    border-color: #16a34a;
}

.btn-success:hover {
    background-color: #15803d;
    border-color: #15803d;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: var(--dilan-radius-sm);
    border: 1px solid #cbd5e1;
    padding: 0.55rem 0.95rem;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--dilan-primary);
    box-shadow: 0 0 0 0.25rem rgba(22, 163, 74, 0.16);
}

/* ==========================================================================
   BADGES & PROGRESS BARS
   ========================================================================== */
.badge-soft-success {
    background-color: #dcfce7;
    color: #15803d;
    font-weight: 600;
}

.badge-soft-warning {
    background-color: #fef3c7;
    color: #b45309;
    font-weight: 600;
}

.badge-soft-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
}

.badge-soft-info {
    background-color: #e0f2fe;
    color: #0369a1;
    font-weight: 600;
}

.badge-soft-secondary {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
}

.progress {
    height: 8px;
    border-radius: 999px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.progress-bar-green {
    background: linear-gradient(90deg, #22c55e, #15803d);
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid var(--dilan-border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f9fdfa;
}

/* ==========================================================================
   RESPONSIVE & MOBILE
   ========================================================================== */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: 0;
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    #sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.35);
    }
    
    .app-content {
        margin-left: 0;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        z-index: 1030;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
}

/* ==========================================================================
   MINI SIDEBAR (COLLAPSED / MINIMIZE STATE) - Desktop & Large Screens
   ========================================================================== */
@media (min-width: 992px) {
    body.sidebar-collapsed #sidebar {
        width: var(--sidebar-collapsed-width) !important;
        margin-left: 0 !important;
        transform: translateX(0) !important;
        box-shadow: 3px 0 14px rgba(13, 56, 30, 0.14) !important;
        overflow-x: hidden !important;
    }

    body.sidebar-collapsed .app-content {
        margin-left: var(--sidebar-collapsed-width) !important;
    }

    /* Brand Header in Mini Sidebar */
    body.sidebar-collapsed #sidebar .sidebar-brand {
        padding: 0.9rem 0 !important;
        justify-content: center !important;
        text-align: center !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-brand .brand-logo-box {
        margin: 0 auto !important;
        width: 40px !important;
        height: 40px !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-brand .brand-logo-img {
        width: 32px !important;
        height: 32px !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-brand > div:last-child {
        display: none !important;
    }

    /* Section Headers in Mini Sidebar: Convert to clean subtle divider */
    body.sidebar-collapsed #sidebar .sidebar-nav-header {
        font-size: 0 !important;
        height: 1px !important;
        margin: 0.55rem 0.75rem !important;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.15) !important;
        overflow: hidden !important;
    }

    /* Navigation Items in Mini Sidebar: Icons only */
    body.sidebar-collapsed #sidebar .nav-pills {
        padding: 0.5rem 0.4rem !important;
    }

    body.sidebar-collapsed #sidebar .nav-link {
        justify-content: center !important;
        padding: 0.65rem 0 !important;
        margin-bottom: 0.35rem !important;
        width: 100% !important;
        text-align: center !important;
        border-radius: 10px !important;
    }

    body.sidebar-collapsed #sidebar .nav-link i {
        margin-right: 0 !important;
        font-size: 1.35rem !important;
        width: auto !important;
        display: inline-block !important;
    }

    body.sidebar-collapsed #sidebar .nav-link span {
        display: none !important;
    }

    body.sidebar-collapsed #sidebar .nav-link:hover {
        transform: scale(1.08) !important;
        background: rgba(255, 255, 255, 0.15) !important;
    }

    /* Footer / Logout in Mini Sidebar */
    body.sidebar-collapsed #sidebar .sidebar-footer {
        padding: 0.75rem 0.4rem !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-logout-link {
        justify-content: center !important;
        padding: 0.6rem 0 !important;
        gap: 0 !important;
        width: 100% !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-logout-link i {
        margin: 0 !important;
        font-size: 1.3rem !important;
    }

    body.sidebar-collapsed #sidebar .sidebar-logout-link span {
        display: none !important;
    }
}

/* Quick Interactive Filter Bar */
.filter-card {
    background: #ffffff;
    border: 1px solid var(--dilan-border);
    border-radius: var(--dilan-radius);
    padding: 0.9rem 1.25rem;
    box-shadow: var(--dilan-shadow-sm);
    margin-bottom: 1.5rem;
}

/* Custom Nav Tabs with Leaf Accent */
.nav-tabs-dilan {
    border-bottom: 2px solid var(--dilan-border);
}

.nav-tabs-dilan .nav-link {
    border: none;
    color: var(--dilan-text-muted);
    font-weight: 600;
    padding: 0.65rem 1.15rem;
    position: relative;
    transition: all 0.2s ease;
}

.nav-tabs-dilan .nav-link:hover {
    color: var(--dilan-primary);
}

.nav-tabs-dilan .nav-link.active {
    color: var(--dilan-primary);
    background: transparent;
}

.nav-tabs-dilan .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--dilan-primary);
    border-radius: 3px 3px 0 0;
}
