:root {
    --primary-color: #007bff;
    --primary-hover-color: #0056b3;
    --secondary-color: #6c757d;
    --background-color: #f4f7f9;
    --card-background: #ffffff;
    --border-color: #e9ecef;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05);
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    line-height: 1.6;
    color: #343a40; /* Teks gelap standar */
}

/* Kontainer Utama Aplikasi */
.sp-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow-light);
}

/* Header (Judul dan Tombol Tambah) */
.sp-container .sp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.sp-container .sp-header h2 {
    margin: 0;
    color: #b4a9a9;
    font-size: 1.8rem;
    font-weight: 600;
}

/* Tombol */
.sp-button {
    /* padding: 10px 20px; */
    border: none;
    /* border-radius: 6px; */
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    text-transform: capitalize;
}

.sp-button-large {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1rem;
}

.sp-button-small {
    padding: 2px 3px;
    border-radius: 2px;
}

.sp-button { /* Tombol Primer (Tambah/Simpan) */
    background-color: var(--primary-color);
    color: white;
    margin: 3px;
}

.sp-button:hover {
    background-color: var(--primary-hover-color); /* Sedikit lebih gelap */
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.sp-button-secondary { /* Tombol Sekunder (Batal) */
    background-color: var(--secondary-color);
    color: white;
    margin-left: 10px;
}

.sp-button-secondary:hover {
    background-color: #5a6268;
}

.sp-btn-danger {
    background-color: #dc3545;
    color: white;
}
.sp-btn-danger:hover {
    background-color: #c82333;
}
.sp-btn-warning {
    background-color: #ffc107;
    color: #212529;
}
.sp-btn-warning:hover {
    background-color: #e0a800;
}
.sp-btn-info {
    background-color: var(--primary-color);
    color: white;
}
.sp-btn-info:hover, .sp-btn-info:focus {
    background-color: var(--primary-hover-color);
    color: white !important;
}


/* Tabel Data */
.sp-table {
    width: 100%;
    border-collapse: separate; /* Untuk radius border pada table */
    border-spacing: 0;
    margin-top: 20px;
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden; /* Penting agar border-radius berfungsi pada children */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    font-size : 10px;
}

.sp-table thead {
    background-color: var(--border-color);
}

.sp-table th {
    text-align: left;
    padding: 3px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    /* font-size: 0.85rem; */
}

.sp-table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.sp-table tbody tr:hover {
    background-color: #f0f8ff; /* Light blue hover */
}

.sp-table td {
    padding: 3px;
    border-bottom: 1px solid var(--border-color);
    color: #495057;
}

.sp-table tbody tr:last-child td {
    border-bottom: none;
}

/* Loading state */
.sp-table tbody tr td[colspan="5"] {
    text-align: center;
    font-style: italic;
    color: var(--secondary-color);
}

/* Aksi Tombol di Tabel */
.sp-table .sp-actions button {
    /* Gaya tombol Aksi Edit/Delete */
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    margin-right: 5px;
    transition: color 0.1s;
}

.sp-table .sp-actions button:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Modal */
.sp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Overlay gelap */
    display: none; /* Default tersembunyi */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Pastikan di atas semua elemen */
}

/* Tampilkan modal saat "aktif" (menggunakan JS) */
.sp-modal[aria-hidden="false"] {
    display: flex;
}

.sp-modal-content {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Efek pantul */
}

.sp-modal[aria-hidden="false"] .sp-modal-content {
    transform: scale(1);
    opacity: 1;
}

.sp-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #333;
}

/* Form */
.sp-form-row {
    margin-bottom: 20px;
}

.sp-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.sp-form-row input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box; /* Penting agar padding tidak menambah lebar */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sp-form-row input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

.sp-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsif Sederhana */
@media (max-width: 768px) {
    .sp-container {
        margin: 20px;
        padding: 20px;
    }

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

    .sp-container .sp-header h2 {
        margin-bottom: 15px;
    }

    /* Membuat tabel lebih responsif pada layar kecil */
    .sp-table, .sp-table thead, .sp-table tbody, .sp-table th, .sp-table td, .sp-table tr {
        display: block;
    }

    .sp-table thead {
        display: none; /* Sembunyikan header tabel */
    }

    .sp-table tr {
        margin-bottom: 10px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }

    .sp-table td {
        border: none;
        position: relative;
        padding-left: 50%; /* Sisakan ruang untuk label */
        text-align: right;
    }

    .sp-table td:before {
        /* Tambahkan label header sebagai pseudo-element */
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 15px;
        font-weight: 600;
        text-align: left;
        color: #495057;
    }

    /* Atur label untuk mode responsif */
    .sp-table tbody tr:first-child td:nth-child(1):before { content: "ID"; }
    .sp-table tbody tr:first-child td:nth-child(2):before { content: "Nama"; }
    .sp-table tbody tr:first-child td:nth-child(3):before { content: "Dibuat"; }
    .sp-table tbody tr:first-child td:nth-child(4):before { content: "Diubah"; }
    .sp-table tbody tr:first-child td:nth-child(5):before { content: "Aksi"; }
    
    /* Perlu menambahkan `data-label` ke <td> saat data dimuat via JS agar berfungsi */
    /* Contoh: <td data-label="Nama">Data Nama</td> */
}

/* Untuk mode loading di mobile */
@media (max-width: 768px) {
    .sp-table tbody tr td[colspan="5"] {
        display: table-cell; /* Kembali ke tampilan cell untuk loading */
        text-align: center;
        padding-left: 0;
    }
    .sp-table tbody tr td[colspan="5"]:before {
        content: none;
    }
}