/* General Body and Container */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f7; /* Light gray for macOS feel */
    color: #333;
    line-height: 1.6;
    overflow-x: hidden; /* Penting: mencegah horizontal scrolling yang tidak diinginkan */
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between; /* Menjaga header-left dan header-right terpisah */
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0; /* Pastikan header mulai dari kiri */
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    height: 60px; /* Tinggi tetap untuk header */
    box-sizing: border-box; /* Pastikan padding dan border masuk hitungan tinggi */
}

.app-header .header-left {
    display: flex;
    align-items: center;
    gap: 15px; /* Spasi antara burger menu dan logo */
}

.app-header .logo {
    font-weight: 600;
    font-size: 1.2em;
    color: #333;
    white-space: nowrap; /* Mencegah logo melipat di desktop */
    overflow: hidden;
    text-overflow: ellipsis;
}

.burger-menu {
    background: none;
    border: none;
    font-size: 1.2em; /* **Ukuran ikon burger lebih kecil** */
    cursor: pointer;
    display: none; /* Hidden on desktop by default */
    color: #555;
    padding: 5px; /* Sesuaikan padding */
    border-radius: 5px;
    transition: background-color 0.2s;
}
.burger-menu:hover {
    background-color: #e0e0e0;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #f7f7f7; /* Lighter sidebar background */
    padding-top: 80px; /* Space for fixed header */
    border-right: 1px solid #e0e0e0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.02);
    flex-shrink: 0; /* Prevent shrinking */
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out; /* Animasi lembut */
    position: relative; /* Penting untuk posisi tombol tutup */
}

/* Tombol Tutup di Sidebar */
.sidebar-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5em;
    color: #555;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s;
    display: none; /* Sembunyikan secara default, tampilkan di mobile */
    z-index: 1001; /* Pastikan di atas konten sidebar */
}
.sidebar-close-btn:hover {
    background-color: #e0e0e0;
}

.sidebar .main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar .main-nav li a {
    display: block;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 0.2s, border-left-color 0.2s, color 0.2s;
}

.sidebar .main-nav li a:hover {
    background-color: #e5e5e5;
    color: #000;
}

.sidebar .main-nav li a.active {
    background-color: #d6eaff;
    border-left-color: #007aff;
    color: #007aff;
    font-weight: 600;
}

.main-content {
    flex-grow: 1; /* Penting: agar main-content mengisi sisa ruang horizontal */
    /* **Revisi Padding untuk Desktop:** */
    padding: 80px 20px 20px 0; /* Hanya padding-top untuk header. Padding samping dan bawah akan diatur oleh content-wrapper */
    margin-left: 20px; /* Space for sidebar JARAK DI PC*/
    transition: margin-left 0.3s ease-in-out; /* Animasi lembut */

    /* DEFAULT UNTUK DESKTOP */
    display: flex; /* Aktifkan flex */
    flex-direction: column; /* Konten di dalamnya akan bertumpuk vertikal */
    align-items: flex-start; /* Konten ratakan ke kiri */
    justify-content: flex-start; /* Konten ratakan ke atas */
    overflow-x: auto; /* Memungkinkan scroll horizontal jika konten di dalamnya meluber */
}

.content-wrapper {
    background-color: #ffffff;
    /* **Revisi Padding dan Margin untuk Desktop:** */
    padding: 30px; /* Padding internal kotak konten */
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    box-sizing: border-box; /* Pastikan padding dan border masuk hitungan lebar */

    /* DEFAULT UNTUK DESKTOP */
    max-width: none; /* Hapus max-width di desktop */
    width: 100%; /* Memenuhi seluruh lebar tersedia dalam main-content */
    margin: 0; /* **PENTING: Pastikan tidak ada margin sama sekali di desktop** */
    flex-shrink: 0; /* Pastikan tidak menyusut */

    /* Tambahan: Pastikan content-wrapper mengisi sisa ruang di main-content */
    flex-grow: 1;
}

h1, h2, h3, h4 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
}

/* Forms */
.form-inline {
    display: flex;
    flex-wrap: wrap; /* Izinkan item melipat */
    gap: 15px; /* Spasi antar form group */
    align-items: flex-end; /* Ratakan ke bawah */
    margin-bottom: 20px;
}
.form-inline .form-group {
    flex: 1; /* Biarkan form group tumbuh */
    min-width: 150px; /* Lebar minimal agar tidak terlalu kecil */
    margin-bottom: 0; /* Hapus margin bawah default */
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="month"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
select:focus,
textarea:focus {
    border-color: #007aff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

button, .btn-primary, .btn-secondary, .btn-delete, .btn-small {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s, opacity 0.2s;
    margin-right: 10px;
    flex-shrink: 0; /* Mencegah tombol mengecil terlalu banyak */
}

button {
    background-color: #007aff;
    color: white;
}
button:hover {
    background-color: #005bb5;
}

.btn-primary {
    background-color: #007aff;
    color: white;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn-primary:hover {
    background-color: #005bb5;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-delete {
    background-color: #ff3b30;
    color: white;
}
.btn-delete:hover {
    background-color: #cc0000;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
    margin-right: 5px;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

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

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

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden; /* For rounded corners */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table th, table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

table th {
    background-color: #f7f7f7;
    font-weight: 600;
    color: #555;
}

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

table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Sub-menu (for Data Siswa) */
.sub-menu ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sub-menu li a {
    display: block;
    padding: 10px 15px;
    background-color: #007aff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s;
}
.sub-menu li a:hover {
    background-color: #005bb5;
}

/* Modal Styling */
.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.4);
    display: flex; /* Change from 'block' when shown by JS */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Barcode Item for Printing (these styles are more relevant for print_barcode_*.php files) */
.barcode-item {
    display: inline-block;
    width: 2.5in;
    height: 1.25in;
    border: 1px solid #ccc;
    margin: 5px;
    padding: 5px;
    box-sizing: border-box;
    text-align: center;
    vertical-align: top;
    overflow: hidden;
}

.barcode-item svg {
    width: 100%;
    height: auto;
    display: block;
    margin: auto;
}

.barcode-item p {
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    word-wrap: break-word;
}


/* --- App Drawer Styles (macOS-like) --- */
.home-dashboard-content {
    text-align: center;
    padding: 20px;
}

.welcome-title {
    font-size: 2.2em;
    color: #222;
    
    margin-bottom: 2px;
    font-weight: 600;
}

.school-name-welcome {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 4px;
}

.app-drawer-heading {
    font-size: 1.8em;
    color: #333;
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 500;
}

.app-drawer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Responsif, min 140px */
    gap: 25px; /* Spasi antar ikon */
    justify-content: center;
    max-width: 1000px; /* Lebar maksimum grid */
    margin: 0 auto; /* Pusatkan grid */
    padding: 20px;
}

.app-drawer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border-radius: 15px; /* Sudut membulat */
    padding: 15px 10px; /* Padding di dalam item */
    background-color: #ffffff; /* Latar belakang putih */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Bayangan default */
    text-align: center;
}

.app-drawer-item:hover {
    transform: translateY(-5px); /* Efek angkat */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); /* Bayangan lebih kuat saat hover */
}

.app-icon {
    width: 80px; /* Ukuran ikon */
    height: 80px;
    background-color: #e0e0e0; /* Latar belakang ikon */
    border-radius: 18%; /* Bentuk ikon (sedikit membulat dari persegi) */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1); /* Bayangan dalam */
}

.app-icon .unicode-icon { /* Gaya khusus untuk ikon Unicode */
    font-size: 3.5em; /* Ukuran emoji */
    line-height: 1; /* Pastikan emoji tidak membuat tinggi baris aneh */
}

.app-label {
    font-size: 1.1em;
    font-weight: 500;
    white-space: normal; /* Izinkan label melipat */
    word-wrap: break-word;
    max-width: 100%; /* Pastikan label tidak meluber */
}

/* Responsiveness for mobile devices (media queries) */
/* Responsiveness for mobile devices (media queries) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Burger menu visibility on mobile */
    .burger-menu {
        display: block; /* Tampilkan burger menu di mobile */
    }

    /* Header di mobile agar logo tidak terpotong */
    .app-header .logo {
        font-size: 1em; /* Kecilkan ukuran logo di mobile */
        flex-grow: 1; /* Biarkan logo tumbuh mengisi ruang */
        text-align: left; /* Ratakan logo ke kiri */
        margin-right: 10px; /* Sedikit spasi kanan logo */
    }
    .app-header .header-left {
        width: 100%; /* Biarkan header-left mengisi penuh */
        justify-content: flex-start; /* Ratakan ke kiri */
    }
    .app-header .header-right {
        /* Kosongkan jika tidak ada konten di kanan */
    }


    /* Sidebar di mobile */
    .sidebar {
        width: 250px; /* Lebar sidebar saat terbuka */
        position: fixed;
        top: 0; /* Mulai dari atas */
        left: 0;
        height: 100vh; /* Set tinggi penuh viewport */
        transform: translateX(-100%); /* Sembunyikan sidebar secara default */
        z-index: 999;
        padding-top: 60px; /* Padding untuk ruang header, harus sama dengan tinggi header */
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1); /* Bayangan lebih jelas saat terbuka */
        box-sizing: border-box; /* Pastikan padding masuk dalam tinggi */
    }

    /* Tampilkan tombol tutup sidebar di mobile */
    .sidebar-close-btn {
        display: block;
        top: 15px; /* Sesuaikan posisi agar pas di header sidebar */
        right: 15px;
        z-index: 1001; /* Pastikan di atas konten sidebar */
    }

    .sidebar.open {
        transform: translateX(0); /* Geser sidebar masuk saat terbuka */
    }

    /* Main content di mobile */
    .main-content {
        margin-left: 0; /* Tidak ada margin kiri */
        padding-top: calc(60px + 7px); /* Tinggi header + padding tambahan di atas konten */
        padding-bottom: 20px; /* Tambahan padding bottom agar konten tidak mentok bawah */

        /* Override for Mobile */
        display: flex; /* Tetap flex di mobile */
        flex-direction: column; /* Konten di dalamnya akan bertumpuk vertikal */
        align-items: center; /* Pusatkan content-wrapper di mobile */
        justify-content: flex-start; /* Konten ratakan ke atas */
        /* Pastikan padding samping juga diatur di mobile */
        padding-left: 7px;
        padding-right: 7px;
    }
    .content-wrapper {
        padding: 20px; /* Kurangi padding default 30px agar lebih lega di mobile */

        /* Override for Mobile */
        max-width: 500px; /* Tetapkan max-width di mobile */
        width: 100%; /* Mengisi 100% dari max-width atau ruang tersedia */
        margin: 0 auto; /* Pusatkan secara horizontal di mobile */
    }



    /* Overlay untuk sidebar terbuka */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
        display: none; /* Default hidden, ditoggle oleh JS */
    }
    .sidebar.open + .sidebar-overlay { /* Jika sidebar terbuka, tampilkan overlay */
        display: block;
    }

    /* App drawer di mobile */
    .welcome-title {
        font-size: 1.8em;
    }
    .school-name-welcome {
        font-size: 1em;
    }
    .app-drawer-heading {
        font-size: 1.5em;
    }
    .app-drawer-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Lebih kecil di mobile */
        gap: 15px;
        padding: 15px;
    }
    .app-drawer-item {
        padding: 10px 5px;
    }
    .app-icon {
        width: 60px;
        height: 60px;
    }
    .app-icon .unicode-icon {
        font-size: 2.5em;
    }
    .app-label {
        font-size: 0.9em;
    }
}

@media (max-width: 600px) {
    .app-drawer-grid {
        grid-template-columns: repeat(3, 3fr); /* 2 kolom di layar sangat kecil */
    }
    .app-header .logo {
        font-size: 0.9em; /* Kecilkan lagi logo di layar sangat kecil */
    }
}

/* Print Specific Styles */
@media print {
    body {
        margin: 0;
        padding: 0;
        background-color: white;
    }
    .app-header, .sidebar, .print-exclude {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
    .content-wrapper {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
    table {
        box-shadow: none;
    }
    @page {
        size: A4 landscape;
        margin: 1cm;
    }
    .barcode-page-break {
        page-break-after: always;
    }
    .barcode-item {
        margin: 0.05in;
        border: none;
    }
}
.data-admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 600px; /* Minimal width for desktop/tablet, enables scroll on mobile */
}

.data-admin-table th,
.data-admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    white-space: nowrap; /* Teks tidak melipat di desktop */
    overflow: hidden;
    text-overflow: ellipsis; /* Elipsis jika terpotong */
}

.data-admin-table th {
    background-color: #f7f7f7;
    font-weight: 600;
    color: #555;
}

.data-admin-table tr:last-child td {
    border-bottom: none;
}

.data-admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-admin-table .action-column {
    text-align: center;
    width: 150px; /* Beri lebar tetap untuk kolom aksi di desktop */
    white-space: normal; /* Biarkan tombol melipat di sini */
}

/* Penyesuaian untuk tombol aksi dalam tabel admin */
.data-admin-table .action-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}
.data-admin-table .btn-small {
    min-width: unset; /* Reset min-width dari global */
    flex-shrink: 0;
}
.data-admin-table .inline-form {
    display: inline-block;
}

/* Responsiveness for admin tables */
@media (max-width: 768px) {
    .data-admin-table {
        min-width: 450px; /* Lebar minimal untuk scroll horizontal di mobile */
    }
    .data-admin-table th,
    .data-admin-table td {
        font-size: 0.85em;
        padding: 8px 10px;
        white-space: normal; /* Teks melipat di mobile */
        overflow: visible;
        text-overflow: clip;
    }
    .data-admin-table .action-column {
        width: auto;
        padding: 5px;
    }
    .data-admin-table .action-buttons-group {
        flex-direction: column; /* Tumpuk tombol aksi di mobile */
        gap: 2px;
    }
    .data-admin-table .btn-small {
        width: 100%; /* Tombol memenuhi lebar sel */
    }
}
/* Prefix khusus: .btn-cx-* untuk hindari bentrok */

/* Tombol dasar */
.btn-cx {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.95em;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Icon */
.btn-cx i {
  font-size: 1em;
}

/* Tombol Edit */
.btn-cx-edit {
  background-color: #007aff;
  color: #ffffff;
}
.btn-cx-edit:hover {
  background-color: #005bb5;
}

/* Tombol Hapus */
.btn-cx-delete {
  background-color: #ff3b30;
  color: #ffffff;
}
.btn-cx-delete:hover {
  background-color: #cc1e10;
}

