/* Global Variables - Navy Blue Enterprise Theme */
:root {
    --primary-color: #0B1F3A;
    --primary-hover: #112B4A;
    --primary-light: #1E3A5F;
    --accent-color: #2F80ED;
    --accent-hover: #4A90E2;
    --bg-color: #F5F7FA;
    --text-dark: #333333;
    --text-muted: #6c757d;
    --white: #ffffff;
    --border-color: #e9ecef;
    --sidebar-width: 260px;
    --header-height: 70px;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition: all 0.3s ease-in-out;
}

/* Equal width for filter action buttons so icon-only buttons match Filter button */
#absensiFiltersActions .btn,
#karyawanFiltersActions .btn,
#absensiActionButtons .btn {
    min-width: 140px;
    width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


@media (max-width: 768px) {
    #absensiFiltersActions .btn,
    #karyawanFiltersActions .btn,
    #absensiActionButtons .btn {
        width: auto;
        min-width: 0;
    }
}

/* Icon-only button style */
.btn-icon-only {
    width: 40px !important;
    min-width: 40px !important;
    padding: 0.35rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@media (max-width: 768px) {
    .btn-icon-only {
        width: 38px !important;
        min-width: 38px !important;
    }
}

body {
    font-family: 'Poppins', 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Auth Pages */
.auth-bg {
    background: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #061224 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-login-container {
    width: 100%;
    max-width: 1150px;
}

.auth-card-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 2rem;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    min-height: 520px;
}

.auth-card-image {
    position: relative;
    overflow: hidden;
    min-height: 520px;
    background: #f4fbf7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-top-left-radius: 2rem;
    border-bottom-left-radius: 2rem;
}

.auth-image-fluid {
    width: auto;
    max-width: 420px;
    max-height: 460px;
    object-fit: contain;
    border-radius: 1.75rem;
}

.auth-card-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: #ffffff;
}

.auth-card-signin {
    width: 100%;
    max-width: 460px;
    border: none;
    background: transparent;
}

.auth-card-signin .card-body {
    padding: 2.5rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-lg);
    background: #ffffff;
}

.auth-logo {
    max-width: 110px;
    height: auto;
}

.input-group .form-control,
.input-group .form-select {
    border-radius: 0;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transition: var(--transition);
    border-radius: 0.85rem;
    padding: 0.95rem 1.25rem;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white);
}

.auth-panel-right .btn-outline-secondary {
    border-radius: 0.85rem;
    padding: 0.95rem 1.25rem;
}

@media (max-width: 991.98px) {
    .auth-card-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
    }

    .auth-card-image {
        display: none !important;
    }

    .auth-card-form {
        padding: 2rem;
    }

    .auth-card-signin .card-body {
        padding: 2rem;
    }
}

@media (max-width: 767.98px) {
    .auth-card-image-overlay {
        left: 1.25rem;
        bottom: 1.25rem;
        right: 1.25rem;
    }

    .auth-card-image-overlay h1 {
        font-size: 1.75rem;
    }
}

.input-group .form-control,
.input-group .form-select {
    border-radius: 0;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transition: var(--transition);
    border-radius: 0.85rem;
    padding: 0.95rem 1.25rem;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white);
}

.auth-panel-right .btn-outline-secondary {
    border-radius: 0.85rem;
    padding: 0.95rem 1.25rem;
}

@media (max-width: 991.98px) {
    .auth-login-container {
        grid-template-columns: 1fr;
    }

    .auth-panel-left,
    .auth-panel-right {
        border-radius: 1.5rem;
    }

    .auth-panel-right {
        order: 1;
    }

    .auth-panel-left {
        order: 2;
    }
}

@media (max-width: 767.98px) {
    .auth-login-container {
        gap: 1rem;
    }

    .auth-panel-left,
    .auth-panel-right {
        padding: 1.5rem;
    }

    .auth-panel-left {
        padding: 2rem 1.5rem;
    }

    .auth-card-signin .card-body {
        padding: 1.75rem;
    }

    .auth-hero h1 {
        font-size: 2rem;
    }
}

.form-control,
.form-select {
    border-radius: 0.75rem;
    border: 1px solid rgba(55, 65, 81, 0.15);
    box-shadow: none;
    min-height: 46px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.15rem rgba(47, 128, 237, 0.12);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-text {
    color: var(--text-muted);
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transition: var(--transition);
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white);
}

/* Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);

    background: var(--white) !important;
    color: var(--text-dark);
    border-right: 1px solid rgba(0,0,0,0.08);
    transition: var(--transition);
    min-height: 100vh;
    z-index: 1000;
    position: fixed;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: var(--white) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--header-height);
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

#sidebar .sidebar-header h4 {
    color: var(--primary-color);
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li {
    margin-bottom: 4px;
}

#sidebar ul li a {
    padding: 15px 25px;
    font-size: 1rem;
    display: block;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    border-left: 4px solid transparent;
    background: transparent;
}

#sidebar ul li a i {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

#sidebar ul li a:hover,
#sidebar ul li.active > a {
    color: var(--white) !important;
    /* hover/active biru gelap */
    background: var(--primary-hover) !important;
    border-left-color: var(--primary-hover) !important;
    transition: var(--transition);
}

#sidebar ul li a:hover i,
#sidebar ul li.active > a i {
    color: var(--white) !important;
}


/* Force sidebar white background in case other styles override */
#sidebar,
#sidebar .sidebar-header,
#sidebar ul.components {
    background-color: #ffffff !important;
}

#sidebar ul li a,
#sidebar .sidebar-header h4 {
    color: #0B1F3A !important;
}

/* Sidebar Submenu Dropdown CSS */
#sidebar ul li a.dropdown-toggle::after {
    display: none;
}
#sidebar ul li a.dropdown-toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}
#sidebar ul li a.dropdown-toggle .bi-chevron-down {
    transition: transform 0.2s ease-in-out;
}
#sidebar ul.collapse-inner-list {
    background-color: #f8fafc !important;
    border-radius: 8px;
    margin: 5px 15px !important;
    padding: 5px 0 !important;
    list-style: none;
}
#sidebar ul.collapse-inner-list li {
    margin-bottom: 2px !important;
}
#sidebar ul.collapse-inner-list li a {
    padding: 10px 20px !important;
    font-size: 0.9rem !important;
    border-left: none !important;
    border-radius: 6px !important;
    margin: 2px 10px !important;
    background: transparent !important;
    color: #4A5568 !important;
}
#sidebar ul.collapse-inner-list li a i {
    font-size: 1.05rem !important;
    margin-right: 12px !important;
}
#sidebar ul.collapse-inner-list li a:hover,
#sidebar ul.collapse-inner-list li.active > a {
    background-color: var(--primary-color) !important;
    color: var(--white) !important;
}
#sidebar ul.collapse-inner-list li a:hover i,
#sidebar ul.collapse-inner-list li.active > a i {
    color: var(--white) !important;
}

/* Content */
#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: var(--transition);
    position: relative;
    right: 0;
    padding-left: 0;
    margin-left: var(--sidebar-width);
}



/* Navbar */
.navbar-custom {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    height: var(--header-height);
    padding: 0 2rem;
}

/* Cards */
.card-custom {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: var(--white);
    margin-bottom: 1.5rem;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bg-light-primary {
    background-color: rgba(11, 31, 58, 0.1);
    color: var(--primary-color);
}

.bg-light-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.bg-light-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.bg-light-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Tables */
.table-custom {
    background: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

.table-custom thead th {
    background-color: var(--bg-color);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding: 1rem;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 0.95rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-custom tbody td:last-child {
    min-width: 150px;
}

.table-custom td span.badge,
.table-custom td .btn {
    white-space: nowrap;
}

.table-custom tbody tr {
    transition: var(--transition);
}

.table-custom tbody tr:hover {
    background-color: rgba(47, 128, 237, 0.05);
}

/* Badges */
.badge-custom {
    padding: 0.5em 0.8em;
    border-radius: 50rem;
    font-weight: 500;
}

/* Main Content Padding */
.main-content {
    padding: 2rem;
}

/* Action button style for tables (consistent with "pending" badge look) */
#cutiTable td .btn-group,
#cutiTable td .btn,
#karyawanTable td .btn-group,
#karyawanTable td .btn,
#usersTable td .btn-group,
#usersTable td .btn,
#payrollTable td .btn-group,
#payrollTable td .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

#karyawanTable td .avatar img,
#cutiTable td .avatar img,
#usersTable td .avatar img {
    object-fit: cover;
}

.table-responsive {
    overflow-x: auto;
    overscroll-behavior: contain;
}

.avatar {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: right;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    width: 100%;
    max-width: 280px;
    display: inline-block;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_paginate {
    justify-content: flex-end;
}

.dataTables_wrapper .dataTables_info {
    margin-top: 0.75rem;
    color: var(--text-muted);
}


/* Pakai style konsisten seperti badge/status "pending" */
#cutiTable td .cuti-action-btn,
#karyawanTable td .cuti-action-btn,
#usersTable td .cuti-action-btn,
#payrollTable td .cuti-action-btn,
.btn-action-darkblue {
    /* warna biru gelap */
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white) !important;

    /* shape biar tidak terlalu polos */
    border-radius: 0.6rem;
    padding: 0.35rem 0.75rem;
    box-shadow: 0 0.15rem 0.35rem rgba(11, 31, 58, 0.15);

    transition: var(--transition);
}

.btn-action-darkblue:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: var(--white) !important;
}


#cutiTable td .cuti-action-btn:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white) !important;
}

#cutiTable td .cuti-action-btn + .cuti-action-btn,
#cutiTable td .cuti-action-btn + a {
    margin-left: 0.5rem;
}

/* Absensi action buttons (Reset/Ekspor/Impor) alignment */
#absensiFiltersActions,
#absensiActionButtons,
#karyawanFiltersActions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}


#absensiFiltersActions .btn,
#absensiActionButtons .btn,
#karyawanFiltersActions .btn {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

#absensiFiltersActions .btn span,
#absensiFiltersActions .btn i,
#absensiActionButtons .btn span,
#absensiActionButtons .btn i,
#karyawanFiltersActions .btn span,
#karyawanFiltersActions .btn i {
    vertical-align: middle;
}

#absensiFiltersActions .btn i,
#absensiActionButtons .btn i,
#karyawanFiltersActions .btn i {
    margin-right: 0.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}


/* Responsive */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 220px;
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 200px;
    }

    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    .card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
        --header-height: 60px;
    }

    body {
        font-size: 14px;
    }

    .wrapper {
        flex-direction: column;
    }

    .navbar-custom {
        padding: 0 1rem;
    }

    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
    }

    .d-flex.justify-content-between.align-items-center h2 {
        width: 100%;
        margin-bottom: 0.5rem !important;
    }

    .btn-group:not(.table-action-group) {
        width: 100%;
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .btn-group:not(.table-action-group) .btn {
        flex: 1 1 auto;
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-group:not(.table-action-group) .btn i {
        display: none;
    }

    .btn-group.table-action-group {
        display: inline-flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-group.table-action-group .btn {
        flex: 0 0 auto;
        padding: 0.35rem 0.6rem;
    }

    .btn-group.table-action-group .btn i {
        display: inline-flex;
    }

    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        margin-left: calc(-1 * var(--sidebar-width));
        height: 100vh;
        transition: margin-left 0.3s ease;
        z-index: 1001;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
    }

    #sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-left: 0;
        transition: margin-left 0.3s ease;
    }

    #content.active {
        width: 100%;
        margin-left: 0;
    }

    .row > .col-md-3,
    .row > .col-md-4,
    .row.g-3 > .col-md-2,
    .row.g-3 > .col-md-3 {
        min-width: 100%;
        flex: 0 0 100%;
    }

    .col-md-3.mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .card-body.d-flex {
        flex-direction: row;
        gap: 0.75rem;
    }

    .stat-icon {
        min-width: 50px;
        min-height: 50px;
        width: 50px;
        height: 50px;
    }

    .stat-icon i {
        font-size: 1.5rem;
    }

    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.4rem;
    }

    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.55rem 0.75rem;
        height: auto;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.875rem;
        min-width: 100%;
    }

    table th,
    table td {
        padding: 0.45rem 0.65rem;
        white-space: nowrap;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .card-custom {
        border-radius: 0.75rem;
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .alert {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
        font-size: 0.875rem;
    }

    .alert i {
        margin-right: 0.5rem;
    }
}

@media (max-width: 576px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 50px;
    }

    body {
        font-size: 13px;
    }

    h1, h2, h3, h4, h5, h6 {
        font-size: 1rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
        font-size: 0.8rem;
    }

    #sidebar {
        width: 100%;
        margin-left: -100%;
        position: fixed;
        height: 100vh;
        overflow-y: auto;
    }

    #sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    .navbar-custom {
        padding: 0 0.75rem;
    }

    .stat-icon {
        min-width: 45px;
        min-height: 45px;
        width: 45px;
        height: 45px;
    }

    .stat-icon i {
        font-size: 1.25rem;
    }

    .form-control,
    .form-select {
        font-size: 16px;
        padding: 0.6rem 0.75rem;
    }

    table {
        font-size: 0.75rem;
    }

    table th,
    table td {
        padding: 0.4rem 0.5rem;
    }
}

    .avatar {
        min-width: 32px;
        min-height: 32px;
    }

    .avatar img {
        width: 32px;
        height: 32px;
    }

    /* Modal fullscreen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    .modal-content {
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 0.75rem;
    }

    /* Reduce padding/margin */
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    .row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .col-12 {
        padding-left: 5px;
        padding-right: 5px;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .px-3 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    /* Ultra small screens */
    .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .btn-sm {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    h1, h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }

    .text-muted {
        font-size: 0.75rem;
    }

    /* DataTable buttons stack */
    .btn-group-vertical,
    .btn-group {
        width: 100%;
    }

    /* Remove some spacing for ultra small screens */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.75rem;
    }
}
