/* ================================
   FITUR ADMIN - TABLE, FORM, SEARCH, PAGINATION
================================ */

:root {
    --primary-green: #2D7A47;
    --primary-green-dark: #1B4D2E;
    --soft-green: #ecfdf5;
    --accent-yellow: #FFD700;
    --danger-red: #ef4444;
    --danger-red-dark: #dc2626;
    --warning-yellow: #f59e0b;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-soft: #e2e8f0;
    --border-table: #d5dee8;
    --bg-soft: #f8fafc;
    --white: #ffffff;
}

/* Header halaman master */
.master-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.master-page-title {
    margin: 0;
    font-weight: 900;
    color: var(--text-dark);
    letter-spacing: -0.4px;
}

.master-page-subtitle {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Tombol tambah data */
.btn-add-modern {
    border: none;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: #ffffff !important;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(45, 122, 71, 0.22);
    transition: 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-add-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(45, 122, 71, 0.28);
    color: #ffffff !important;
}

/* Container tabel */
.table-container-modern {
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

/* Toolbar search dan jumlah data */
.table-toolbar {
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.search-wrapper-modern {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-wrapper-modern i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
}

.search-input-modern {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 0 16px 0 42px;
    outline: none;
    font-size: 14px;
    color: var(--text-dark);
    background: #ffffff;
    transition: 0.25s ease;
}

.search-input-modern::placeholder {
    color: #94a3b8;
}

.search-input-modern:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(45, 122, 71, 0.12);
}

.per-page-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
}

.per-page-select {
    height: 46px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 0 12px;
    outline: none;
    color: var(--text-dark);
    font-weight: 800;
    background: #ffffff;
    cursor: pointer;
}

.per-page-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(45, 122, 71, 0.12);
}

/* Tabel modern */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0 !important;
    background: #ffffff;
}

/* Header tabel */
.table-modern thead th {
    background-color: #f8fafc;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 900;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-table) !important;
    white-space: nowrap;
}

/* Garis pemisah antar kolom bagian header */
.table-modern thead th:not(:last-child) {
    border-right: 1px solid var(--border-table) !important;
}

/* Isi tabel */
.table-modern tbody td {
    padding: 17px 18px;
    border-bottom: 1px solid #e8eef5 !important;
    vertical-align: middle;
    color: var(--text-dark);
    font-size: 14px;
}

/* Garis pemisah antar kolom bagian isi tabel */
.table-modern tbody td:not(:last-child) {
    border-right: 1px solid var(--border-table) !important;
}

/* Baris terakhir tidak perlu garis bawah */
.table-modern tbody tr:last-child td {
    border-bottom: none !important;
}

.table-modern tbody tr {
    transition: 0.22s ease;
}

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

/* Kolom nomor dan opsi lebih rapi */
.table-modern th.text-center,
.table-modern td.text-center {
    text-align: center;
}

/* Kolom opsi dibuat lebih lebar agar teks tombol tidak sempit */
.table-modern thead th:last-child,
.table-modern tbody td:last-child {
    min-width: 190px;
}

/* Cell user / nama */
.table-user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: var(--primary-green-dark);
    font-weight: 900;
    flex: 0 0 40px;
    font-size: 15px;
}

.avatar-circle.blue {
    background: #eff6ff;
    color: #2563eb;
}

.avatar-circle.purple {
    background: #faf5ff;
    color: #9333ea;
}

.avatar-circle.orange {
    background: #fff7ed;
    color: #ea580c;
}

.text-cell-muted {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

/* Badge */
.badge-soft {
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
}

.badge-kelas {
    background: #ecfdf5;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-saintek {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-soshum {
    background-color: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-bk {
    background-color: #ecfdf5;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-result {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Tetap mendukung class badge Bootstrap / lama */
.badge {
    display: inline-block;
    padding: 0.45em 0.75em;
    font-size: 0.75em;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 50rem;
}

/* Opsi tombol aksi */
.opsi-wrapper {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* Tombol edit dan hapus dibuat jelas dengan teks */
.btn-action {
    min-width: 84px;
    height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 12px;
    border: none;
    color: #ffffff !important;
    transition: 0.22s ease;
    cursor: pointer;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.btn-action i {
    font-size: 13px;
}

.btn-action:hover {
    transform: translateY(-2px);
    color: #ffffff !important;
    text-decoration: none !important;
}

.btn-edit {
    background-color: #22c55e;
}

.btn-edit:hover {
    background-color: #16a34a;
    box-shadow: 0 10px 18px rgba(34, 197, 94, 0.22);
}

.btn-delete {
    background-color: #ef4444;
}

.btn-delete:hover {
    background-color: #dc2626;
    box-shadow: 0 10px 18px rgba(239, 68, 68, 0.22);
}

/* Menambahkan tulisan otomatis pada tombol yang di Blade masih hanya ikon */
.btn-edit::after {
    content: "Edit";
}

.btn-delete::after {
    content: "Hapus";
}

/* Tombol detail riwayat */
.btn-detail {
    border: none;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 900;
    transition: 0.22s ease;
}

.btn-detail:hover {
    background: #2563eb;
    color: #ffffff;
}

/* Pagination */
.pagination-container {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-top: 1px solid var(--border-soft);
    gap: 14px;
    flex-wrap: wrap;
}

.page-link-custom {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-soft);
    background-color: #ffffff;
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: 0.22s ease;
}

.page-link-custom:hover:not(:disabled) {
    background-color: #ecfdf5;
    color: var(--primary-green);
    border-color: #bbf7d0;
}

.page-link-custom.active {
    background-color: var(--primary-green);
    color: #ffffff;
    border-color: var(--primary-green);
}

.page-link-custom:disabled {
    background-color: #f8fafc;
    cursor: not-allowed;
    opacity: 0.55;
}

/* Loading dan data kosong */
.empty-state-modern {
    padding: 36px 20px !important;
    text-align: center;
    color: var(--text-muted) !important;
}

.empty-state-modern i {
    display: block;
    font-size: 28px;
    margin-bottom: 10px;
    color: #cbd5e1;
}

.loading-state-modern {
    padding: 36px 20px !important;
    text-align: center;
    color: var(--text-muted) !important;
}

.loading-state-modern i {
    color: var(--primary-green);
}

/* Form Styling */
.form-group-custom {
    margin-bottom: 1.5rem;
}

.form-group-custom label {
    font-size: 13px;
    font-weight: 800;
    color: #475569;
    margin-bottom: 8px;
    display: block;
}

.input-custom {
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 12px 15px !important;
    font-size: 14px;
    width: 100%;
    background: #ffffff;
    color: var(--text-dark);
}

.input-custom:focus {
    border-color: var(--primary-green) !important;
    box-shadow: 0 0 0 4px rgba(45, 122, 71, 0.12) !important;
    outline: none;
}

/* Card umum untuk form */
.form-card-modern {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
    padding: 24px;
}

/* Button umum form */
.btn-save-modern {
    border: none;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: #ffffff;
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 900;
    transition: 0.22s ease;
}

.btn-save-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(45, 122, 71, 0.22);
    color: #ffffff;
}

.btn-back-modern {
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: #475569;
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 900;
    text-decoration: none;
    transition: 0.22s ease;
}

.btn-back-modern:hover {
    background: #f8fafc;
    color: var(--primary-green);
}

/* Responsive */
@media (max-width: 992px) {
    .btn-action {
        min-width: 78px;
        padding: 0 11px;
        font-size: 12px;
    }

    .table-modern thead th:last-child,
    .table-modern tbody td:last-child {
        min-width: 175px;
    }
}

@media (max-width: 768px) {
    .master-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .btn-add-modern {
        width: 100%;
        justify-content: center;
    }

    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-wrapper-modern {
        min-width: 100%;
    }

    .per-page-wrapper {
        justify-content: space-between;
    }

    .per-page-select {
        min-width: 120px;
    }

    .pagination-container {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-modern thead th,
    .table-modern tbody td {
        padding: 14px 14px;
        font-size: 13px;
    }

    .avatar-circle {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        flex-basis: 36px;
    }

    .opsi-wrapper {
        flex-direction: column;
        gap: 6px;
    }

    .btn-action {
        min-width: 78px;
        height: 34px;
        font-size: 12px;
        border-radius: 10px;
    }
}