/*--------------------------------------------------------------
# Header
--------------------------------------------------------------*/
.logo {
    line-height: 1;
    position: relative;
    z-index: 1000;
}

@media (min-width: 1200px) {
    .logo {
        width: 280px;
    }
}

.logo img {
    max-height: 90px;
    width: auto;
    margin-right: 6px;
    margin-left: 40px;
}

/* Standalone logo container */
.standalone-container {
    width: auto;
    margin: 0 auto;
}

.standalone-container img {
    max-width: 200px;
    height: auto;
    margin: 0 auto;
}

/* Theme-specific logo display */
/* Default to light theme */
.logo .dark-logo {
    display: none;
}

/* Dark theme */
[data-theme="dark"] .logo .light-logo {
    display: none;
}

[data-theme="dark"] .logo .dark-logo {
    display: block;
}

/* Light theme */
[data-theme="light"] .logo .light-logo {
    display: block;
}

[data-theme="light"] .logo .dark-logo {
    display: none;
}

/* System/Auto theme */
@media (prefers-color-scheme: dark) {
    [data-theme="system"] .logo .light-logo {
        display: none;
    }
    [data-theme="system"] .logo .dark-logo {
        display: block;
    }
}

@media (prefers-color-scheme: light) {
    [data-theme="system"] .logo .light-logo {
        display: block;
    }
    [data-theme="system"] .logo .dark-logo {
        display: none;
    }
}

.logo span {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-color);
    font-family: "Open Sans", sans-serif;
}

.header {
    transition: all 0.3s ease-in-out;
    z-index: 999;
    height: 60px;
    box-shadow: 0px 2px 20px var(--border-color);
    background-color: var(--header-bg);
    padding: 0 1rem;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
}

.header .toggle-sidebar-btn {
    font-size: 32px;
    padding-left: 10px;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    position: relative;
    min-width: 40px;
    min-height: 40px;
    /* Enhanced touch area */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Add visual feedback for touch devices */
@media (hover: none) and (pointer: coarse) {
    .header .toggle-sidebar-btn {
        /* Larger touch target for all touch devices */
        min-width: 48px;
        min-height: 48px;
        margin-right: 10px; /* Create space between button and logo */
    }
    
    .header .toggle-sidebar-btn:active {
        opacity: 0.7; /* Visual feedback when touched */
        transform: scale(0.95); /* Slight scale down effect */
    }
    
    /* Prevent logo from interfering with touch events */
    .logo {
        pointer-events: none;
    }
    
    .logo a, .logo img {
        pointer-events: auto;
    }
    
    /* Fix the parent container to ensure proper touch interaction */
    .header .d-flex.align-items-center.justify-content-between {
        gap: 10px;
        isolation: isolate; /* Create a new stacking context */
    }
    
    /* Reduce left margin on logo for touch screens */
    .logo img {
        margin-left: 15px;
    }
}

/* Additional specificity for Chrome device emulator */
@media screen and (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .header .toggle-sidebar-btn {
        /* Even larger touch target for smaller screens */
        min-width: 44px;
        min-height: 44px;
        font-size: 28px;
        padding-left: 0;
        margin-right: 8px;
    }
    
    .logo img {
        max-height: 60px;
        margin-left: 5px;
    }
}

/* Prevent event conflicts for very small screens on any device */
@media screen and (max-width: 576px) {
    .header .toggle-sidebar-btn {
        font-size: 24px;
        padding-left: 2px;
        min-width: 30px;
        min-height: 30px;
    }
    
    .logo img {
        margin-left: 10px;
    }
    
    /* Force higher z-index and isolation for touch interactions */
    .header .toggle-sidebar-btn {
        z-index: 2000;
        position: relative;
        isolation: isolate;
    }
}

/* iPhone SE, iPhone 8 and other small iPhones */
@media (max-width: 375px) {
    .header {
        padding: 0 0.3rem;
    }
    
    .header .toggle-sidebar-btn {
        font-size: 22px;
        padding-left: 0;
        min-width: 44px; /* Apple's recommended minimum touch target size */
        min-height: 44px;
    }
    
    .logo img {
        max-height: 50px !important;
        height: 50px !important;
        margin-left: 5px;
    }
    
    .header .d-flex.align-items-center.justify-content-between {
        gap: 2px;
    }
}

/* iPhone 12/13 mini and other very small screens */
@media (max-width: 320px) {
    .header .toggle-sidebar-btn {
        font-size: 20px;
    }
    
    .logo img {
        max-height: 45px !important;
        height: 45px !important;
        margin-left: 2px;
    }
}

/* Ensure proper spacing in landscape orientation on small devices */
@media (max-height: 450px) and (orientation: landscape) {
    .header {
        height: 50px;
    }
    
    .logo img {
        max-height: 40px !important;
        height: 40px !important;
    }
    
    .header .toggle-sidebar-btn {
        min-height: 40px;
    }
}

.header .search-bar {
    min-width: 360px;
    padding: 0 20px;
}

@media (max-width: 1199px) {
    .header .search-bar {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        padding: 20px;
        box-shadow: 0px 0px 15px 0px rgba(1, 41, 112, 0.1);
        background: white;
        z-index: 9999;
        transition: transform 0.2s ease-in;
        visibility: hidden;
        opacity: 0;
    }

    .header .search-bar-show {
        top: 60px;
        visibility: visible;
        opacity: 1;
    }
}

.header .search-form {
    width: 100%;
}

.header .search-form input {
    border: 0;
    font-size: 14px;
    color: var(--text-color);
    border: 1px solid var(--text-color-light);
    padding: 7px 38px 7px 8px;
    border-radius: 3px;
    transition: transform 0.2s ease-in;
    width: 100%;
}

.header .search-form input:focus,
.header .search-form input:hover {
    outline: none;
    box-shadow: 0 0 10px 0 rgba(1, 41, 112, 0.15);
    border: 1px solid rgba(1, 41, 112, 0.3);
}

.header .search-form button {
    border: 0;
    padding: 0;
    margin-left: -30px;
    background: none;
}

.header .search-form button i {
    color: var(--text-color);
}

/*--------------------------------------------------------------
  # Header Nav
  --------------------------------------------------------------*/
.header-nav {
    margin-right: 20px;
}

.header-nav ul {
    list-style: none;
}

.header-nav>ul {
    margin: 0;
    padding: 0;
}

.header-nav .nav-icon {
    font-size: 22px;
    color: var(--text-color);
    margin-right: 25px;
    position: relative;
}

.header-nav .nav-profile {
    color: var(--text-color);
}

.header-nav .nav-profile img {
    max-height: 36px;
}

.header-nav .nav-profile span {
    font-size: 14px;
    font-weight: 600;
}

.header-nav .badge-number {
    position: absolute;
    inset: -2px -5px auto auto;
    font-weight: normal;
    font-size: 12px;
    padding: 3px 6px;
}

.header-nav .notifications {
    inset: 8px -15px auto auto !important;
}

.header-nav .notifications .notification-item {
    display: flex;
    align-items: center;
    padding: 15px 10px;
    transition: transform 0.2s ease-in;
}

.header-nav .notifications .notification-item i {
    margin: 0 20px 0 10px;
    font-size: 24px;
}

.header-nav .notifications .notification-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.header-nav .notifications .notification-item p {
    font-size: 13px;
    margin-bottom: 3px;
    color: #919191;
}

.header-nav .notifications .notification-item:hover {
    background-color: var(--bg-color);
}

.header-nav .messages {
    inset: 8px -15px auto auto !important;
}

.header-nav .messages .message-item {
    padding: 15px 10px;
    transition: transform 0.2s ease-in;
}

.header-nav .messages .message-item a {
    display: flex;
}

.header-nav .messages .message-item img {
    margin: 0 20px 0 10px;
    max-height: 40px;
}

.header-nav .messages .message-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #444444;
}

.header-nav .messages .message-item p {
    font-size: 13px;
    margin-bottom: 3px;
    color: #919191;
}

.header-nav .messages .message-item:hover {
    background-color: var(--bg-color);
}

.header-nav .profile {
    min-width: 240px;
    padding-bottom: 0;
    top: 8px !important;
}

.header-nav .profile .dropdown-header h6 {
    font-size: 18px;
    margin-bottom: 0;
    font-weight: 600;
    color: #444444;
}

.header-nav .profile .dropdown-header span {
    font-size: 14px;
}

.header-nav .profile .dropdown-item {
    font-size: 14px;
    padding: 10px 15px;
    transition: transform 0.2s ease-in;
}

.header-nav .profile .dropdown-item i {
    margin-right: 10px;
    font-size: 18px;
    line-height: 0;
}

.header-nav .profile .dropdown-item:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}


/*--------------------------------------------------------------
# Footer
--------------------------------------------------------------*/
.footer_ {
    padding: 20px 0;
    font-size: 14px;
    transition: transform 0.2s ease-in;
}

.footer_ .copyright {
    text-align: center;
}

.footer .credits {
    padding-top: 5px;
    text-align: center;
    font-size: 13px;
    color: var(--text-color);
}

.copyright {
    text-align: center;
    color: var(--text-color);
    font-size: 11px;
    background-color: var(--bg-color);
    text-align: center;
}

.fixed-bottom {
    bottom: 0px;
    z-index: 300;
}

@media (max-width: 768px) {
    .footer_ .copyright,
    .footer_ .credits {
        position: relative;
        top: 0px;
        left: 0px;
        z-index: 0;
        font-size: 8px;
    }

    .fixed-bottom {
        z-index: 300;
        bottom: 0px;
    }
}

/* Breadcrumbs */
.breadcrumb {
    font-size: 14px;
    font-family: "Open Sans", sans-serif;
    color: var(--text-color);
    font-weight: 600;
    width: 100%;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 12px;
    }
    .breadcrumb-item {
        font-size: 12px;
        padding: 0.2rem 0.5rem;
    }
    .breadcrumb.a {
        font-size: 12px;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 420px) {
    .breadcrumb {
        font-size: 10px;
        padding: 0.1rem 0.3rem;
    }
    .breadcrumb-item {
        font-size: 10px;
        padding: 0.1rem 0.3rem;
    }
    .breadcrumb.item a {
        font-size: 10px;
        padding: 0.1rem 0.3rem;
    }
}

@media (max-width: 320px) {
    .breadcrumb {
        font-size: 8px;
    }
    .breadcrumb-item {
        font-size: 8px;
        padding: 0.1rem 0.3rem;
    }
    .breadcrumb a {
        font-size: 8px;
        padding: 0;
    }
}

.breadcrumb a {
    color: var(--text-color);
    transition: transform 0.2s ease-in;
}

.breadcrumb a:hover {
    color: #51678f;
}

.breadcrumb .breadcrumb-item::before {
    color: #899bbd;
}

.breadcrumb .active {
    color: #51678f;
    font-weight: 600;
}

/* Verification alert styles */
.verification-alert {
    flex: 1;
}

.verification-alert .alert {
    margin-bottom: 0;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}

.verification-alert .btn-sm {
    margin-left: 1rem;
    padding: 0.25rem 0.5rem;
}

.verification-alert #cooldownTimer {
    margin-left: 0.5rem;
}

/* Theme and language switcher container */
.theme-lang-container {
    margin-left: auto;
}

/* Media queries for responsive header */
@media (max-width: 767.98px) {
    .logo img {
        max-height: 60px;
        margin-left: 10px;
    }
    
    .header {
        height: 60px;
        padding: 0 0.5rem;
    }
    
    .theme-lang-container {
        display: flex;
        gap: 5px;
    }
}

@media (max-width: 575.98px) {
    .logo img {
        height: 60px !important;
    }
    
    .theme-lang-container {
        transform: scale(0.9);
        transform-origin: right center;
    }
}

@media (max-width: 420px) {
    .logo img {
        height: 60px !important;
    }
    
    .theme-lang-container {
        transform: scale(0.85);
    }
}

@media (max-width: 360px) {
    .logo img {
        height: 65px !important;
    }
    
    .theme-lang-container {
        transform: scale(0.8);
    }
}

/* Container for toggle button and logo */
.header .d-flex.align-items-center.justify-content-between {
    display: flex;
    align-items: center;
    gap: 10px; /* Ensures minimum spacing between toggle and logo */
    width: auto;
}

@media (max-width: 576px) {
    .header .d-flex.align-items-center.justify-content-between {
        gap: 5px; /* Less spacing on very small screens but still enough to separate */
    }
}

/* Specific fixes for iPhones with notches/dynamic islands */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    @media (max-width: 576px) {
        .header {
            padding-left: max(0.5rem, env(safe-area-inset-left));
            padding-right: max(0.5rem, env(safe-area-inset-right));
        }
    }
    
    @media (max-width: 375px) {
        .header {
            padding-left: max(0.3rem, env(safe-area-inset-left));
            padding-right: max(0.3rem, env(safe-area-inset-right));
        }
        
        /* Ensure toggle button is easy to tap */
        .header .toggle-sidebar-btn {
            position: relative;
            isolation: isolate; /* Create a new stacking context */
            z-index: 2000; /* Even higher z-index to ensure it's on top */
            margin-right: 5px; /* Add right margin to separate from logo */
        }
        
        /* Prevent accidental taps on logo when trying to tap toggle */
        .logo {
            pointer-events: none; /* Logo container doesn't capture clicks */
        }
        
        .logo a, .logo img {
            pointer-events: auto; /* But links and images inside still do */
        }
    }
}