/* ==========================================================================
   Account menu - the avatar dropdown in the header (user and admin layouts).
   Markup: resources/views/layouts/inc/account_menu_items.blade.php.

   Who is signed in on top, icon rows, external links marked, "New" as a pill
   instead of a raw red dot, Logout set apart in a muted red. Same visual
   language as the My Desklog Customize menu: 10px radius, hairline border,
   soft layered shadow, 7px row radius.
   ========================================================================== */
.dropdown-menu.dl_account_menu {
    --acc-ink: #34444e;
    --acc-muted: #7b8a94;
    --acc-line: #e4eaee;
    --acc-hover: #f3f7fa;
    --acc-danger: #b42318;
    --acc-danger-hover: #fef3f2;

    width: 256px;
    min-width: 256px;
    margin-top: 8px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--acc-line);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(20, 35, 45, .06), 0 14px 32px rgba(20, 35, 45, .14);
    font-family: "Poppins", sans-serif;
}

/* Shared header-menu entrance (this sheet is loaded by both headers).
   Replay on each open without delaying close. Individual translate keeps
   Bootstrap/Popper's positioning transform intact; no layer is retained. */
@media (prefers-reduced-motion: no-preference) {
    .dropdown.open > .dropdown-menu.dl_account_menu,
    .dropdown.show > .dropdown-menu.dl_account_menu,
    .dropdown-menu.dl_account_menu.show,
    .dropdown.open > .dropdown-menu.notification-dropdown-menu,
    .dropdown.show > .dropdown-menu.notification-dropdown-menu,
    .dropdown-menu.notification-dropdown-menu.show {
        animation: dl-header-menu-enter 260ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
    }
}

@keyframes dl-header-menu-enter {
    from {
        opacity: 0;
        translate: 0 -6px;
    }
    to {
        opacity: 1;
        translate: 0 0;
    }
}

/* --- Who is signed in ---------------------------------------------------- */
.dl_account_menu > .dl_acc_head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--acc-line);
}

.dl_account_menu .dl_acc_avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    object-fit: cover;
}

.dl_account_menu .dl_acc_who {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dl_account_menu .dl_acc_name {
    font-size: 14px;
    font-weight: 600;
    line-height: 19px;
    color: var(--acc-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl_account_menu .dl_acc_email {
    font-size: 12px;
    line-height: 17px;
    color: var(--acc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Rows ------------------------------------------------------------------ */
.dl_account_menu > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 20px;
    color: var(--acc-ink);
    white-space: nowrap;
    transition: background-color .12s ease, color .12s ease;
}

.dl_account_menu > li > a:hover,
.dl_account_menu > li > a:focus {
    /* !important: app_user.css / new_theme.css grey every dropdown row with it. */
    background: var(--acc-hover) !important;
    color: #1f2a30;
    text-decoration: none;
}

.dl_account_menu > li > a:focus-visible {
    outline: 2px solid var(--primary-color, #81B504);
    outline-offset: -2px;
}

.dl_account_menu .dl_acc_ico {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--acc-muted);
    transition: color .12s ease;
}

.dl_account_menu > li > a:hover .dl_acc_ico {
    color: var(--acc-ink);
}

/* Opens desklog.io in a new tab. */
.dl_account_menu .dl_acc_ext {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin-left: auto;
    color: var(--acc-muted);
    opacity: .55;
}

.dl_account_menu > li > a:hover .dl_acc_ext {
    opacity: .9;
}

/* Unseen What's new / Changelog entries (was a 20px red "•"). */
.dl_account_menu .dl_acc_new {
    padding: 1px 7px;
    border-radius: 999px;
    background: #ecf6dc;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: .02em;
    color: #4d6c00;
}

.dl_account_menu > li.divider {
    height: 1px;
    margin: 4px 2px;
    background: var(--acc-line);
}

/* --- Logout ---------------------------------------------------------------- */
.dl_account_menu > li > a.dl_acc_logout,
.dl_account_menu > li > a.dl_acc_logout .dl_acc_ico {
    color: var(--acc-danger);
}

.dl_account_menu > li > a.dl_acc_logout:hover,
.dl_account_menu > li > a.dl_acc_logout:focus {
    background: var(--acc-danger-hover) !important;
    color: #912018;
}

/* --- Dark ------------------------------------------------------------------ */
/* dark_mode.css darkens every header dropdown with filter: invert(1)
   hue-rotate(180deg), which would flip this palette straight back to light (and
   the avatar photo with it). This menu carries its own dark colours instead. */
.dark-mode .navbar-right .dropdown-menu.dl_account_menu,
.dark-mode .dropdown-menu.dl_account_menu {
    filter: none !important;
    --acc-ink: #cfd8de;
    --acc-muted: #8b98a1;
    --acc-line: #0b2c40;
    --acc-hover: #052232;
    --acc-danger: #f97066;
    --acc-danger-hover: rgba(240, 68, 56, .12);

    background: #031826;
    border-color: var(--acc-line);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
}

.dark-mode .dl_account_menu > li > a:hover,
.dark-mode .dl_account_menu > li > a:focus {
    color: #e6edf1;
}

.dark-mode .dl_account_menu .dl_acc_new {
    background: #152a0b;
    color: #9fc45a;
}

.dark-mode .dl_account_menu > li > a.dl_acc_logout:hover,
.dark-mode .dl_account_menu > li > a.dl_acc_logout:focus {
    color: #fda29b;
}

/* Stacking while a header menu is open.
   new_theme.css drops the fixed header to z-index 10, but page dropdowns
   (bootstrap-multiselect, Bootstrap .dropdown-menu) sit at 1000+ in the
   root stacking context, so they painted over the account / notification
   menu. Lift the header only while one of its own menus is open (back to
   the theme's 1025 - above page dropdowns, below modal backdrops at 1040),
   so the resting header keeps its low layer and nothing else shifts. */
.app-header-fixed .app-header:has(.navbar-nav > li.dropdown.open),
.app-header-fixed .app-header:has(.navbar-nav > li.dropdown.show) {
    z-index: 1025;
}

/* The pinned page title bar (.page-heaad1 - "User" + the team select on
   /admin/register, and every other page that pins one) rests at z-index 10,
   level with the resting header and drawn over it by DOM order. The lift
   above put the header's opaque bar over it, so the title vanished whenever
   a header menu opened. Lift the title bar one step with it: it sits at the
   left of the bar while the header menus open at the right, so they don't
   meet. Desktop only - below 992px new_theme.css un-pins the title bar and
   the header menus move into the collapsed nav, which it must not cover. */
@media (min-width: 992px) {
    .app-header-fixed:has(.app-header .navbar-nav > li.dropdown.open) .page-heaad1,
    .app-header-fixed:has(.app-header .navbar-nav > li.dropdown.show) .page-heaad1 {
        z-index: 1026;
    }
}
