/* ==========================================================================
   PrevPlan doca-style header + sidemenu layout
   Classes: .header-nav*, .sidemenu*
   Depends on: design-system.css (doca-button, doca-icon, doca-typeahead, etc.)
   ========================================================================== */

/* Base layout overrides
   ------------------------------------------------------------------ */
body.doca-shell {
    padding-top: 64px;
}

body.doca-shell #content {
    margin-left: 72px;
    padding-bottom: 40px;
    transition: margin-left 0.2s ease;
}

body.doca-shell #footer {
    left: 72px;
    transition: left 0.2s ease;
}

body.doca-shell.sidemenu-expanded #content {
    margin-left: 232px;
}

body.doca-shell.sidemenu-expanded #footer {
    left: 232px;
}

@media (max-width: 768px) {
    body.doca-shell #content,
    body.doca-shell.sidemenu-expanded #content,
    body.doca-shell #footer,
    body.doca-shell.sidemenu-expanded #footer {
        margin-left: 0;
        left: 0;
    }
}

/* Header nav
   ------------------------------------------------------------------ */
.header-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding: 0 15px 0 10px;
    background: #fff;
    border-bottom: 1px solid #e6ebee;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.header-nav__logo {
    display: flex;
    align-items: center;
    margin-right: 26px;
    flex-shrink: 0;
}

.header-nav__logo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.header-nav__logo-button:focus-visible {
    outline: none;
}

.header-nav__logo img {
    height: 36px;
    width: auto;
    display: block;
}

.header-nav__search {
    flex: 1;
    max-width: 326px;
    position: relative;
    margin: 0;
    padding: 0;
    border: 0;
}

.header-nav__search .form-control {
    padding: 0 16px 0 40px;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    background: #f2f5f7;
    font-size: 14px;
    width: 320px;
    color: #17191a;
}

.header-nav__search .form-control:focus {
    background: #fff;
    border-color: #008cff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 140, 255, 0.12);
}

.header-nav__search .header-nav__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #767b7f;
    font-size: 16px;
    pointer-events: none;
}

.header-nav__search .spotlightmenu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e6ebee;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(23, 25, 26, 0.12);
    padding: 8px 0;
    max-height: 420px;
    overflow-y: auto;
    z-index: 201;
    list-style: none;
    margin: 0;
}

.header-nav__search .spotlightmenu.open {
    display: block;
}

.header-nav__search .spotlightmenu .dropdown-header {
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #8a9199;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.header-nav__search .spotlightmenu li {
    list-style: none;
}

.header-nav__search .spotlightmenu .spotlightlink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    color: #17191a;
    text-decoration: none;
    line-height: 1.3;
}

.header-nav__search .spotlightmenu .spotlightlink:hover,
.header-nav__search .spotlightmenu .spotlightlink:focus {
    background: #f2f5f7;
    color: #17191a;
    text-decoration: none;
}

.header-nav__search .spotlightmenu li.active > .spotlightlink,
.header-nav__search .spotlightmenu li.active > .spotlightlink:hover,
.header-nav__search .spotlightmenu li.active > .spotlightlink:focus {
    background: #ebf5ff;
    color: #00417a;
}

.header-nav__search .spotlightmenu .spotlightlink img {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin: 0 !important;
    float: none !important;
    background: #f2f5f7;
}

.header-nav__search .spotlightmenu .spotlight__phase-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ebf5ff;
    color: #008cff;
    font-size: 11px;
    flex-shrink: 0;
}

.header-nav__search .spotlightmenu li.active .spotlight__phase-icon {
    background: #d6e9ff;
    color: #00417a;
}

.header-nav__search .spotlightempty {
    display: block;
    padding: 6px 16px 10px;
    font-size: 12px;
    color: #767b7f;
}

.header-nav__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-nav__item {
    position: relative;
}

.header-nav__icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #4e5255;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}

.header-nav__icon-button:hover {
    background: #f2f5f7;
    color: #17191a;
}

.header-nav__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.header-nav__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e6ebee;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(23, 25, 26, 0.12);
    padding: 8px 0;
    z-index: 201;
    list-style: none;
    margin: 0;
}

.header-nav__user:hover .header-nav__dropdown,
.header-nav__dropdown.open {
    display: block;
}

.header-nav__dropdown .media {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    gap: 10px;
}

.header-nav__dropdown .media:hover {
    background: #f2f5f7;
}

.header-nav__dropdown .unread {
    background: #ebf5ff;
}

.header-nav__dropdown .media-body {
    flex: 1;
    min-width: 0;
}

.header-nav__dropdown .img-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.header-nav__dropdown .overflow-text {
    font-size: 12px;
    color: #4e5255;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.header-nav__dropdown .text-faded {
    font-size: 11px;
    color: #767b7f;
}

.header-nav__dropdown .text-primary {
    color: #008cff;
    font-size: 13px;
    font-weight: 600;
}

.header-nav__dropdown-empty {
    padding: 16px;
    text-align: center;
    color: #767b7f;
    font-size: 13px;
}

/* Header user avatar + dropdown */
.header-nav__user {
    margin-left: 4px;
}

.header-nav__user-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    text-decoration: none;
    border: 2px solid transparent;
    transition: border-color 0.15s ease;
}

.header-nav__user-trigger:hover,
.header-nav__user:hover .header-nav__user-trigger {
    border-color: #008cff;
}

.header-nav__user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.header-nav__dropdown--user {
    min-width: 260px;
    padding: 0;
    overflow: hidden;
}

.header-nav__user-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f7f9fb;
}

.header-nav__user-summary-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.header-nav__user-summary-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-nav__user-summary-name {
    font-size: 13px;
    font-weight: 600;
    color: #17191a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-nav__user-summary-email {
    font-size: 11px;
    color: #767b7f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-nav__menu-divider {
    height: 1px;
    background: #e6ebee;
}

.header-nav__menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: #17191a;
    text-decoration: none;
    cursor: pointer;
}

.header-nav__menu-link:hover {
    background: #f2f5f7;
    color: #17191a;
    text-decoration: none;
}

.header-nav__menu-link .doca-icon {
    width: 16px;
    color: #4e5255;
    font-size: 14px;
    text-align: center;
}

.header-nav__menu-link--danger {
    color: #dc3545;
}

.header-nav__menu-link--danger .doca-icon {
    color: #dc3545;
}

.header-nav__menu-link--danger:hover {
    background: #fdecee;
    color: #dc3545;
}

/* Sidemenu
   ------------------------------------------------------------------ */
.sidemenu {
    position: fixed;
    top: 64px;
    left: 0;
    width: 72px;
    height: calc(100vh - 64px);
    background: #fff;
    border-right: 1px solid #e6ebee;
    z-index: 150;
    overflow: visible;
    transition: width 0.2s ease;
    display: flex;
    flex-direction: column;
}

.sidemenu:hover,
.sidemenu--expanded {
    width: 232px;
}

.sidemenu:hover {
    box-shadow: 2px 0 12px rgba(23, 25, 26, 0.06);
}

.sidemenu__list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    margin-top: 8px !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidemenu__list::-webkit-scrollbar {
    width: 6px;
}

.sidemenu__list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.sidemenu__item {
    position: relative;
    padding: 2px 16px;
    cursor: pointer;
}

.sidemenu__link {
    display: flex;
    align-items: center;
    height: 40px;
    border-radius: 8px;
    color: #17191a;
    text-decoration: none;
    padding: 0 10px;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
}

.sidemenu__link:hover {
    background: #f2f5f7;
    color: #17191a;
    text-decoration: none;
}

.sidemenu__link .doca-icon,
.sidemenu__link > i {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: #4e5255;
}

.sidemenu__link span {
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidemenu:hover .sidemenu__link span,
.sidemenu--expanded .sidemenu__link span {
    opacity: 1;
}

.sidemenu__item.active > .sidemenu__link,
.sidemenu__item.active > .sidemenu__link:hover {
    background: #ebf5ff;
    color: #00417a;
}

.sidemenu__item.active > .sidemenu__link .doca-icon,
.sidemenu__item.active > .sidemenu__link > i {
    color: #008cff;
}

.sidemenu__quick-add {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    color: #767b7f;
    font-size: 14px;
    border-radius: 50%;
    text-decoration: none;
}

.sidemenu:hover .sidemenu__quick-add,
.sidemenu--expanded .sidemenu__quick-add {
    display: inline-flex;
}

.sidemenu__quick-add:hover {
    background: #e6ebee;
    color: #008cff;
}

/* Submenu (secondary flyout) */
.sidemenu__chevron {
    display: none;
    font-size: 10px;
    color: #767b7f;
    margin-left: auto;
}

.sidemenu:hover .sidemenu__chevron,
.sidemenu--expanded .sidemenu__chevron {
    display: inline-block;
}

.sidemenu__secondary {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    min-width: 240px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(23, 25, 26, 0.12);
    padding: 8px;
    z-index: 260;
}

.sidemenu__secondary::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -8px;
    width: 8px;
}

.sidemenu__item:hover > .sidemenu__secondary {
    display: block;
}

.sidemenu__secondary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidemenu__secondary-list li {
    margin: 2px 0;
}

.sidemenu__secondary-list li a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #17191a;
    text-decoration: none;
    white-space: nowrap;
}

.sidemenu__secondary-list li a:hover {
    background: #f2f5f7;
}

.sidemenu__secondary-list li.active a {
    background: #ebf5ff;
    color: #00417a;
}


/* ⌘K shortcut hint inside search */
.header-nav__search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #d9e1e8;
    background: #fff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    color: #767b7f;
    pointer-events: none;
    line-height: 1.2;
}

.header-nav__search:focus-within .header-nav__search-shortcut {
    display: none;
}

/* Print + mobile visibility */
@media print {
    .header-nav,
    .sidemenu {
        display: none !important;
    }

    body.doca-shell {
        padding-top: 0;
    }

    body.doca-shell #content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .sidemenu {
        display: none;
    }
}
