/* =====================================================
   components.css
   Elemen UI yang SERING DIPAKAI ULANG di berbagai modul.
   Kalau butuh komponen baru yang bakal dipakai berkali-kali
   (mis. pagination), tambahkan di sini — bukan di style.css.
   ===================================================== */

/* ---------- Form input (dipakai di modal & login) ---------- */
.form-control,
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    margin-top: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- Tombol ---------- */
.btn-primary {
    background: #2563eb; color: #fff; border: none;
    padding: 9px 16px; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 600;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
    background: #e5e7eb; color: #111827; border: none;
    padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.btn-secondary:hover { background: #d1d5db; }

.btn-danger {
    background: #dc2626; color: #fff; border: none;
    padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 13px;
}
.btn-danger:hover { background: #b91c1c; }

.btn-edit {
    background: #f59e0b; color: #fff; border: none;
    padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; margin-right: 4px;
}
.btn-edit:hover { background: #d97706; }

/* ---------- Badge (status) ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.badge-aktif   { background: #dcfce7; color: #15803d; }
.badge-nonaktif{ background: #fee2e2; color: #b91c1c; }
.badge-admin   { background: #dbeafe; color: #1d4ed8; }
.badge-staff   { background: #f3f4f6; color: #374151; }

/* =====================================================
   KOMPONEN TABEL (dipasangkan dengan partial
   app/Views/partials/table.php)
   ===================================================== */
.table-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 16px; flex-wrap: wrap;
}
.search-input { max-width: 280px; margin-top: 0; }

.table-responsive { width: 100%; overflow-x: auto; }

.data-table {
    width: 100%; background: #fff; border-collapse: collapse;
    margin-top: 12px; border-radius: 8px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.data-table th, .data-table td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.data-table th { background: #f9fafb; font-weight: 600; color: #374151; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table td.actions-cell { white-space: nowrap; }

/* --- Mode mobile: baris tabel berubah jadi "card" --- */
@media (max-width: 768px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }

    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 4px 0;
        box-shadow: 0 1px 3px rgba(0,0,0,.06);
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 12px;
        border-bottom: 1px solid #f5f5f5;
        text-align: right;
    }
    .data-table tr:last-child, .data-table td:last-child { border-bottom: none; }

    /* Label kolom muncul dari atribut data-label yang di-set oleh JS saat render baris */
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        margin-right: auto;
    }
    .data-table td.actions-cell { justify-content: flex-end; }
    .data-table td.actions-cell::before { content: ''; margin-right: 0; }
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; padding: 16px;
}
.modal-box {
    background: #fff; padding: 24px; border-radius: 10px;
    width: 420px; max-width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-box h2 { margin-bottom: 16px; font-size: 18px; }
.modal-box label { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; color: #374151; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 20px; right: 20px; left: 20px; margin: 0 auto;
    max-width: 320px; background: #111827; color: #fff;
    padding: 12px 18px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none;
    transform: translateY(10px); transition: all .25s ease; z-index: 100; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #dc2626; }

@media (min-width: 480px) {
    .toast { left: auto; right: 20px; margin: 0; }
}
