/* General Body Styles */
* {
    box-sizing: border-box; /* Memastikan model kotak yang konsisten */
}
html { overflow-y: scroll; } /* Mencegah pergeseran layout saat scrollbar muncul/hilang */

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: #0057A8; /* Muhammadiyah Blue */
    color: #FFFFFF; /* White */
    display: flex;
    flex-direction: column; /* Default untuk desktop */
    padding-top: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start; /* Mencegah sidebar meregang jika konten lebih pendek */
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #00417d; /* Darker Blue */
}

.sidebar-logo {
    width: 40px;
    height: auto;
    object-fit: contain; /* Menjaga rasio aspek logo */
}

.sidebar-header h3 {
    margin: 0;
    font-size: 24px;
    color: #FFFFFF; /* White */
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar styling untuk sidebar */
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.sidebar-menu li a {
    display: block;
    padding: 15px 20px;
    color: #FFFFFF;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.3s, padding-left 0.3s;
}

.sidebar-menu li.active a,
.sidebar-menu li a:hover {
    background-color: #00417d;
    padding-left: 25px;
}

.sidebar-menu .menu-header {
    padding: 20px 20px 10px 20px;
    font-size: 11px;
    font-weight: bold;
    color: #a9d5ff; /* Lighter blue for header text */
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Main Content Styles */
.main-content { /* Default untuk desktop */
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: #f4f7f6; /* Warna latar same dengan body */
}

/* Header Styles */
.header {
    background-color: #FFFFFF;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between; /* Menjaga jarak antara judul dan info user */
    align-items: center; /* Menyelaraskan secara vertikal */
    border-bottom: 1px solid #ddd;
}

.hamburger-menu {
    display: none; /* Sembunyikan di desktop */
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #0057A8;
    padding: 0;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    color: #0057A8; /* Warna biru Muhammadiyah */
}

.header .user-info {
    display: flex; /* Untuk menyelaraskan teks dan tombol logout */
    align-items: center;
    gap: 15px; /* Jarak antara teks selamat datang dan tombol logout */
}

.header .user-info span {
    color: #333; /* Warna teks selamat datang */
    text-decoration: none;
    font-weight: bold;
}

/* Page Content Styles */
.content {
    padding: 30px;
    flex: 1;
    background-color: #f4f7f6;
}

/* Card Styles */
.card {
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #f2f2f2;
    color: #0057A8;
}

.table tbody tr:hover {
    background-color: #f9f9f9; /* Efek hover pada baris tabel */
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
}

.btn-primary {
    background-color: #0057A8; /* Muhammadiyah Blue */
    color: white;
}

.btn-primary:hover {
    background-color: #00417d; /* Darker Blue */
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-danger {
    background-color: #dc3545; /* Warna merah untuk tombol bahaya/logout */
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

/* Filter Form Styles (untuk report.php) */
.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-form .form-group {
    margin-bottom: 0;
}

/* Dashboard Summary Styles */
.dashboard-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap; /* Memastikan kartu bisa turun ke baris baru di layar kecil */
}

.summary-card {
    flex: 1;
    min-width: 220px; /* Lebar minimum kartu */
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 5px solid; /* Garis warna di sisi kiri kartu */
}

.summary-card h2 {
    margin-top: 0;
    font-size: 16px;
    color: #666;
}

.summary-card p {
    margin-bottom: 0;
    font-size: 26px;
    font-weight: bold;
}

.summary-card.pemasukan { border-color: #28a745; }
.summary-card.pemasukan p { color: #28a745; }

.summary-card.pengeluaran { border-color: #dc3545; }
.summary-card.pengeluaran p { color: #dc3545; }

.summary-card.saldo { border-color: #0057A8; }
.summary-card.saldo p { color: #0057A8; }

/* Badge Styles */
.badge {
    padding: 5px 10px;
    border-radius: 12px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

/* Overlay for mobile sidebar */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    transition: opacity 0.3s ease-in-out;
}

.overlay.active {
    display: block;
}

/* Close button for mobile sidebar */
.close-btn {
    display: none; /* Sembunyikan di desktop */
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 36px;
    color: white;
    text-decoration: none;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        flex-direction: column; /* Sidebar dan konten utama menumpuk vertikal */
    }

    .hamburger-menu {
        display: block; /* Tampilkan tombol hamburger di mobile */
    }

    .sidebar {
        position: fixed;
        left: -260px; /* Sembunyikan di luar layar */
        top: 0;
        width: 250px; /* Kembalikan lebar asli */
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        padding-top: 20px;
        flex-direction: column; /* Kembalikan ke tumpukan vertikal */
        border-bottom: none;
    }

    .sidebar.open {
        left: 0; /* Tampilkan sidebar */
    }

    .close-btn {
        display: block; /* Tampilkan tombol close di mobile */
    }

    .main-content {
        width: 100%; /* Konten utama mengambil lebar penuh */
        transition: margin-left 0.3s ease-in-out;
    }

    .header {
        padding: 10px 15px;
        flex-direction: row; /* Kembalikan ke baris */
        align-items: center;
        gap: 15px;
    }

    .header h1 {
        font-size: 20px;
        flex-grow: 1; /* Biarkan judul mengambil sisa ruang */
    }

    .header .user-info {
        width: auto; /* Reset lebar */
        margin-left: auto; /* Dorong ke kanan */
        gap: 10px;
    }

    .header .user-info span {
        display: none; /* Sembunyikan teks "Selamat datang" agar lebih ringkas */
    }

    .content {
        padding: 15px;
    }

    .dashboard-summary {
        flex-direction: column; /* Kartu ringkasan menumpuk vertikal */
    }

    .summary-card {
        min-width: unset; /* Hapus batasan min-width */
        width: 100%; /* Ambil lebar penuh */
    }

    .filter-form {
        flex-direction: column; /* Elemen form filter menumpuk vertikal */
        align-items: stretch;
    }

    .filter-form .form-group {
        width: 100%;
    }

    /* Login Page Specific */
    body.login-page {
        padding: 15px;
    }
    .login-container {
        padding: 20px;
        box-shadow: none; /* Hapus bayangan di mobile untuk tampilan lebih bersih */
        border-radius: 0;
    }
}

/* Table responsiveness - memerlukan wrapper HTML */
.table-responsive {
    overflow-x: auto; /* Memungkinkan scroll horizontal jika tabel terlalu lebar */
    -webkit-overflow-scrolling: touch; /* Untuk scrolling yang lebih halus di iOS */
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    animation: animatetop 0.4s;
}

@keyframes animatetop {
  from {top: -300px; opacity: 0}
  to {top: 0; opacity: 1}
}

.modal-header {
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #0057A8;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
}

.close-modal-save {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal-save:hover,
.close-modal-save:focus {
    color: black;
    text-decoration: none;
}

/* Alert Styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Small size buttons */
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.lock-icon {
    font-size: 18px;
    color: #6c757d;
    cursor: not-allowed;
}

.sidebar-menu li a i,
.sidebar-menu .menu-header span i {
    margin-right: 8px;
}

.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* Report Folder Grid Styles */
.report-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.report-folder-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.report-folder-item:hover {
    border-color: #0057A8;
    background-color: #e8f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.report-folder-item.active {
    border-color: #0057A8;
    background-color: #e8f4ff;
    box-shadow: 0 2px 8px rgba(0,87,168,0.15);
}

.report-folder-item .folder-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.report-folder-item .folder-icon i {
    font-size: 28px;
    color: #0057A8;
}

.report-folder-item.active .folder-icon i {
    color: #0057A8;
}

.report-folder-item .folder-info {
    flex: 1;
    min-width: 0;
}

.report-folder-item .folder-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-folder-item .folder-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
}

.report-folder-item .folder-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-folder-item .folder-meta i {
    font-size: 11px;
}

/* Report Specific Styles for Screen */
.report-logo-print, .report-footer {
    display: none; /* Sembunyikan logo dan footer di layar */
}

.report-header {
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.report-title-group h2, .report-title-group h3, .report-title-group h4 {
    margin: 5px 0;
}

/* ===== PROFESSIONAL UI COMPONENTS ===== */

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0057A8, #0073d4);
    color: white;
    border-radius: 10px;
    font-size: 18px;
    flex-shrink: 0;
}

/* Modal actions - reuse consistently */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* Transaction table link buttons */
.btn-file-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
    background: #e8f4ff;
    color: #0057A8;
    border: 1px solid #b8daff;
    transition: all 0.2s;
}

.btn-file-link:hover {
    background: #0057A8;
    color: #fff;
    border-color: #0057A8;
}

/* Responsive table actions */
@media (max-width: 768px) {
    .table-modern thead th,
    .table-modern tbody td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .table-modern .action-buttons .btn-sm {
        padding: 4px 6px;
        font-size: 11px;
    }

    .table-modern .action-buttons .btn-sm i {
        margin-right: 2px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .card-header > div:last-child .btn {
        flex: 1;
        text-align: center;
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Smooth scrollbar for main content */
.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Modern Table */
.table-modern thead th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid #dee2e6;
}

.table-modern tbody td {
    padding: 8px;
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background-color: #f1f8ff;
}

.table-modern tbody tr.row-highlight {
    background-color: #e8f4ff;
}

/* Row Number */
.row-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #e9ecef;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    color: #6c757d;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
    border-color: #0057A8;
    box-shadow: 0 0 0 3px rgba(0,87,168,0.1);
}

.input-group .form-control {
    border: none !important;
    border-radius: 0 !important;
    padding: 10px 12px;
}

.input-group .form-control:focus {
    outline: none;
    box-shadow: none;
}

.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 14px;
    border-right: 1px solid #ccc;
    min-width: 42px;
}

/* Modal Small */
.modal-content-sm {
    max-width: 480px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.empty-state small {
    font-size: 13px;
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

/* Lock Badge */
.lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #6c757d;
    font-size: 12px;
    cursor: not-allowed;
}

/* Role-specific badges */
.badge-admindev {
    background: linear-gradient(135deg, #6f42c1, #8b5cf6);
}

.badge-bendahara {
    background: linear-gradient(135deg, #17a2b8, #20c997);
}

.badge-kepsek {
    background: linear-gradient(135deg, #e67e22, #f39c12);
}

code {
    background: #f1f3f5;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #e83e8c;
}

.text-center {
    text-align: center !important;
}

.text-rekening {
    color: #17a2b8;
}
