/* Sub-menu Icon Styling */

/* Fix double highlighting - Only highlight top-level open menus, not nested ones */
.bg-menu-theme .menu-inner > .menu-item .menu-sub .menu-item.open > .menu-link.menu-toggle {
    background: transparent !important;
}

/* Only top-level menu items under .menu-inner should get the open background */
.bg-menu-theme .menu-inner > .menu-item.open > .menu-link.menu-toggle {
    background: rgba(225, 222, 245, 0.08) !important;
}

/* Remove background from nested submenu toggles when open */
.bg-menu-theme .menu-sub .menu-item.open > .menu-link.menu-toggle {
    background: transparent !important;
}

/* Hover effect for submenu toggles - subtle */
.bg-menu-theme .menu-sub .menu-item > .menu-link.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Active menu items in submenus should have different styling than open toggles */
.bg-menu-theme .menu-sub .menu-item.active > .menu-link {
    background: rgba(255, 193, 7, 0.15) !important;
    border-left: 3px solid #ffc107 !important;
}

/* Balanced sidebar width with scrollable behavior */
.layout-menu {
    width: 280px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    height: 100vh !important;
}

/* Custom themed scrollbar for sidebar - All screens */
.layout-menu::-webkit-scrollbar {
    width: 8px !important;
}

.layout-menu::-webkit-scrollbar-track {
    background: rgba(46, 34, 82, 0.3) !important;
    border-radius: 10px !important;
    margin: 10px 0 !important;
}

.layout-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%) !important;
    border-radius: 10px !important;
    border: 2px solid rgba(46, 34, 82, 0.3) !important;
}

.layout-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%) !important;
    border: 2px solid rgba(46, 34, 82, 0.5) !important;
}

/* Firefox scrollbar for sidebar */
.layout-menu {
    scrollbar-width: thin !important;
    scrollbar-color: #1e3a8a rgba(46, 34, 82, 0.3) !important;
}

/* Adjust main content area to match sidebar */
.layout-page {
    padding-left: 280px !important;
}

/* When menu is collapsed */
.layout-menu-collapsed .layout-page {
    padding-left: 0 !important;
}

@media (min-width: 1200px) {
    .layout-menu-fixed .layout-menu {
        width: 280px !important;
    }
    
    .layout-menu-fixed .layout-page {
        padding-left: 280px !important;
    }
}

@media (max-width: 1199px) {
    .layout-menu {
        width: 260px !important;
    }
}

/* Fix sidebar header (app-brand) area - Clean & Left-Aligned */
.app-brand {
    height: 80px !important;
    padding: 1rem 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background-color: #2E2252 !important;
    position: relative !important;
    z-index: 100;
}

.app-brand-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.65rem !important;
    flex: 1;
    text-decoration: none !important;
    padding-left: 0.25rem !important;
}

.app-brand-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    width: 48px !important;
    height: 48px !important;
    overflow: hidden !important;
}

.app-brand-logo img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain !important;
}

.app-brand-text {
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    line-height: 1.3 !important;
    color: #fff !important;
    white-space: normal !important;
    text-align: left !important;
    text-transform: uppercase;
    flex: 1;
}

/* Fix sidebar toggle icon - Only show on small screens */
.layout-menu-toggle {
    display: none !important;
}

/* Show toggle icon only on mobile/tablet */
@media (max-width: 1199px) {
    .layout-menu-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 50% !important;
        flex-shrink: 0;
        transition: all 0.2s ease;
    }

    .layout-menu-toggle i {
        font-size: 1.125rem !important;
        color: #fff !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
    }

    .layout-menu-toggle:hover {
        background: rgba(255, 255, 255, 0.2) !important;
        transform: scale(1.08);
    }
}

/* Remove distorted inline styles */
.app-brand .position-absolute {
    position: relative !important;
}

/* Remove CSS circle bullets that hide real icons */
.bg-menu-theme .menu-inner .menu-sub .menu-item > .menu-link::before,
.bg-menu-theme .menu-sub > .menu-item > .menu-link::before {
    content: none !important;
    display: none !important;
}

/* Ensure all icons in sub-menus are visible */
.menu-sub .menu-icon,
.menu-sub .menu-link i[class*="ti-"],
.menu-sub .menu-link i[class*="fa-"],
.menu-sub .menu-link i[class*="bi-"] {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 0.875rem !important;
    margin-right: 0.75rem !important;
    flex-shrink: 0;
}

/* Proper spacing for sub-menu links */
.menu-sub .menu-link {
    padding: 0.625rem 1.5rem 0.625rem 3rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
}

.menu-sub .menu-sub .menu-link {
    padding-left: 4rem !important;
}

/* Text organization in menu links */
.menu-link div {
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    line-height: 1.35;
    max-width: calc(100% - 3rem);
    white-space: nowrap;
}

/* Menu inner wrapper - ensure proper scrolling */
.menu-inner {
    padding-bottom: 2rem !important;
    overflow: visible !important;
}

/* Allow main menu items to wrap if needed */
.menu-inner > .menu-item > .menu-link div {
    white-space: normal;
    overflow: visible;
    max-width: 100%;
}

/* Main menu items spacing */
.menu-inner > .menu-item > .menu-link {
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem;
    min-height: 48px;
}

/* Icon sizing for main menu */
.menu-inner > .menu-item > .menu-link .menu-icon {
    font-size: 1.125rem !important;
    flex-shrink: 0;
}

/* Sub-menu text sizing */
.menu-sub .menu-link div {
    font-size: 0.9rem;
    font-weight: 400;
}

/* Nested sub-menu text - slightly smaller */
.menu-sub .menu-sub .menu-link div {
    font-size: 0.85rem;
}

/* Menu item hover and active states */
.menu-item .menu-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.menu-item .menu-link:hover div {
    font-weight: 500;
    color: #fff !important;
}

/* Active menu item styling */
.menu-item.active > .menu-link,
.menu-link.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-left: 3px solid #ffc107 !important;
}

.menu-item.active > .menu-link div,
.menu-link.active div {
    font-weight: 600;
    color: #ffffff !important;
}

.menu-item.active > .menu-link .menu-icon,
.menu-link.active .menu-icon,
.menu-item.active > .menu-link i,
.menu-link.active i {
    color: #ffc107 !important;
}

/* Sub-menu active items - lighter background */
.menu-sub .menu-item.active > .menu-link,
.menu-sub .menu-link.active {
    background-color: rgba(255, 193, 7, 0.2) !important;
}

.menu-sub .menu-item.active > .menu-link div,
.menu-sub .menu-link.active div {
    color: #ffffff !important;
}

/* Ensure proper alignment */
.menu-link {
    width: 100%;
    box-sizing: border-box;
}

/* Handle long text gracefully */
.menu-link div {
    max-width: 100%;
    word-wrap: break-word;
}

/* Footer positioning fix */
.content-wrapper {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}

.container-p-y {
    flex: 1 0 auto;
    padding-bottom: 2rem;
}

footer,
.footer {
    margin-top: auto;
    width: 100%;
    padding: 1.5rem 0;
    background-color: #2E2252;
    color: #fff;
    flex-shrink: 0;
}

footer .container,
footer .container-fluid {
    max-width: 100%;
}

/* User Account Dropdown Styling - Match Sidebar Theme */
.navbar-dropdown.dropdown-user .dropdown-menu,
.dropdown-user .dropdown-menu {
    background: linear-gradient(135deg, #2E2252 0%, #3d2f6b 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    padding: 1.25rem !important;
    min-width: 280px !important;
    margin-top: 0.5rem !important;
}

.dropdown-user .dropdown-header,
.navbar-dropdown .dropdown-header {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-bottom: 0.75rem !important;
    text-align: center !important;
    font-weight: 600 !important;
}

/* Make role badges container scrollable */
.dropdown-user .dropdown-menu .px-2 {
    max-height: 200px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    background: rgba(0, 0, 0, 0.1) !important;
}

/* Custom scrollbar for role section - Dark blue themed */
.dropdown-user .dropdown-menu .px-2::-webkit-scrollbar {
    width: 8px !important;
}

.dropdown-user .dropdown-menu .px-2::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 10px !important;
    margin: 4px 0 !important;
}

.dropdown-user .dropdown-menu .px-2::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%) !important;
    border-radius: 10px !important;
    border: 2px solid rgba(46, 34, 82, 0.5) !important;
}

.dropdown-user .dropdown-menu .px-2::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #1e40af 0%, #2563eb 100%) !important;
    border-color: rgba(46, 34, 82, 0.7) !important;
}

/* Firefox scrollbar for dropdown */
.dropdown-user .dropdown-menu .px-2 {
    scrollbar-width: thin !important;
    scrollbar-color: #1e3a8a rgba(0, 0, 0, 0.2) !important;
}

.dropdown-user .badge {
    padding: 0.5rem 1rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    margin-bottom: 0.5rem !important;
    display: block;
    width: 100%;
    text-align: center;
}

.dropdown-user .badge.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: #fff !important;
    border: none !important;
}

.dropdown-user .badge.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%) !important;
    color: #000 !important;
    font-weight: 700 !important;
    border: 1px solid rgba(255, 193, 7, 0.3) !important;
}

.dropdown-user .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15) !important;
    margin: 1rem 0 !important;
}

.dropdown-user .dropdown-item {
    color: #fff !important;
    padding: 0.75rem 1rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.dropdown-user .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffc107 !important;
}

.dropdown-user .dropdown-item i {
    color: #ffc107 !important;
}

.dropdown-user .btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    border: none !important;
    color: #fff !important;
    padding: 0.65rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: all 0.2s ease;
}

.dropdown-user .btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4) !important;
}

.dropdown-user .btn-danger i {
    font-size: 1rem !important;
}

/* Account Manage Page Styling */
.manage-account-page h1,
.manage-account-page h3 {
    color: #2E2252 !important;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Manage Navigation - Sidebar Style */
.manage-account-page .nav-pills {
    background: linear-gradient(135deg, #2E2252 0%, #3d2f6b 100%);
    padding: 1rem 0.75rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.manage-account-page .nav-pills .nav-item {
    margin-bottom: 0.5rem;
}

.manage-account-page .nav-pills .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.75rem 0.5rem 0.75rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
}

.manage-account-page .nav-pills .nav-link i {
    flex-shrink: 0;
    font-size: 1.125rem;
}

.manage-account-page .nav-pills .nav-link span {
    flex-grow: 1;
}

.manage-account-page .nav-pills .nav-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffc107 !important;
    border-left-color: #ffc107;
}

.manage-account-page .nav-pills .nav-link.active {
    background: transparent !important;
    color: #ffc107 !important;
    font-weight: 700;
    border-left: 4px solid #ffc107 !important;
    padding-left: 0.65rem !important;
}

/* Form Styling */
.manage-account-page .form-floating {
    margin-bottom: 1.25rem;
}

.manage-account-page .form-control {
    border: 2px solid rgba(46, 34, 82, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
}

.manage-account-page .form-control:focus {
    border-color: #2E2252;
    box-shadow: 0 0 0 0.2rem rgba(46, 34, 82, 0.25);
}

.manage-account-page .btn-primary {
    background: linear-gradient(135deg, #2E2252 0%, #3d2f6b 100%) !important;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.manage-account-page .btn-primary:hover {
    background: linear-gradient(135deg, #3d2f6b 0%, #4d3f7b 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 34, 82, 0.4);
}

/* Card styling for content */
.manage-account-page .col-md-9 > form,
.manage-account-page .col-md-9 > div {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for Account Manage Page */
@media (max-width: 991px) {
    /* Stack navigation vertically on tablets */
    .manage-account-page .row {
        flex-direction: column;
    }
    
    .manage-account-page .col-md-3 {
        width: 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .manage-account-page .col-md-9 {
        width: 100%;
        max-width: 100%;
    }
    
    /* Horizontal navigation menu on medium screens */
    .manage-account-page .nav-pills {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .manage-account-page .nav-pills .nav-item {
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    
    .manage-account-page .nav-pills .nav-link {
        padding: 0.5rem 1rem;
        white-space: nowrap;
        font-size: 0.85rem;
    }
    
    .manage-account-page .nav-pills .nav-link.active {
        border-left: none !important;
        border-bottom: 3px solid #ffc107 !important;
    }
}

@media (max-width: 767px) {
    /* Mobile - Full width stacked layout */
    .manage-account-page h1 {
        font-size: 1.5rem;
    }
    
    .manage-account-page .nav-pills {
        flex-direction: column !important;
        padding: 0.75rem;
    }
    
    .manage-account-page .nav-pills .nav-item {
        width: 100%;
    }
    
    .manage-account-page .nav-pills .nav-link {
        width: 100%;
        text-align: left;
        padding: 0.65rem 0.75rem;
    }
    
    .manage-account-page .nav-pills .nav-link.active {
        border-bottom: none !important;
        border-left: 4px solid #ffc107 !important;
    }
    
    /* Form adjustments */
    .manage-account-page .form-control {
        font-size: 1rem;
    }
    
    .manage-account-page .btn {
        padding: 0.75rem 1.5rem;
    }
    
    /* Card padding reduction */
    .manage-account-page .col-md-9 > form,
    .manage-account-page .col-md-9 > div,
    .card-body {
        padding: 1.25rem !important;
    }
}

@media (max-width: 576px) {
    /* Extra small screens */
    body {
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .manage-account-page {
        padding: 0.5rem;
        overflow-x: hidden !important;
    }
    
    .manage-account-page h1 {
        font-size: 1.25rem;
    }
    
    .manage-account-page .nav-pills .nav-link {
        font-size: 0.8rem;
        padding: 0.6rem 0.65rem;
    }
    
    .manage-account-page .nav-pills .nav-link i {
        font-size: 1rem;
    }
    
    /* Form and card adjustments for extra small screens */
    .card-body {
        padding: 1rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .card-title {
        font-size: 1.25rem !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
    }
    
    .form-control {
        font-size: 0.95rem !important;
    }
    
    .btn-lg {
        padding: 0.65rem 1.25rem !important;
        font-size: 0.95rem !important;
    }
    
    /* Scrollable navigation */
    .manage-account-page .nav-pills {
        max-height: 50vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Custom scrollbar styling for small screens */
@media (max-width: 767px) {
    /* Webkit browsers (Chrome, Safari, Edge) */
    *::-webkit-scrollbar {
        width: 6px !important;
        height: 6px !important;
    }
    
    *::-webkit-scrollbar-track {
        background: rgba(46, 34, 82, 0.1) !important;
        border-radius: 10px !important;
    }
    
    *::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%) !important;
        border-radius: 10px !important;
    }
    
    *::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%) !important;
    }
    
    /* Firefox */
    * {
        scrollbar-width: thin !important;
        scrollbar-color: #1e3a8a rgba(46, 34, 82, 0.1) !important;
    }
}

/* Responsive layout for Change Password and other forms */
@media (max-width: 991px) {
    /* Tablet - Adjust column width */
    .col-lg-7 {
        max-width: 90% !important;
    }
}

@media (max-width: 767px) {
    /* Mobile - Full width forms */
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling on iOS */
    }
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        overflow-x: hidden !important;
    }
    
    .col-lg-7 {
        max-width: 100% !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
        overflow: visible !important;
    }
    
    .card-body {
        padding: 1.5rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .card-title {
        font-size: 1.4rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .form-label {
        font-size: 0.95rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .form-control-lg {
        padding: 0.7rem 0.9rem !important;
        font-size: 1rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.25rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
    }
    
    /* Scrollable navigation on mobile */
    .manage-account-page .nav-pills {
        overflow-y: auto !important;
        max-height: 60vh !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Responsive adjustments for Sidebar */
@media (max-width: 1200px) {
    .layout-menu {
        width: 260px !important;
    }
    
    .menu-link div {
        font-size: 0.85rem;
    }
    
    .menu-sub .menu-link div {
        font-size: 0.8rem;
    }
}
