/*
 * File: public/assets/css/style.css
 * Deskripsi: File styling utama untuk aplikasi SIAS-D.
 * Versi: 7.1 (Finalisasi Layout & Perbaikan Responsif Login)
 */

/* === BAGIAN 1: GLOBAL & VARIABEL === */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #3498db;
    --primary-hover-color: #2980b9;
    --sidebar-bg-color: #2c3e50;
    --sidebar-text-color: #ecf0f1;
    --sidebar-hover-bg: #34495e;
    --content-bg-color: #f8f9fa;
    --text-color-dark: #1F2937;
    --border-color: #e5e7eb;
    --sidebar-width: 260px;
    --navbar-height: 70px;
}

html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--content-bg-color);
    color: var(--text-color-dark);
    overflow-x: hidden;
}

/* === BAGIAN 2: HALAMAN LOGIN === */

body.login-body {
    margin: 0;
    padding: 2rem;
    height: 100vh;
    background-color: #1e3a8a;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container-card {
    display: flex;
    width: 100%;
    max-width: 960px;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.login-body .info-panel {
    flex: 1;
    background: linear-gradient(135deg, #1e3a8a, #4a69bd);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
}

.login-body .info-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
}

.login-body .info-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-body .info-content h2 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.login-body .form-panel {
    flex: 1.2;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.login-body .form-wrapper {
    width: 100%;
    max-width: 400px;
}

.login-body .form-header h3 {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
}

.login-body .input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.login-body .input-group>svg {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.login-body .input-group input {
    width: 100%;
    padding: 14px 45px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.login-body .login-button {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

.password-toggle-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #888;
}

/* === BAGIAN 3: LAYOUT UTAMA & DASHBOARD === */

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-panel {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
}

.main-content {
    flex: 1;
    padding: 2rem;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1001;
    transition: margin-left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-bg-color);
}

.sidebar-heading {
    height: var(--navbar-height);
    border-bottom: 1px solid var(--sidebar-hover-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.sidebar-brand-logo {
    height: 35px;
    margin-right: 12px;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar .list-group {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar .list-group::-webkit-scrollbar {
    display: none;
}

.sidebar .list-group-item {
    background: transparent;
    color: var(--sidebar-text-color);
    border: none;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border-left: 5px solid transparent;
    position: relative;
}

.sidebar .list-group-item .menu-icon {
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
    margin-right: 1rem;
}

.sidebar .list-group-item:hover {
    background-color: var(--sidebar-hover-bg);
    color: white;
}

.sidebar .list-group-item.active {
    background-color: var(--sidebar-hover-bg);
    color: white;
    font-weight: 700;
    border-left-color: var(--primary-color);
}

.sidebar-menu-title {
    padding: 1.5rem 1.5rem 0.75rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Main Navbar (Atas) --- */
.main-navbar {
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    right: 0;
    width: 100%;
    z-index: 999;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 0 2rem;
}

.main-navbar .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar-img,
.avatar-initials {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-initials {
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.main-navbar .dropdown-menu {
    position: absolute !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* --- Tombol & Overlay Sidebar Mobile --- */
#sidebar-toggle-btn {
    color: #6c757d;
    border: 1px solid transparent;
    padding: 0.25rem 0.5rem;
}

#sidebar-toggle-btn:hover {
    background-color: #f8f9fa;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: var(--sidebar-text-color);
    font-size: 2.5rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.btn-close-sidebar:hover {
    opacity: 1;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}


/* === BAGIAN 4: GAYA TABEL MODERN & PERBAIKAN (VERSI FINAL SEMPURNA) === */

.datatable-container {
    margin-top: 1.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background-color: white;
    border: 1px solid var(--border-color);
}

.table {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #fdfdff;
    --bs-table-hover-bg: #f1f5f9;
    --bs-table-border-color: #e9ecef;
    width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 0;
}

/* Header Tabel */
.table thead th {
    background-color: #f8f9fa !important;
    color: #4b5563;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    padding: 1rem;
    text-align: left;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    white-space: nowrap;

}

/* Perbaikan untuk ikon sort bawaan DataTables */
.table thead .sorting,
.table thead .sorting_asc,
.table thead .sorting_desc {
    background-image: none !important;
    position: relative;
}

.table thead .sorting::after,
.table thead .sorting_asc::after,
.table thead .sorting_desc::after {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f0dc";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #ced4da;
    font-size: 0.7rem;
    padding-left: 0.5rem;
}

.table thead .sorting_asc::after {
    content: "\f0de";
    color: #0d6efd;
}

.table thead .sorting_desc::after {
    content: "\f0dd";
    color: #0d6efd;
}

/* Body Tabel */
.table tbody tr {
    transition: background-color 0.2s ease-in-out;
}

.table tbody tr:hover {
    background-color: var(--bs-table-hover-bg);
}

.table tbody tr td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--bs-table-border-color);
    color: #374151;
}

/* --- Pengaturan Kontrol DataTables --- */
.dt-layout-row {
    padding: 1rem;
    background-color: #ffffff;
}

.dt-layout-row.dt-layout-row-top {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dt-layout-row.dt-layout-row-bottom {
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dt-layout-cell.dt-start {
    text-align: left;
}

.dt-layout-cell.dt-end {
    text-align: right;
}

/* --- Penyesuaian Detail Elemen --- */
.dt-buttons .btn {
    margin-right: 0.25rem;
}

div.dataTables_filter input {
    margin-left: 0.5rem;
    width: 250px;
}

.dataTables_paginate .page-item.active .page-link {
    background-color: var(--primary-color);
    color: white;
}

.dataTables_paginate .page-item .page-link {
    border-radius: 0.5rem;
    margin: 0 2px;
    border: none;
    font-size: 0.9rem;
    color: var(--text-color-dark);
    transition: all 0.2s ease-in-out;
}

.dataTables_paginate .page-item .page-link:hover {
    background-color: #e9ecef;
}

.dataTables_paginate .page-item.disabled .page-link {
    background-color: transparent;
    color: #adb5bd;
}

/* Ikon Paginasi Font Awesome */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.9rem;
    position: relative;
    top: 1px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.first::before {
    content: "\f100";
}

.dataTables_wrapper .dataTables_paginate .paginate_button.previous::before {
    content: "\f104";
}

.dataTables_wrapper .dataTables_paginate .paginate_button.next::before {
    content: "\f105";
}

.dataTables_wrapper .dataTables_paginate .paginate_button.last::before {
    content: "\f101";
}


/* --- Perbaikan Tabel Manajemen Akses --- */
.table .menu-parent td {
    font-weight: 600;
    background-color: #f8f9fa;
}

.table .menu-child td:first-child {
    padding-left: 3rem !important;
}

.table .text-center {
    text-align: center !important;
}

.table input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.table .menu-icon-in-table {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: #95a5a6;
}

.dt-buttons .btn {
    margin-right: 0 !important;
    margin-left: 0.5rem;
}

.dt-buttons .btn span {
    font-size: inherit !important;
    color: inherit !important;
    text-shadow: none !important;
}

.accordion-body dl pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin-bottom: 0;
    font-size: 0.95rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

#calendar {
    min-height: 70vh;
}

.fc {
    --fc-border-color: var(--border-color);
    width: 100% !important;
}

.fc .fc-button {
    text-transform: capitalize;
    font-size: 0.875rem;
}

.fc .fc-button-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.fc .fc-button-primary:hover {
    background-color: var(--primary-hover-color) !important;
    border-color: var(--primary-hover-color) !important;
}

.card-header .btn-group .btn {
    font-size: 0.875rem;
}

#calendarTitle {
    color: var(--text-color-dark);
    font-size: 1.25rem;
    font-weight: 600;
}

.fc .fc-view-harness,
.fc .fc-scrollgrid {
    width: 100%;
    table-layout: fixed;
}


/* === BAGIAN 5: FOOTER === */
.footer {
    padding: 1.5rem 2rem;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}


/* === BAGIAN 6: LOGIKA RESPONSIVE (MOBILE) === */
@media (max-width: 991.98px) {

    /* --- Penyesuaian Halaman Login untuk Mobile --- */
    body.login-body {
        padding: 0;
        /* Hapus padding pada body untuk mobile */
    }

    .login-container-card {
        flex-direction: column;
        /* Ubah tata letak menjadi kolom */
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .info-panel {
    display: flex; /* Pastikan panel info selalu terlihat secara default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    }

    .form-panel {
    display: none; /* Sembunyikan form login secara default */
    }

    /* Class 'form-active' ini akan kita gunakan dengan JavaScript */
    .login-container-card.form-active .info-panel {
    display: none; /* Sembunyikan panel info saat form aktif */
    }

    .login-container-card.form-active .form-panel {
    display: flex; /* Tampilkan form login saat form aktif */
    min-height: 100vh;
    padding: 3rem 2rem;
    align-items: center;
    justify-content: center;
    }

    /* --- Penyesuaian Layout Utama Aplikasi untuk Mobile --- */
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        transition: margin-left 0.3s ease-in-out;
    }

    .main-panel {
        margin-left: 0;
        width: 100%;
    }

    .page-wrapper.toggled .sidebar {
        margin-left: 0;
    }

    .page-wrapper.toggled .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .dt-layout-row-top,
    .dt-layout-row-bottom {
        flex-direction: column;
        gap: 1rem;
    }

    .dt-layout-cell.dt-start,
    .dt-layout-cell.dt-end {
        text-align: center;
    }

    /* --- Penyesuaian Galeri untuk Mobile --- */
    .gallery-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .gallery-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
    }

    .gallery-card a {
        display: block;
        overflow: hidden;
    }

    .gallery-card a img {
        transition: transform 0.3s ease;
    }

    .gallery-card a:hover img {
        transform: scale(1.05);
    }
}