/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    /* Diperbarui: Menggunakan width persentase untuk lebih adaptif */
    width: 95%;
    /* Menggunakan 95% lebar viewport */
    max-width: 800px;
    /* Batas maksimum untuk layar sangat lebar */
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

h1,
h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    color: #333;
    background-color: #f9f9f9;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

button,
.button {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

button:hover,
.button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.button.red {
    background-color: #dc3545;
}

.button.red:hover {
    background-color: #c82333;
}

.button.green {
    background-color: #28a745;
}

.button.green:hover {
    background-color: #218838;
}

.button.orange {
    background-color: #ffc107;
    color: #333;
}

.button.orange:hover {
    background-color: #e0a800;
}

.message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.text-bold {
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 10px;
    display: block;
    /* Ensure it takes full width */
    color: #2c3e50;
    font-size: 1.1rem;
}

/* Wrapper for responsive table */
.table-responsive {
    overflow-x: auto;
    /* Adds horizontal scroll if content overflows */
    width: 100%;
    /* Ensures it takes full width of its parent */
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    /* Match container border-radius */
}

table {
    border-collapse: collapse;
    min-width: 800px;
    /* Ditingkatkan dari 1200px, sesuaikan jika masih terpotong */
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    white-space: nowrap;
    /* Mencegah teks memotong dalam sel di desktop */
}

table th {
    background-color: #f2f2f2;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    font-size: 0.9rem;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tr:hover {
    background-color: #f1f1f1;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.actions .button {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Responsive adjustments for tables */
@media (max-width: 300px) {
    .container {
        margin: 10px;
        padding: 15px;
        width: auto;
        /* Biarkan lebar otomatis untuk mobile */
        max-width: 100%;
        /* Pastikan tidak melebihi lebar viewport */
    }

    /* Remove overflow-x for mobile table wrapper, as we stack elements */
    .table-responsive {
        overflow-x: visible;
        box-shadow: none;
        /* Remove shadow for individual cards */
    }

    /* Make table elements behave like blocks */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, or accessibility suffers) */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Style table rows as cards */
    table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 5px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        padding: 10px;
        /* Add padding to the card itself */
    }

    /* Style table cells */
    table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        /* Diperbarui: Mengurangi padding untuk memberi ruang pada konten */
        text-align: right;
        word-wrap: break-word;
        /* Ensure long content breaks */
        white-space: normal;
        /* Allow text to wrap within cells on mobile */
        box-sizing: border-box;
        /* Pastikan padding termasuk dalam lebar elemen */
    }

    table td:last-child {
        border-bottom: none;
        /* No border for the last cell in a row */
    }

    /* Create the "label" for each cell using ::before */
    table td:before {
        position: absolute;
        top: 0;
        left: 6px;
        width: 45%;
        /* Diperbarui: Mengurangi lebar label sedikit */
        padding-right: 10px;
        white-space: nowrap;
        /* Prevent label from wrapping */
        text-align: left;
        font-weight: 600;
        color: #777;
        box-sizing: border-box;
        line-height: inherit;
        /* Inherit line-height from parent */
    }

    /* Labeling the data for small screens - MUST match the order and content of <th> in admin.php */
    table td:nth-of-type(1):before {
        content: "ID:";
    }

    table td:nth-of-type(2):before {
        content: "Tgl Lapor:";
    }

    table td:nth-of-type(3):before {
        content: "Pelapor:";
    }

    table td:nth-of-type(4):before {
        content: "Bulan:";
    }

    table td:nth-of-type(5):before {
        content: "Daerah:";
    }

    table td:nth-of-type(6):before {
        content: "Desa:";
    }

    table td:nth-of-type(7):before {
        content: "Kelompok:";
    }

    table td:nth-of-type(8):before {
        content: "Pelatih Pria:";
    }

    table td:nth-of-type(9):before {
        content: "Pelatih Wanita:";
    }

    table td:nth-of-type(10):before {
        content: "Wajib Nderes Pria:";
    }

    table td:nth-of-type(11):before {
        content: "Hadir Pria:";
    }

    table td:nth-of-type(12):before {
        content: "% Pria:";
    }

    table td:nth-of-type(13):before {
        content: "Wajib Nderes Wanita:";
    }

    table td:nth-of-type(14):before {
        content: "Hadir Wanita:";
    }

    table td:nth-of-type(15):before {
        content: "% Wanita:";
    }

    table td:nth-of-type(16):before {
        content: "Catatan:";
    }

    table td:nth-of-type(17):before {
        content: "Aksi:";
    }

    .actions {
        justify-content: flex-end;
        padding-top: 10px;
        border-top: 1px solid #eee;
        margin-top: 10px;
        padding-left: 6px;
        /* Reset padding for actions row */
        text-align: left;
        /* Align actions to left */
    }
}

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Perbaikan: Memastikan lebar input username dan password konsisten */
.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    /* Mengambil lebar penuh dari parent */
    padding: 12px;
    /* Pastikan padding diterapkan */
    border: 1px solid #ccc;
    /* Pastikan border diterapkan */
    border-radius: 5px;
    /* Pastikan border-radius diterapkan */
    box-sizing: border-box;
    /* Penting: Pastikan padding dan border termasuk dalam lebar */
    margin-bottom: 15px;
}

.login-container button {
    width: 100%;
    padding: 12px;
}
/* Diperbarui: Membuat tombol berderet ke samping */
.button-group {
    display: flex;
    /* Menggunakan flexbox untuk tata letak horizontal */
    flex-wrap: wrap;
    /* Memungkinkan tombol untuk pindah baris jika tidak cukup ruang */
    justify-content: flex-start;
    /* Tombol dimulai dari kiri */
    gap: 10px;
    /* Jarak antar tombol */
    margin-bottom: 20px;
    align-items: center;
    /* Pusatkan secara vertikal */
}

.button-group.left {
    justify-content: flex-start;
}

.button-group.center {
    justify-content: center;
}

.back-link {
    display: block;
    margin-top: 20px;
    text-align: center;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

/* Diperbarui: Membuat tombol export berderet ke samping */
.export-buttons {
    display: flex;
    /* Menggunakan flexbox */
    gap: 10px;
    /* Jarak antar tombol */
    justify-content: flex-start;
    /* Tombol dimulai dari kiri */
    flex-wrap: wrap;
    /* Memungkinkan tombol untuk pindah baris */
    margin-top: 0;
    /* Hapus margin-top, karena sudah ada di button-group */
}