@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0d47a1;
    --primary-dark: #0a3a85;
    --text-main: #1a202c;
    --text-muted: #718096;
    --bg-side: #0d47a1;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #ffffff;
}

/* Container Utama */
.auth-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Bagian Form (Kiri) */
.auth-form-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 60px;
    background: #ffffff;
}

.auth-content {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

/* Bagian Visual (Kanan) */
.auth-visual-section {
    flex: 1.2;
    background-color: var(--bg-side);
    background-image: linear-gradient(135deg, rgba(13, 71, 161, 0.95), rgba(25, 118, 210, 0.8)),
        url('https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: white;
}

.visual-text {
    max-width: 500px;
}

.visual-text h2 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
}

.visual-text p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* Element Form */
.brand-logo {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 40px;
    display: block;
    text-decoration: none;
}

.auth-title {
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 10px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.form-control {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.form-control:focus {
    box-shadow: 0 0 0 4px rgba(13, 71, 161, 0.1);
    border-color: var(--primary);
}

.btn-primary {
    background-color: var(--primary);
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* Responsivitas */
@media (max-width: 992px) {
    .auth-visual-section {
        display: none;
        /* Sembunyikan visual di mobile/tablet */
    }

    .auth-form-section {
        padding: 40px 20px;
    }
}

/* Custom Form Styles for Options Page */
.form-select {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    cursor: pointer;
    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 1rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 71, 161, 0.1);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: #ffffff;
    color: var(--text-main);
    transition: all 0.3s;
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
    z-index: 1050;
    /* Fixed Sidebar & Flex Layout */
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Hide Sidebar Scrollbar */
#sidebar::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

#sidebar .sidebar-header {
    flex-shrink: 0;
}

#sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Submenu / Dropdown Styling in Sidebar */
#sidebar ul.components ul {
    background: rgba(0, 0, 0, 0.03);
    /* Subtle bg for hierarchy */
    border-radius: 8px;
    margin: 5px 15px;
    padding: 5px 0;
}

#sidebar ul.components ul li a {
    padding: 8px 25px 8px 35px;
    /* Indented text, smaller padding vertical */
    font-size: 0.85rem;
    display: block;
    /* Ensure it takes full width */
}

/* Push the last item (Keluar) to the bottom - Adjusted to normal flow */
#sidebar ul.components li:last-child {
    margin-top: 5px;
    /* Reduced from 20px based on user feedback to be closer */
    padding-bottom: 20px;
}

#sidebar.collapsed {
    min-width: 80px;
    max-width: 80px;
}

#sidebar.collapsed .sidebar-header h4 {
    display: none;
}

#sidebar.collapsed .sidebar-header {
    padding: 20px 0;
    text-align: center;
}

#sidebar.collapsed .sidebar-header::after {
    content: 'CB';
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary);
}

#sidebar.collapsed ul li a {
    text-align: center;
    padding: 15px 0;
    justify-content: center;
}

#sidebar.collapsed ul li a span,
#sidebar.collapsed ul li small,
#sidebar.collapsed ul li a.dropdown-toggle::after,
#sidebar.collapsed .sidebar-footer {
    display: none;
}

#sidebar.collapsed ul li a i {
    margin: 0;
    font-size: 1.4rem;
}

/* Sidebar Hover Expansion */
#sidebar.collapsed:hover {
    min-width: 260px;
    max-width: 260px;
}

#sidebar.collapsed:hover .sidebar-header h4 {
    display: block;
}

#sidebar.collapsed:hover .sidebar-header::after {
    display: none;
}

#sidebar.collapsed:hover ul li a {
    text-align: left;
    padding: 12px 25px;
    justify-content: flex-start;
}

#sidebar.collapsed:hover ul li a span {
    display: inline;
}

#sidebar.collapsed:hover ul li a i {
    margin-right: 10px;
    font-size: inherit;
}


#content {
    width: 100%;
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s;
    background: #f4f7fe;
    /* Margin to accommodate fixed sidebar */
    margin-left: 260px;
    margin-top: 90px;
    /* Matched to fixed navbar adjustment previously */
    padding-top: 0;
}

/* Adjust margin when sidebar is collapsed */
#sidebar.collapsed~#content {
    margin-left: 80px;
}

/* Sidebar Menu */
.sidebar-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li a {
    padding: 12px 25px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    /* Use flex for alignment */
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.3s;
    white-space: nowrap;
    /* Prevent checking wrapping */
}

#sidebar ul li a:hover,
#sidebar ul li.active>a {
    color: var(--primary);
    background: rgba(13, 71, 161, 0.05);
    border-left: 4px solid var(--primary);
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Navbar Fixed Implementation */
.navbar-custom {
    position: fixed;
    top: 0;
    right: 0;
    left: 260px;
    /* Sidebar Open */
    z-index: 1000;
    background: #fff;
    border-radius: 0 0 0 12px;
    padding: 15px 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s;
    margin-bottom: 0;
}

/* Push content down so it's not hidden behind navbar */
#content {
    margin-top: 90px;
    padding-top: 0;
}

/* Sidebar Collapsed State - Navbar Adjustment */
#sidebar.collapsed~#content .navbar-custom {
    left: 80px;
}

/* Mobile Responsive Navbar */
@media (max-width: 768px) {
    .navbar-custom {
        left: 0;
        width: 100%;
        border-radius: 0 0 12px 12px;
    }

    #content {
        margin-top: 80px;
    }
}

/* Dark Mode Fixes */
[data-theme="dark"] .table {
    color: var(--text-main);
    background-color: var(--bg-card);
}

[data-theme="dark"] .table-custom,
[data-theme="dark"] .table> :not(caption)>*>* {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
}

[data-theme="dark"] .form-control::placeholder {
    color: #718096;

}

.navbar-custom .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    /* Important for mobile */
    align-items: center;
    justify-content: space-between;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -260px;
        /* Hide by default */
        position: fixed;
        height: 100vh;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    #sidebar.show-sidebar {
        margin-left: 0;
    }

    /* Reset content margin on mobile as sidebar overlaps */
    #content {
        margin-left: 0;
        margin-top: 80px;
    }

    #sidebar.collapsed {
        /* On mobile, 'collapsed' state basically doesn't apply the same way, or revert to normal logic */
        min-width: 260px;
        max-width: 260px;
    }

    .navbar-custom {
        padding: 10px 15px;
        /* Smaller padding on mobile */
    }

    .navbar-custom button#sidebarCollapse {
        margin-right: 10px;
    }

    .stat-card {
        margin-bottom: 15px;
    }
}

/* Custom Cards & Boxes */
.stat-card {
    border: none;
    border-radius: 16px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.bg-primary-soft {
    background: rgba(13, 71, 161, 0.1);
    color: var(--primary);
}

/* Table Styling */
.table-custom {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 15px;
}

/* Alert Custom */
.alert-premium {
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-weight: 500;
}

/* Dark Mode Variables */
:root[data-theme="dark"] {
    --primary: #5296fc;
    --primary-dark: #2a6bcc;
    --text-main: #e2e8f0;
    --text-muted: #a0aec0;
    --bg-side: #1a202c;
    --bg-body: #121621;
    --bg-card: #1a202c;
    --border-color: #2d3748;
}

[data-theme="dark"] body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] #sidebar {
    background: var(--bg-side);
    border-right-color: var(--border-color);
}

[data-theme="dark"] #content {
    background: var(--bg-body);
}

[data-theme="dark"] .navbar-custom,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .auth-form-section,
[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .table {
    color: var(--text-main);
}

[data-theme="dark"] .table thead th {
    background: #2d3748;
    border-bottom-color: var(--border-color);
    color: var(--text-main);
}

[data-theme="dark"] .table td {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
}

[data-theme="dark"] .form-control::placeholder {
    color: #718096;
}

[data-theme="dark"] .text-dark {
    color: var(--text-main) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .btn-light {
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
}

[data-theme="dark"] .bg-light {
    background-color: #2d3748 !important;
}

/* Dark Mode Form Select & List Group Fix */
[data-theme="dark"] .form-select {
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
    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='%23a0aec0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

[data-theme="dark"] .list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-main);
}

/* Fix Sidebar Background Bug on Scroll */
[data-theme="dark"] .wrapper {
    background-color: var(--bg-body);
    /* Ensure wrapper has dark bg to fill gaps */
}

/* Ensure sidebar takes full height visual */
[data-theme="dark"] #sidebar {
    background: var(--bg-side);
    border-right-color: var(--border-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Utility Overrides for Sidebar Compactness */
#sidebar .mt-4 {
    margin-top: 1rem !important;
    /* Reduced from default 1.5rem (24px) to 1rem (16px) or less */
}

/* SweetAlert/Modal Specific Dark Mode Overrides if needed */
[data-theme="dark"] .swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .swal2-title,
[data-theme="dark"] .swal2-content,
[data-theme="dark"] .swal2-html-container {
    color: var(--text-main) !important;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-main);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #2d3748;
}

[data-theme="dark"] .border-radius-10 {
    /* Assuming select uses this class or generic select styling */
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
}

/* Notification Dropdown */
.notification-dropdown {
    width: 320px;
    padding: 0;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: start;
    transition: 0.2s;
    text-decoration: none;
    color: var(--text-main);
}

.notification-item:hover {
    background-color: rgba(13, 71, 161, 0.03);
}

.notification-item .icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.notification-item .content h6 {
    margin: 0 0 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.notification-item .content p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    outline: none;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    outline: none;
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
}

.page-link {
    border-radius: 8px;
    margin: 0 3px;
    color: var(--primary);
    border: none;
    background: #f8f9fa;
}

div.dataTables_wrapper div.dataTables_info {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-top: 15px;
}

div.dataTables_wrapper div.dataTables_paginate {
    padding-top: 10px;
}

/* Dark Mode DataTables & Notifications */
[data-theme="dark"] .notification-dropdown {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .notification-header,
[data-theme="dark"] .notification-item {
    border-bottom-color: var(--border-color);
    color: var(--text-main);
}

[data-theme="dark"] .notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .page-link {
    background-color: #2d3748;
    color: var(--text-main);
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #1a202c;
    color: #718096;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #2d3748;
    border-color: #4a5568;
    color: var(--text-main);
}

[data-theme="dark"] div.dataTables_wrapper div.dataTables_info {
    color: var(--text-muted);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    /* Just below sidebar z-index */
    top: 0;
    left: 0;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile Responsive Adjustments */
@media (max-width: 576px) {
    .notification-dropdown {
        width: 300px;
        right: -70px !important;
        /* Shift left to prevent overflow */
        left: auto !important;
    }

    .navbar-custom .dropdown-menu-end {
        right: 0;
        left: auto;
    }

    /* Force Table Scroll on Mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        white-space: nowrap;
    }
}