/**
 * Client top bar and sidebar – fixed dimensions for client login layout
 */

:root {
    --client-sidebar-width: 20%;
}

/* ----- Top bar: full width of screen (minus sidebar), responsive ----- */
.topnav-client {
    position: fixed;
    top: 0;
    left: var(--client-sidebar-width);
    right: 0;
    width: calc(100% - var(--client-sidebar-width));
    max-width: 100%;
    min-width: 0;
    height: 68px;
    opacity: 1;
    transform: rotate(0deg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 24px;
    box-sizing: border-box;
    background: #fff;
    border-bottom: 1px solid #dee4ec;
    box-shadow: 5px 7px 26px -5px #cdd4e7;
    z-index: 998;
    overflow: visible;
}

.topnav-client__menu-btn,
.topnav-client .res-sidebar-open-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: 0 4px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #5b6e88;
    cursor: pointer;
    font-size: 1.5rem;
}
@media (max-width: 991px) {
    .topnav-client__menu-btn,
    .topnav-client .res-sidebar-open-btn {
        display: flex !important;
    }
}

@media (max-width: 991px) {
    .topnav-client {
        left: 0;
        width: 100%;
        padding: 0 12px 0 16px;
    }
    .topnav-client__search {
        left: 56px;
        width: 180px;
        max-width: calc(100vw - 240px);
    }
    .topnav-client__search-input {
        width: 180px;
        max-width: calc(100vw - 240px);
    }
    .topnav-client__profile {
        left: auto;
        right: 12px;
        width: auto;
        min-width: 0;
        max-width: 50%;
    }
}

/* ----- Search bar ----- */
.topnav-client__search {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 42px; /* 292 - 250 = 42 from top bar start */
    width: 280px;
    height: 36px;
    opacity: 1;
    display: flex;
    align-items: center;
    margin: 0;
}

.topnav-client__search-btn {
    position: absolute;
    left: 0;
    width: 32px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: #5b6e88;
    cursor: pointer;
}

.topnav-client__search-input {
    width: 280px;
    height: 36px;
    padding: 0 10px 0 32px;
    font-size: 0.875rem;
    border: 1px solid #dee4ec;
    border-radius: 4px;
    box-sizing: border-box;
}

.topnav-client__search-input:focus {
    outline: none;
    border-color: #5dc2aa;
}

/* ----- Profile block: right side, prevent dropdown cut-off ----- */
.topnav-client__profile {
    position: absolute;
    top: 16px;
    right: 16px;
    left: auto;
    width: 185px;
    max-width: calc(100% - 320px);
    height: 36px;
    opacity: 1;
    transform: rotate(0deg);
    overflow: visible;
}

.topnav-client__profile .dropdown {
    position: static;
}

.topnav-client__profile .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 180px;
    z-index: 9999;
}

.topnav-client__profile-btn {
    display: flex;
    align-items: center;
    width: 100%;
    height: 36px;
    padding: 0 8px 0 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.topnav-client__profile-thumb {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.topnav-client__profile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topnav-client__profile-name {
    flex: 1;
    min-width: 0;
    margin-left: 10px;
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topnav-client__profile-icon {
    flex-shrink: 0;
    color: #5b6e88;
    font-size: 1.25rem;
}

/* ----- Sidebar (when using client top bar layout) ----- */
.page-wrapper.client-topbar-layout .sidebar {
    width: var(--client-sidebar-width);
    min-width: 240px;
    max-width: 340px;
    padding: 10px 12px;
    box-sizing: border-box;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__logo {
    padding: 12px 8px;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu {
    margin-top: 10px;
}

@media (max-width: 991px) {
    .page-wrapper.client-topbar-layout .sidebar {
        left: -220px;
        z-index: 999;
        transition: left 0.3s ease;
    }
    .page-wrapper.client-topbar-layout .sidebar.open {
        left: 0;
        z-index: 1000;
    }
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 120px);
    -webkit-overflow-scrolling: touch;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu > .sidebar-menu-item {
    margin-bottom: 0;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu .sidebar-menu-item > a {
    padding: 8px 14px;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu .sidebar-menu-item > a:hover {
    padding-left: 14px;
}

/* Selected/highlighted menu: round rectangle, white background, navy blue text */
.page-wrapper.client-topbar-layout .sidebar .sidebar__menu .sidebar-menu-item.active > a {
    background-color: #ffffff !important;
    color: #001f3f;
    border-radius: 8px;
}

.page-wrapper.client-topbar-layout .sidebar .sidebar__menu .sidebar-menu-item.active > a .menu-icon,
.page-wrapper.client-topbar-layout .sidebar .sidebar__menu .sidebar-menu-item.active > a .menu-title {
    color: #001f3f;
}

.page-wrapper.client-topbar-layout .body-wrapper {
    margin-left: var(--client-sidebar-width);
    padding: 68px 0 0 0;
    overflow-x: hidden;
    width: calc(100% - var(--client-sidebar-width));
    max-width: calc(100% - var(--client-sidebar-width));
    box-sizing: border-box;
}

.page-wrapper.client-topbar-layout .bodywrapper__inner.container-fluid {
    max-width: 90%;
    margin: 2% 2% 2% 7%;
}

@media (max-width: 991px) {
    .page-wrapper.client-topbar-layout .body-wrapper {
        margin-left: 0;
        padding-top: 68px;
    }
}


@media (max-width: 575px) {
    .topnav-client {
        padding: 0 8px 0 12px;
    }
    .topnav-client__search {
        left: 8px;
        width: 120px;
        max-width: calc(100vw - 160px);
    }
    .topnav-client__search-input {
        width: 120px;
        max-width: calc(100vw - 160px);
    }
    .topnav-client__profile {
        right: 8px;
        width: 140px;
        max-width: 45%;
    }
    .topnav-client__profile-name {
        font-size: 0.8125rem;
    }
}
