/* ==========================================================================
   RESET DASAR & FONT UTAMA
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f7fc;
    color: #333;
    line-height: 1.6;
    margin: 0;
}

a {
    text-decoration: none;
    color: #007bff;
}

a:hover {
    color: #0056b3;
}

/* ==========================================================================
   STYLING KHUSUS HALAMAN LOGIN
   ========================================================================== */
body.login-page {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 100vh !important;
    padding: 20px !important;
    background-color: #f0f2f5 !important;
    font-family: 'Poppins', sans-serif !important;
    color: #333 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
}

.login-container {
    background-color: #ffffff;
    padding: 40px 45px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border-top: 5px solid #007bff;
    /* flex-grow: 0; /* Jangan biarkan container ini memuai jika body flex */
    /* flex-shrink: 0; /* Jangan biarkan container ini menyusut jika body flex */
}

.login-container img.logo {
    max-width: 80px;
    margin-bottom: 25px;
}

.login-container h2 {
    margin-bottom: 30px;
    color: #333;
    font-weight: 600;
    font-size: 1.75em;
}

.login-container .form-group {
    margin-bottom: 25px;
    text-align: left;
}

/* Ini akan menargetkan semua .form-control di dalam .login-container */
.login-container .form-control {
    /* Styling spesifik jika diperlukan, jika tidak, akan mengambil dari style umum */
}

.login-container .btn-primary {
    width: 100%;
}

.login-container .alert {
    margin-bottom: 1.5rem;
    text-align: left;
    font-size: 0.9em;
}


/* ==========================================================================
   STYLING ADMIN PANEL LAYOUT (WRAPPER, SIDEBAR, TOPBAR, CONTENT)
   ========================================================================== */

/* Pastikan .admin-wrapper hanya aktif jika body TIDAK memiliki class .login-page */
body:not(.login-page) .admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: #ffffff;
    color: #333;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1001;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar.active {
    transform: translateX(0);
}

/* Untuk mobile toggle */

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-header .logo {
    max-width: 40px;
    height: auto;
    margin-right: 12px;
}

.sidebar-header h2 {
    font-size: 1.3em;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #495057;
    border-radius: 6px;
    margin-bottom: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500;
    font-size: 0.95em;
}

.sidebar-nav ul li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    color: #6c757d;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
    background-color: #e9f5ff;
    color: #007bff;
}

.sidebar-nav ul li a:hover i,
.sidebar-nav ul li a.active i {
    color: #007bff;
}

.nav-separator {
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 0.8em;
    font-weight: 600;
    color: #adb5bd;
    text-transform: uppercase;
    border-top: 1px solid #eee;
}

.nav-separator:first-child {
    border-top: none;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.logout-button-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    color: #dc3545;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.logout-button-sidebar i {
    margin-right: 8px;
}

.logout-button-sidebar:hover {
    background-color: #dc3545;
    color: #fff;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #f4f7fc;
    /* Warna latar admin panel */
    overflow-x: hidden;
}

.top-bar {
    background-color: #ffffff;
    padding: 0 30px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.6em;
    color: #333;
    cursor: pointer;
    margin-right: 20px;
    display: none;
}

.top-bar h1 {
    font-size: 1.6em;
    font-weight: 600;
    color: #343a40;
    margin: 0;
}

.admin-profile {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.admin-profile .fa-user-circle {
    font-size: 1.8em;
    margin-right: 10px;
    color: #007bff;
}

.admin-profile span {
    margin-right: 15px;
    color: #495057;
    font-weight: 500;
}

.admin-profile .logout-link {
    color: #6c757d;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
}

.admin-profile .logout-link:hover {
    color: #dc3545;
    background-color: #f8f9fa;
}

.content-area {
    padding: 30px;
    flex-grow: 1;
    overflow-y: auto;
}

.admin-footer {
    text-align: center;
    padding: 20px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    font-size: 0.9em;
    color: #6c757d;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: .9rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-align: left;
}

.table tbody tr:hover {
    color: #212529;
    background-color: #f1f5f9;
}

.table.text-nowrap th,
.table.text-nowrap td {
    white-space: nowrap;
}

.table .text-center {
    text-align: center !important;
}

.table .btn-sm i {
    font-size: 0.9em;
}

.form-group {
    margin-bottom: 1.25rem;
}

/* Form group umum */
.form-group label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 500;
    color: #495057;
}

.form-control {
    /* Form control umum */
    display: block;
    width: 100%;
    padding: .75rem 1rem;
    font-size: 1em;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    appearance: none;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

select.form-control {
    -webkit-appearance: menulist-button;
    appearance: menulist-button;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
}

.form-text.text-muted {
    font-size: .875em;
    color: #6c757d !important;
}

.text-danger {
    color: #dc3545 !important;
}

.btn {
    /* Tombol umum */
    display: inline-block;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: #0d6efd;
    border: 1px solid #0d6efd;
    padding: .5rem 1rem;
    font-size: 1rem;
    border-radius: .25rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.btn i {
    margin-left: 5px;
}

.btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

.btn-info {
    color: #000;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.btn-info:hover {
    background-color: #31d2f2;
    border-color: #25cff2;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.btn-sm {
    padding: .25rem .5rem;
    font-size: .875rem;
    border-radius: .2rem;
}

.alert {
    position: relative;
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: .25rem;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.page-options .btn {
    margin-left: 0.5rem;
}

.badge {
    display: inline-block;
    padding: .35em .65em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
}

.badge-role-superadmin {
    background-color: #6f42c1;
}

.badge-role-event_admin {
    background-color: #007bff;
}

.badge-role-attendance_officer {
    background-color: #fd7e14;
}

.badge-status-active {
    background-color: #198754;
}

.badge-status-inactive {
    background-color: #6c757d;
}

.custom-control {
    position: relative;
    display: block;
    min-height: 1.5rem;
    padding-left: 1.75rem;
}

.custom-control-inline {
    display: inline-flex;
    margin-right: 1rem;
}

.custom-control-input {
    position: absolute;
    left: 0;
    z-index: -1;
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0;
}

.custom-control-label {
    position: relative;
    margin-bottom: 0;
    vertical-align: top;
    cursor: pointer;
}

.custom-control-label::before {
    position: absolute;
    top: .125rem;
    left: -1.75rem;
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
    content: "";
    background-color: #fff;
    border: #adb5bd solid 1px;
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.custom-control-label::after {
    position: absolute;
    top: .125rem;
    left: -1.75rem;
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    content: "";
    background: no-repeat 50%/50% 50%;
    transition: background .15s ease-in-out;
}

.custom-radio .custom-control-label::before {
    border-radius: 50%;
}

.custom-checkbox .custom-control-label::before {
    border-radius: .25rem;
}

.custom-control-input:checked~.custom-control-label::before {
    color: #fff;
    border-color: #007bff;
    background-color: #007bff;
}

.custom-control-input:focus~.custom-control-label::before {
    box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
}

.custom-radio .custom-control-input:checked~.custom-control-label::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.5' fill='%23fff'/%3e%3c/svg%3e");
}

.custom-checkbox .custom-control-input:checked~.custom-control-label::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

.form-footer .btn {
    margin-left: 0.5rem;
}

@media (max-width: 992px) {

    /* Tablet (portrait) dan di bawahnya */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-bar h1 {
        font-size: 1.3em;
    }

    .admin-profile span {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .content-area {
        padding: 20px 15px;
    }

    .card {
        padding: 20px;
    }

    .card-header {
        padding-bottom: 10px;
        margin-bottom: 15px;
        font-size: 1.1em;
    }

    .top-bar {
        padding: 0 15px;
        height: 60px;
    }

    .top-bar h1 {
        font-size: 1.2em;
    }

    .admin-profile .fa-user-circle {
        font-size: 1.6em;
        margin-right: 8px;
    }

    body.login-page .login-container {
        padding: 30px 25px;
        margin-top: 0;
        margin-bottom: 0;
        border-top-width: 4px;
        box-shadow: none;
        border-radius: 0;
    }

    body.login-page .login-container h2 {
        font-size: 1.5em;
        margin-bottom: 25px;
    }

    body.login-page .form-control {
        padding: 10px 15px;
    }

    body.login-page .btn {
        padding: 10px 18px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-title {
        text-align: center;
        margin-bottom: 1rem;
    }

    .page-options {
        display: flex;
        flex-direction: column;
    }

    .page-options .btn {
        width: 100%;
        margin-left: 0;
        margin-bottom: 0.5rem;
    }

    .page-options .btn:last-child {
        margin-bottom: 0;
    }

    .row>[class*="col-md-"] {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    .form-footer {
        text-align: center;
    }

    .form-footer .btn {
        width: 100%;
        margin-left: 0;
        margin-bottom: 0.5rem;
    }

    .form-footer .btn:last-child {
        margin-bottom: 0;
    }
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
    margin-bottom: 25px;
}

.card-header {
    font-size: 1.25em;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    color: #343a40;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin-bottom: 0;
    font-size: 1.1rem;
    font-weight: 600;
}