/* Global Base Styles */
* {
    box-sizing: border-box;
    font-family: "Manrope", sans-serif;
    margin: 0;
    padding: 0;
    user-select: none;
}

/* Global Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: #bbb;
    border-radius: 3px;
    border: 1px solid transparent;
    transition: background-color 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}

/* CSS Variables */
:root {
    --bg-color-body: #E2E8F0;
    --bg-color-sidebar: #E2E8F0;
    --bg-color-navbar: #E2E8F0;
    --bg-color-primary: #52a9f4;
    --bg-color-secondary: #45556c;
    --text-color-body: #212529;
    --text-color-sidebar: #212529;
    --text-color-navbar: #212529;
    --text-color-primary: #E2E8F0;
    --text-color-secondary: #E2E8F0;

    --input-color: #f1f5f9;
    --border-color: #cccccc;
    --scrollbar-color: #0b89a8;
    --active-color: #288be7;
    --hover-color: #f1f5f9;
    --box-shadow: rgba(0, 0, 0, 0.1);

    --color-primary: #52a9f4;
    --color-secondary: #45556c;
    --color-accent: #288be7;
    --color-warning: #ffc107;
    --color-info: #0d6efd;
    --color-success: #198754;
    --color-danger: #dc3545;
    --color-muted: #888;
    --color-disbaled: #888;
    --color-light: #fafafa;
    --color-dark: #000000;
}

[data-theme='dark'] {
    --bg-color-body: #1D293D;
    --bg-color-sidebar: #1D293D;
    --bg-color-navbar: #1D293D;
    --bg-color-primary: #52a9f4;
    --bg-color-secondary: #45556c;
    --text-color-body: #E2E8F0;
    --text-color-sidebar: #E2E8F0;
    --text-color-navbar: #E2E8F0;
    --text-color-primary: #E2E8F0;
    --text-color-secondary: #E2E8F0;

    --input-color: #45556c;
    --border-color: #666666;
    --scrollbar-color: #555555;
    --active-color: #288be7;
    --hover-color: #45556c;
    --box-shadow: rgba(255, 255, 255, 0.1);
}

/* HTML Element Defaults */
body {
    background: var(--bg-color-body);
    color: var(--text-color-body);
    scroll-behavior: smooth;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span {
    margin: 0 !important;
    padding: 0 !important;
}

input,
select,
button {
    background: transparent;
    border: transparent;
    outline: transparent;
}

button {
    background: transparent;
}

table {
    border: 1px solid var(--border-color);
}

table th,
table td {
    color: var(--text-color-body);
    white-space: nowrap;
}

input[type='checkbox'] {
    cursor: pointer;
}

/* Input & Form Controls */
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
input[type="color"] {
    background: var(--input-color) !important;
    color: var(--text-color) !important;
}

input::placeholder,
textarea::placeholder,
select option[disabled] {
    color: var(--text-color) !important;
    opacity: 0.5 !important;
}

/* Buttons & UI Components */
.rounded-button {
    color: var(--text-color-body);
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
    height: 36px;
    width: 36px;
}

.rounded-button:hover {
    background: var(--hover-color);
}

.drawer-opener {
    background: var(--bg-color-body);
    color: var(--text-color-body);
    border-radius: 100%;
    box-shadow: 0 0 10px #aaa;
    height: 3.4rem;
    width: 3.4rem;
}

.drawer-opener:hover {
    color: var(--text-color-body);
}

.active {
    background: var(--bg-color-primary) !important;
    color: var(--text-color-primary) !important;
}

/* Layout Wrappers */
#layout-wrapper {
    display: flex;
}

#layout-wrapper.layout {
    max-width: 1200px;
    margin: 0 auto;
}

#layout-wrapper.layout-fluid {
    max-width: 100%;
    margin: 0 auto;
}

.main-content-wrapper {
    flex-grow: 1;
    height: 100vh;
    overflow-y: scroll;
}

.content {
    padding: 1rem;
}

body.loading .layout-wrapper {
    display: none;
}

body.loading {
    overflow: hidden;
}

/* Toast, and Overlay */

#toast {
    position: fixed;
    max-width: 300px;
    width: 100%;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    z-index: 9999;
    background: var(--toast-bg, #333);
    color: var(--toast-color, #fff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#toast.hide {
    transform: translateX(-50%) translateY(-50px);
    opacity: 0;
    pointer-events: none;
}

#toast_close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: transparent;
    border: none;
    color: white !important;
    cursor: pointer;
    font-size: 24px;
}

#toast_message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#toast_icon {
    font-size: 20px;
}

/* Branch Modal */
.branches-wrapper {
    display: flex;
    gap: 0.5rem;
}

.branches-wrapper-left {
    max-width: 200px;
    width: 100%;
}

.branches-wrapper-left ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

.branches-wrapper-right {
    flex-grow: 1;
    padding-left: 8px;
    border-left: 0.5rem solid #ccc;
}

.branches-wrapper-right ul {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    list-style: none;
}

.branches-wrapper-right ul.list-group>li {
    display: none;
}

@media(max-width: 992px) {
    .branches-wrapper {
        flex-direction: column;
    }

    .branches-wrapper-left {
        max-width: 100%;
        width: 100%;
    }

    .branches-wrapper-left ul {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    /* WebKit browsers (Chrome, Safari) */
    .branches-wrapper-left ul::-webkit-scrollbar {
        display: none;
    }

    .branches-wrapper-left ul li a {
        white-space: nowrap;
    }

    .branches-wrapper-right {
        margin-top: 0.5rem;
    }

    .branches-wrapper-right ul {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

}

/* Module Modal */
.module-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.module-list li {
    padding: 0;
    border: 1px solid #ccc !important;
    border-radius: 0.25rem;
    transition: .1s linear;
}

.module-list li a {
    padding: 10px;
    color: var(--text-color);
    text-transform: capitalize;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.module-list li:hover {
    background: #697D91;
}

.module-list li:hover a,
.module-list li:hover a i {
    color: #fff;
}

.module-list li a i {
    color: #697D91;
}

@media(max-width: 768px) {
    .module-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Help Modal */
#helpAccordion .accordion-item {
    background: var(--bg-color);
    color: var(--text-color);
}

#helpAccordion .accordion-button:not(.collapsed) {
    background: var(--bg-color-primary);
    color: var(--text-color-primary);
}

#helpAccordion .accordion-button.collapsed {
    background: var(--bg-color-secondary);
    color: var(--text-color-secondary);
}

#helpAccordion .accordion-button:focus {
    box-shadow: none;
}

#helpAccordion .accordion-button.collapsed::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

#helpAccordion .accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

/* Third-party Overrides */
.swal2-popup,
.swal2-modal {
    max-width: 300px;
    padding: 1.2rem;
    background: var(--bg-color-body);
    color: var(--text-color-body);
    border-radius: 1rem !important;
}

.swal2-icon {
    margin: 0 auto 0.5rem;
}

#swal2-title {
    font-size: large;
    font-weight: bold;
}

#swal2-html-container {
    font-size: 1rem;
    color: var(--color-muted);
    font-weight: 600;
}

.swal2-actions {
    display: flex;
    gap: 0.5rem;
}

.swal2-confirm,
.swal2-cancel {
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.select2-container--default .select2-results__option {
    background: var(--input-color);
    color: var(--text-color-body);
}

.select2-selection.select2-selection--multiple {
    color: var(--text-color-body) !important;
    background: var(--input-color) !important;
    overflow: hidden;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    padding-right: 0.5rem;
    margin: 4px;
    color: var(--text-color-body) !important;
    background: var(--bg-color-body) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__clear {
    font-size: 24px;
    top: -0.2rem;
    right: 0.4rem;
    margin: 0 !important;
}

.select2-container--default .select2-search--inline .select2-search__field {
    margin: 7px 7px;
}

/* Components & Helpers */
.language-toggle-btn,
#globalSearchInput {
    color: var(--text-color) !important;
}

.language-badge {
    display: inline-block;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    text-align: center;
    background: var(--bg-color-primary);
    color: var(--text-color-primary);
    font-size: 10px;
}

#btn-float-wrapper {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99;
    display: flex;
    align-items: center;
}

.btn-float-hint {
    position: absolute;
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-float-hint i,
.btn-float-hint i:hover {
    color: var(--text-color-body);
}

#btn-float-wrapper:hover .btn-float-hint {
    left: -36px;
}

/* Responsive & Utility */
@media (max-width: 768px) {
    .offcanvas-end {
        width: calc(400px - 50px) !important;
    }
}

.offcanvas {
    background: var(--bg-color-body) !important;
    color: var(--text-color-body) !important;
}

a[aria-expanded="true"] .bi-chevron-down,
.collapse.show+.bi-chevron-down {
    transform: rotate(180deg);
    transition: transform 0.2s;
}

.reset-all,
.reset-this {
    cursor: pointer;
}

.w-0,
.h-0 {
    width: 0% !important;
}

.w-10,
.h-10 {
    width: 10% !important;
}

.w-20,
.h-20 {
    width: 20% !important;
}

.w-30,
.h-30 {
    width: 30% !important;
}

.w-40,
.h-40 {
    width: 40% !important;
}

.w-50,
.h-50 {
    width: 50% !important;
}

.w-60,
.h-60 {
    width: 60% !important;
}

.w-70,
.h-70 {
    width: 70% !important;
}

.w-80,
.h-80 {
    width: 80% !important;
}

.w-90,
.h-90 {
    width: 90% !important;
}

.w-100,
.h-100 {
    width: 100% !important;
}

.w-fit,
.h-fit {
    width: fit-content !important;
}



.border,
.border-top,
.border-bottom,
.border-left,
.border-bottom {
    border-color: var(--border-color) !important;
}

/* Table Component */
.filter-options .form-control,
.filter-options .form-select {
    color: var(--text-color);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
}

.filter-options .input-group-text {
    color: var(--text-color-primary);
    font-weight: 500;
    padding: 0 8px !important;
}

.filter-options .form-control,
.filter-options .form-select {
    color: var(--text-color);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media(max-width: 768px) {

    #permissionShowButton span,
    #filterButton span {
        display: none;
    }
}