/* Fix select2 height and text visibility globally */
.select2-container .select2-selection--single {
    height: 38px !important;
    min-height: 38px !important;
    line-height: 38px !important;
    padding: 6px 12px;
    font-size: 1rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px !important;
    font-size: 1rem;
    white-space: normal;
}

/* Force Select2 to match the active Bootstrap theme */
[data-bs-theme="light"] .select2-container--default .select2-selection--single {
    background-color: #ffffff !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d !important;
}

[data-bs-theme="light"] .select2-container .select2-dropdown {
    background-color: #ffffff !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--multiple {
    background-color: #ffffff !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #e9ecef !important;
    border: 1px solid #d7dce1 !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #495057 !important;
}

[data-bs-theme="light"] .select2-container--default .select2-search--inline .select2-search__field,
[data-bs-theme="light"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

[data-bs-theme="light"] .select2-results__option {
    color: #212529 !important;
    background: transparent !important;
}

[data-bs-theme="light"] .select2-results__option--highlighted,
[data-bs-theme="light"] .select2-results__option--selected {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single {
    background-color: #1e1e1e !important;
    border-color: #2b2b2b !important;
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9b9b9b !important;
}

[data-bs-theme="dark"] .select2-container .select2-dropdown {
    background-color: #171717 !important;
    border-color: #2b2b2b !important;
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: #1e1e1e !important;
    border-color: #2b2b2b !important;
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #2b2b2b !important;
    border: 1px solid #3a3a3a !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #ced4da !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field,
[data-bs-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #171717 !important;
    color: #e6e6e6 !important;
    border-color: #2b2b2b !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field::placeholder,
[data-bs-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: #9b9b9b !important;
}

[data-bs-theme="dark"] .select2-results__option {
    color: #e6e6e6 !important;
    background: transparent !important;
}

[data-bs-theme="dark"] .select2-results__option--highlighted,
[data-bs-theme="dark"] .select2-results__option--selected {
    background-color: #2f2f2f !important;
    color: #ffffff !important;
}

/* Dashboard spacing and cards */
.page-wrap {
    padding-top: 2.1rem;
    padding-bottom: 1.5rem;
}

.dashboard-hero {
    border: 1px solid rgba(34, 46, 60, 0.08);
    border-radius: 14px;
    margin-bottom: 1.25rem;
}

.dashboard-hero .card-body {
    padding: 1.15rem 1.25rem;
}

.module-grid {
    row-gap: 0.35rem;
}

.module-card {
    display: block;
    height: 100%;
    border: 1px solid #e7ebf0;
    border-radius: 12px;
    background: #ffffff;
    padding: 1rem 1rem 0.95rem;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.module-card:hover,
.module-card:focus {
    border-color: #cfd8e3;
    box-shadow: 0 10px 24px rgba(15, 35, 95, 0.1);
    transform: translateY(-2px);
}

[data-bs-theme="dark"] .dashboard-hero {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .module-card {
    background: #1a2230;
    border-color: #2e394b;
}

[data-bs-theme="dark"] .module-card:hover,
[data-bs-theme="dark"] .module-card:focus {
    border-color: #3a4a63;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

/* Sidebar and topbar readability fixes (dark mode + mobile) */
html[data-bs-theme="dark"] .topbar-custom {
    background-color: #111827 !important;
}

html[data-bs-theme="dark"] .topbar-custom .topnav-menu .nav-link,
html[data-bs-theme="dark"] .topbar-custom .topnav-menu .noti-icon,
html[data-bs-theme="dark"] .topbar-custom .pro-user-name,
html[data-bs-theme="dark"] .topbar-custom h5,
html[data-bs-theme="dark"] .topbar-custom h6 {
    color: #e5e7eb !important;
}

html[data-bs-theme="dark"] .app-sidebar-menu,
html[data-bs-theme="dark"] body[data-menu-color="light"] .app-sidebar-menu {
    background-color: #1f2937 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] #sidebar-menu .menu-title,
html[data-bs-theme="dark"] #sidebar-menu>ul>li>a,
html[data-bs-theme="dark"] #sidebar-menu>ul>li>a i,
html[data-bs-theme="dark"] #sidebar-menu>ul>li>a svg {
    color: #d1d5db !important;
    fill: #9ca3af !important;
}

html[data-bs-theme="dark"] #sidebar-menu>ul>li>a:hover,
html[data-bs-theme="dark"] #sidebar-menu>ul>li>a:focus,
html[data-bs-theme="dark"] #sidebar-menu .menuitem-active>a,
html[data-bs-theme="dark"] #sidebar-menu .menuitem-active .active {
    color: #ffffff !important;
}

@media (max-width: 991.98px) {
    body[data-sidebar="default"] .app-sidebar-menu {
        width: 260px !important;
        left: 0 !important;
        z-index: 1055 !important;
    }

    body[data-sidebar="hidden"] .app-sidebar-menu {
        width: 0 !important;
        overflow: hidden;
    }

    html[data-bs-theme="dark"] body[data-sidebar="default"] .app-sidebar-menu {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45) !important;
    }
}

/* Public pages: keep header/menu consistent in dark mode */
html[data-bs-theme="dark"] .landing-topbar,
body[data-menu-color="dark"] .landing-topbar,
html[data-bs-theme="dark"] .portfolio-topbar,
body[data-menu-color="dark"] .portfolio-topbar {
    background: rgba(9, 9, 11, 0.92) !important;
    border-bottom-color: rgba(244, 244, 245, 0.2) !important;
}

html[data-bs-theme="dark"] .landing-topbar .container.py-2,
body[data-menu-color="dark"] .landing-topbar .container.py-2,
html[data-bs-theme="dark"] .portfolio-topbar .container.py-2,
body[data-menu-color="dark"] .portfolio-topbar .container.py-2,
html[data-bs-theme="dark"] .landing-topbar .navbar-collapse,
body[data-menu-color="dark"] .landing-topbar .navbar-collapse,
html[data-bs-theme="dark"] .portfolio-topbar .navbar-collapse,
body[data-menu-color="dark"] .portfolio-topbar .navbar-collapse {
    background: rgba(9, 9, 11, 0.92) !important;
    color: #f5f5f5 !important;
    border-color: rgba(244, 244, 245, 0.2) !important;
}

html[data-bs-theme="dark"] .landing-topbar .landing-nav-link,
body[data-menu-color="dark"] .landing-topbar .landing-nav-link,
html[data-bs-theme="dark"] .portfolio-topbar .portfolio-nav-link,
body[data-menu-color="dark"] .portfolio-topbar .portfolio-nav-link {
    color: #f5f5f5 !important;
}

html[data-bs-theme="dark"] .landing-topbar .landing-brand .logo-dark,
body[data-menu-color="dark"] .landing-topbar .landing-brand .logo-dark,
html[data-bs-theme="dark"] .portfolio-topbar .portfolio-brand .logo-dark,
body[data-menu-color="dark"] .portfolio-topbar .portfolio-brand .logo-dark {
    display: none !important;
}

html[data-bs-theme="dark"] .landing-topbar .landing-brand .logo-light,
body[data-menu-color="dark"] .landing-topbar .landing-brand .logo-light,
html[data-bs-theme="dark"] .portfolio-topbar .portfolio-brand .logo-light,
body[data-menu-color="dark"] .portfolio-topbar .portfolio-brand .logo-light {
    display: inline-block !important;
}

html[data-bs-theme="dark"] .landing-topbar .navbar-toggler,
body[data-menu-color="dark"] .landing-topbar .navbar-toggler,
html[data-bs-theme="dark"] .portfolio-topbar .navbar-toggler,
body[data-menu-color="dark"] .portfolio-topbar .navbar-toggler {
    border-color: rgba(244, 244, 245, 0.35) !important;
}

html[data-bs-theme="dark"] .landing-topbar .navbar-toggler-icon,
body[data-menu-color="dark"] .landing-topbar .navbar-toggler-icon,
html[data-bs-theme="dark"] .portfolio-topbar .navbar-toggler-icon,
body[data-menu-color="dark"] .portfolio-topbar .navbar-toggler-icon {
    filter: invert(1) grayscale(1) brightness(1.3) !important;
}

@media (max-width: 991.98px) {

    html[data-bs-theme="dark"] .landing-topbar .navbar,
    body[data-menu-color="dark"] .landing-topbar .navbar,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar,
    body[data-menu-color="dark"] .portfolio-topbar .navbar,
    html[data-bs-theme="dark"] .landing-topbar .navbar-collapse,
    body[data-menu-color="dark"] .landing-topbar .navbar-collapse,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-collapse,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-collapse {
        background-color: #09090b !important;
        color: #f5f5f5 !important;
    }

    html[data-bs-theme="dark"] .landing-topbar .navbar-collapse .nav-link,
    body[data-menu-color="dark"] .landing-topbar .navbar-collapse .nav-link,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-collapse .nav-link,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-collapse .nav-link,
    html[data-bs-theme="dark"] .landing-topbar .navbar-collapse .btn,
    body[data-menu-color="dark"] .landing-topbar .navbar-collapse .btn,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-collapse .btn,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-collapse .btn {
        color: #f5f5f5 !important;
    }

    html[data-bs-theme="dark"] .landing-topbar .navbar-collapse .btn.btn-primary,
    body[data-menu-color="dark"] .landing-topbar .navbar-collapse .btn.btn-primary,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-collapse .btn.btn-primary,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-collapse .btn.btn-primary {
        color: #111111 !important;
    }

    html[data-bs-theme="dark"] .landing-topbar .navbar-toggler,
    body[data-menu-color="dark"] .landing-topbar .navbar-toggler,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-toggler,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-toggler {
        border-color: rgba(245, 245, 245, 0.45) !important;
    }

    html[data-bs-theme="dark"] .landing-topbar .navbar-toggler-icon,
    body[data-menu-color="dark"] .landing-topbar .navbar-toggler-icon,
    html[data-bs-theme="dark"] .portfolio-topbar .navbar-toggler-icon,
    body[data-menu-color="dark"] .portfolio-topbar .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28245,245,245,0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
        filter: none !important;
    }
}