/* ==========================================================================
   SI-YAYASAN PRO - Modern Islamic Foundation Management Stylesheet
   Emerald Philanthropy & Slate Architecture
   ========================================================================== */

:root {
    --primary: #059669;
    --primary-dark: #064e3b;
    --primary-light: #10b981;
    --primary-subtle: #d1fae5;
    --secondary: #d97706;
    --secondary-dark: #b45309;
    --accent: #0284c7;
    --dark: #0f172a;
    --dark-muted: #334155;
    --light-bg: #f8fafc;
    --card-border: #e2e8f0;
    --sidebar-width: 275px;
    --sidebar-collapsed-width: 76px;
    --topbar-height: 70px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--light-bg);
    color: #1e293b;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================================================
   Sidebar Navigation & Menus
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(180deg, #064e3b 0%, #022c22 100%);
    color: #ffffff;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.6);
}

.sidebar .brand-wrapper {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.12);
}

.sidebar .brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    flex-shrink: 0;
}

/* Sidebar Search Box */
.sidebar-search-box {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-search-box .input-group {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-search-box input {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.82rem;
    padding: 8px 10px;
}
.sidebar-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}
.sidebar-search-box input:focus {
    background: transparent;
    box-shadow: none;
    color: #ffffff;
}
.sidebar-search-box .input-group-text {
    background: transparent;
    border: none;
    color: #6ee7b7;
    font-size: 0.85rem;
    padding-left: 12px;
}

/* Navigation Section Headers */
.sidebar .nav-header {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #a7f3d0;
    padding: 16px 20px 6px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Top-level Nav Links */
.sidebar .nav-link {
    color: #e2e8f0;
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.88rem;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    border-radius: 0 10px 10px 0;
    margin-right: 10px;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.09);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(16, 185, 129, 0.25);
    border-left-color: #34d399;
    font-weight: 600;
}

.sidebar .nav-link-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.sidebar .nav-link i.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
    color: #6ee7b7;
    transition: transform 0.2s ease;
}

.sidebar .nav-link.active i.nav-icon {
    color: #34d399;
    transform: scale(1.1);
}

/* Dropdown Accordion Arrow */
.sidebar .nav-link .dropdown-arrow {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.25s ease;
}

.sidebar .nav-link[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(90deg);
    color: #34d399;
}

.sidebar .nav-link[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Submenu Styling */
.sidebar-submenu {
    background-color: rgba(0, 0, 0, 0.18);
    margin: 2px 10px 6px 14px;
    border-radius: 10px;
    padding: 6px 0;
    border-left: 2px solid rgba(16, 185, 129, 0.4);
}

.sidebar-submenu .submenu-link {
    color: #cbd5e1;
    padding: 8px 14px 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.83rem;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.18s ease;
    border-radius: 6px;
    margin: 1px 6px;
}

.sidebar-submenu .submenu-link:hover {
    color: #ffffff;
    background-color: rgba(16, 185, 129, 0.15);
    transform: translateX(3px);
}

.sidebar-submenu .submenu-link.active {
    color: #34d399;
    background-color: rgba(16, 185, 129, 0.22);
    font-weight: 600;
}

.sidebar-submenu .submenu-link i {
    font-size: 0.65rem;
    margin-right: 8px;
    color: rgba(110, 231, 183, 0.6);
}

.sidebar-submenu .submenu-link.active i {
    color: #34d399;
}

/* Badge in Menu */
.badge-menu {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
}

/* User Profile Card at Sidebar Footer */
.sidebar-user-footer {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.28);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ==========================================================================
   Main Layout & Top Navbar
   ========================================================================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop Collapsed Sidebar State */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}
body.sidebar-collapsed .sidebar .brand-title,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .nav-header,
body.sidebar-collapsed .sidebar .dropdown-arrow,
body.sidebar-collapsed .sidebar-submenu,
body.sidebar-collapsed .sidebar-search-box,
body.sidebar-collapsed .sidebar-user-footer .user-details,
body.sidebar-collapsed .sidebar .badge-menu {
    display: none !important;
}
body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 14px 0;
    margin-right: 0;
    border-radius: 0;
}
body.sidebar-collapsed .sidebar .nav-link-content {
    justify-content: center;
    gap: 0;
}
body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar */
.top-navbar {
    height: var(--topbar-height);
    background-color: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.content-body {
    padding: 24px 28px;
    flex: 1;
}

/* Breadcrumb Bar */
.breadcrumb-bar {
    background: #ffffff;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.breadcrumb-bar .breadcrumb {
    margin-bottom: 0;
    font-size: 0.83rem;
}
.breadcrumb-bar .breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s ease;
}
.breadcrumb-bar .breadcrumb-item a:hover {
    color: var(--primary);
}
.breadcrumb-bar .breadcrumb-item.active {
    color: #0f172a;
    font-weight: 600;
}

/* Quick Action Dropdown */
.btn-quick-action {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: 50rem;
    padding: 8px 18px;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
    transition: all 0.2s ease;
}
.btn-quick-action:hover {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.35);
}

/* Custom Dropdown Styling */
.dropdown-menu-custom {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 8px;
    min-width: 230px;
}
.dropdown-menu-custom .dropdown-item {
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    transition: all 0.15s ease;
}
.dropdown-menu-custom .dropdown-item:hover {
    background-color: #ecfdf5;
    color: #065f46;
}

/* Switch Role Menu Item in Navbar */
.role-pill-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--card-border);
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s ease;
}
.role-pill-btn:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

/* ==========================================================================
   Cards, Badges & Tables
   ========================================================================== */
.card-custom {
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.025);
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.card-stat {
    border-radius: 16px;
    padding: 22px;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.card-stat .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.table-custom {
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid var(--card-border);
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 12px 16px;
}

.table-custom tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.88rem;
}

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

.badge {
    padding: 6px 12px;
    font-weight: 600;
    border-radius: 8px;
    font-size: 0.75rem;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Print Styling */
@media print {
    .sidebar, .top-navbar, .breadcrumb-bar, .btn, .d-print-none, footer, .sidebar-backdrop {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt;
    }
}

/* Responsive Breakpoints */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .content-body {
        padding: 16px;
    }
    .top-navbar {
        padding: 0 16px;
    }
}
