/*
 * style.css - FINAL VERSION (INCLUDES RESPONSIVE MOBILE FIXES)
 */

/* ==================================================== */
/* 1. BASE STYLES AND GLOBAL RESET */
/* ==================================================== */

body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

header {
    width: 100%;
    background-color: #004d99; /* Biru tua */
    color: white;
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header img {
    height: 40px;
    vertical-align: middle;
}

h2, h3 {
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 20px;
}

/* ==================================================== */
/* 2. LAYOUT & CONTAINERS (DESKTOP) */
/* ==================================================== */

.container-login { /* Class untuk Halaman Login Saja */
    background-color: #ffffff;
    padding: 30px 40px;
    border-radius: 12px; /* Lebih rounded */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15); /* Shadow lebih dalam */
    width: 100%;
    max-width: 400px; 
    margin: 100px auto;
    
    /* Tambahkan ini untuk memposisikan secara sentral di halaman */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.container-login h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.8em;
    color: #343a40;
    border-bottom: none;
}


.main-layout {
    display: flex;
    width: 95%; 
    max-width: 1300px;
    margin: 20px auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background-color: #fff; 
}

.content-area {
    flex-grow: 1;
    padding: 30px;
}

/* ==================================================== */
/* 3. SIDEBAR STYLING (DESKTOP) */
/* ==================================================== */
.sidebar {
    width: 250px;
    padding: 0;
    background-color: #343a40; /* Dark mode navigasi */
    color: #fff;
    min-height: 100%; 
    box-sizing: border-box;
}

.sidebar h3 {
    text-align: center;
    color: #fff;
    padding: 20px 10px;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #495057;
}

.profile-pic-container {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 20px;
}
.profile-pic-container img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
    background-color: #f0f0f0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex; 
    align-items: center;
    padding: 15px 20px;
    color: #adb5bd; 
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    font-size: 1em;
    border-left: 5px solid transparent;
}

.sidebar-nav a:hover {
    background-color: #495057; 
    color: #fff;
}

.sidebar-nav a.active {
    background-color: #007bff; /* Biru terang untuk active */
    color: #fff;
    font-weight: bold;
    border-left: 5px solid #28a745; /* Garis hijau di kiri */
}

/* Tombol Logout */
.logout-link {
    margin-top: 50px;
    padding: 0 20px;
}
.logout-link a {
    display: block;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    background-color: #dc3545; /* Merah */
    color: white;
    text-decoration: none;
    transition: background-color 0.2s;
}
.logout-link a:hover {
    background-color: #c82333;
}

/* ==================================================== */
/* 4. FORM & TABLE STYLING */
/* ==================================================== */

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
}

input[type="text"], input[type="password"], select, input[type="file"], input[type="date"] {
    width: 95%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

button[type="submit"], button.primary-btn {
    background-color: #28a745; 
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-weight: bold;
}

.remove_file {
    background-color: #dc3545 !important;
    padding: 10px 15px;
}

.profile-pic-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 10px;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}
th {
    background-color: #007bff; 
    color: white;
}
tr:nth-child(even) {
    background-color: #f9f9f9;
}
table a {
    color: #007bff;
    text-decoration: none;
}

/* Utilities */
.error { color: #dc3545; font-weight: bold; }
.success { color: #28a745; font-weight: bold; }

/* User2 Multi-File */
.file-input-group { 
    margin-bottom: 10px; 
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.file-input-group input { margin-bottom: 0; }
.file-input-group input[type="text"] { flex-grow: 1; }
.file-input-group input[type="file"] { width: 40%; }


/* ==================================================== */
/* 5. MEDIA QUERIES (MOBILE VIEW FIX) */
/* ==================================================== */

@media (max-width: 900px) {
    /* LAYOUT UTAMA: Ubah menjadi satu kolom */
    .main-layout {
        flex-direction: column; 
        margin: 0;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    .container-login {
        margin: 50px auto;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }


    /* SIDEBAR: Full-width dan disederhanakan */
    .sidebar {
        width: 100%;
        min-height: auto;
        padding: 10px 0;
        border-right: none;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    /* Sembunyikan Foto Profil dan Nama Admin/User */
    .profile-pic-container {
        display: none; 
    }

    .sidebar h3 {
        padding: 10px 20px;
        text-align: left;
        border-bottom: none;
    }

    /* Navigasi horizontal */
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
        padding: 0 10px;
    }

    .sidebar-nav a {
        flex-grow: 1; 
        text-align: center;
        padding: 8px 10px;
        margin-bottom: 5px;
        font-size: 0.8em;
        border-left: none; 
    }
    
    .logout-link {
        margin-top: 10px;
        padding: 0 20px;
    }
    .logout-link a {
        padding: 8px;
        font-size: 0.9em;
    }
    
    /* KONTEN UTAMA */
    .content-area {
        padding: 15px;
        width: 100%;
    }

    /* TABEL: Jadikan responsif (horizontal scroll) */
    table {
        display: block;
        width: 100%;
        overflow-x: auto; 
        white-space: nowrap; 
    }
    
    /* Form input full width */
    input[type="text"], input[type="password"], select, input[type="file"], input[type="date"] {
        width: 100%; 
    }
    
    /* Perbaikan tata letak tombol Filter/Search */
    .content-area > form:not(#mass_action_form):not([enctype="multipart/form-data"]) {
        flex-direction: column;
        align-items: stretch !important;
    }
    .content-area > form > div {
        width: 100%;
        margin-bottom: 10px;
    }
    .content-area > form > div:last-child {
        display: flex;
        gap: 10px;
    }
}