/* BPBytes header: logo, search, notifications, calendar, profile */

/* Hamburger: opens the menu drawer on phones and tablets (see responsive.css); not needed beside a full sidebar. */
.bpbytes-topbar__menu {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--bp-radius-sm);
    background: none;
    color: var(--bp-text);
    cursor: pointer;
}

.bpbytes-topbar__menu:hover {
    background: var(--bp-bg);
}

.bpbytes-topbar__menu svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 991px) {
    .bpbytes-topbar__menu {
        display: flex;
    }
}

.bpbytes-topbar__search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 420px;
    margin: 0 auto;
}

.bpbytes-topbar__search .bpbytes-search-wrap {
    position: relative;
}

.bpbytes-topbar__search input[type="text"] {
    width: 100%;
    height: 38px;
    border: 1px solid var(--bp-border);
    background: var(--bp-surface);
    border-radius: var(--bp-radius);
    padding: 0 36px 0 36px;
    font-size: 13px;
    color: var(--bp-text);
    box-shadow: none;
}

.bpbytes-topbar__search input[type="text"]:focus {
    border-color: var(--bp-primary);
    background: var(--bp-surface);
    outline: none;
    box-shadow: 0 0 0 3px var(--bp-primary-soft);
}

.bpbytes-topbar__search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--bp-text-faint);
    pointer-events: none;
}

.bpbytes-topbar__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.bpbytes-topbar__actions > li {
    list-style: none;
}

.bpbytes-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--bp-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bpbytes-icon-btn svg {
    width: 19px;
    height: 19px;
}

.bpbytes-icon-btn:hover {
    background: var(--bp-surface);
    color: var(--bp-primary);
}

/* Notification bell badge — driven by core include/javascript/alerts.js via
   the .desktop_notifications / .alertsButton / .alert_count contract */
.desktop_notifications {
    position: relative;
    list-style: none;
}

.desktop_notifications .alertsButton {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--bp-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.desktop_notifications .alertsButton:hover,
.desktop_notifications.has-alerts .alertsButton {
    background: var(--bp-surface);
    color: var(--bp-danger);
}

.desktop_notifications .alert_count {
    position: absolute;
    /* On the bell's top-right corner, so the bell stays visible even for a two or three digit count */
    top: -2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4444;
    border: 2px solid var(--bp-surface);
    color: #fff;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    font-weight: 700;
    box-sizing: content-box;
}

.desktop_notifications .alert_count.hidden {
    display: none;
}

/* The unread total travels with the list as a hidden element */
.desktop_notifications #alerts .alerts-meta {
    display: none;
}

.desktop_notifications #alerts {
    display: none;
    position: absolute;
    right: 0;
    top: 46px;
    width: 340px;
    max-height: 440px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bp-surface);
    border-radius: var(--bp-radius);
    box-shadow: var(--bp-shadow-lg);
    padding: 0;
    z-index: var(--bp-z-dropdown);
    scrollbar-width: thin;
    scrollbar-color: var(--bp-border-strong) transparent;
}

.desktop_notifications.open #alerts {
    display: block;
}

.desktop_notifications #alerts::-webkit-scrollbar {
    width: 6px;
}

.desktop_notifications #alerts::-webkit-scrollbar-thumb {
    background: var(--bp-border-strong);
    border-radius: 999px;
}

/* "Clear all" bar — sticky above the list, restyled off the bootstrap btn-warning box */
.desktop_notifications #alerts .clear-all-alerts-container {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: flex-end;
    padding: 8px 10px;
    background: var(--bp-surface);
    border-bottom: 1px solid var(--bp-border);
    z-index: 1;
}

.desktop_notifications #alerts .clear-all-alerts-btn {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--bp-radius-sm);
    background: none;
    color: var(--bp-text-muted);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.desktop_notifications #alerts .clear-all-alerts-btn:hover {
    background: var(--bp-surface-alt);
    color: var(--bp-danger);
    text-decoration: none;
}

/* Each notification card */
.desktop_notifications #alerts .alert {
    position: relative;
    display: block;
    margin: 8px 8px 0;
    padding: 9px 30px 9px 12px;
    border: 1px solid var(--bp-border);
    border-left: 3px solid var(--bp-info);
    border-radius: var(--bp-radius-sm);
    background: var(--bp-surface);
    box-shadow: none;
    color: var(--bp-text);
}

.desktop_notifications #alerts .alert:last-child {
    margin-bottom: 8px;
}

.desktop_notifications #alerts .alert:hover {
    background: var(--bp-surface-alt);
}

.desktop_notifications #alerts .alert.alert-success { border-left-color: var(--bp-success); }
.desktop_notifications #alerts .alert.alert-warning { border-left-color: var(--bp-warning); }
.desktop_notifications #alerts .alert.alert-danger  { border-left-color: var(--bp-danger); }

/* Module name — was a full-size heading; demote to a small tag */
.desktop_notifications #alerts .alert-header {
    margin: 0 0 4px;
    line-height: 1;
}

.desktop_notifications #alerts .alert-header strong {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--bp-primary-soft);
    color: var(--bp-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.desktop_notifications #alerts .alert.alert-success .alert-header strong { background: var(--bp-success-soft); color: var(--bp-success); }
.desktop_notifications #alerts .alert.alert-warning .alert-header strong { background: var(--bp-warning-soft); color: var(--bp-warning); }
.desktop_notifications #alerts .alert.alert-danger  .alert-header strong { background: var(--bp-danger-soft);  color: var(--bp-danger); }

.desktop_notifications #alerts .alert-body {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--bp-text);
    word-break: break-word;
}

.desktop_notifications #alerts .alert .close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--bp-text-faint);
    font-size: 14px;
    line-height: 1;
    font-weight: 400;
    opacity: 1;
    text-shadow: none;
    cursor: pointer;
}

.desktop_notifications #alerts .alert .close:hover {
    background: var(--bp-surface);
    color: var(--bp-danger);
}

.desktop_notifications #alerts:empty::after,
.desktop_notifications #alerts:not(:has(.alert)):not(:empty)::after {
    content: "You're all caught up";
    display: block;
    padding: 28px 10px;
    text-align: center;
    color: var(--bp-text-faint);
    font-size: 12.5px;
}

/* Calendar quicklink */
.bpbytes-topbar__calendar {
    text-decoration: none;
}

/* Profile */
.bpbytes-profile {
    position: relative;
    list-style: none;
}

.bpbytes-profile__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    cursor: pointer;
    border: none;
    background: transparent;
}

.bpbytes-profile__trigger:hover {
    background: var(--bp-surface);
}

.bpbytes-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bp-primary-soft);
    display: block;
}

.bpbytes-avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Deterministic per-user color (picked from the user id in _headerModuleList.tpl's {php}
   block) — the same --bp-cat-1..8 palette used for sidebar categories and listview row
   accents, so each person's initials stay a consistent, recognizable color everywhere. */
.bpbytes-avatar-fallback.bpbytes-avatar-color-1 { background: var(--bp-cat-1); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-2 { background: var(--bp-cat-2); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-3 { background: var(--bp-cat-3); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-4 { background: var(--bp-cat-4); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-5 { background: var(--bp-cat-5); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-6 { background: var(--bp-cat-6); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-7 { background: var(--bp-cat-7); }
.bpbytes-avatar-fallback.bpbytes-avatar-color-8 { background: var(--bp-cat-8); }

.bpbytes-profile__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--bp-text);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bpbytes-profile__caret {
    width: 12px;
    height: 12px;
    color: var(--bp-text-faint);
}

.bpbytes-profile__menu {
    /* Shown while the pointer is over the profile name (or the menu), or the button has keyboard focus, or it was opened
       with a tap/click (.open, for touch screens). visibility + a short delay on the way out, so moving the pointer
       from the name down to the menu does not close it. */
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.2s;
    position: absolute;
    right: 0;
    top: 52px;
    min-width: 200px;
    background: var(--bp-surface);
    border-radius: var(--bp-radius);
    box-shadow: var(--bp-shadow-lg);
    padding: 6px;
    z-index: var(--bp-z-dropdown);
    list-style: none;
}

/* Invisible bridge over the gap between the name and the menu, so the hover is not lost on the way down */
.bpbytes-profile__menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -16px;
    height: 16px;
}

.bpbytes-profile:hover .bpbytes-profile__menu,
.bpbytes-profile:has(.bpbytes-profile__trigger:focus-visible) .bpbytes-profile__menu,
.bpbytes-profile.open .bpbytes-profile__menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
}

.bpbytes-profile__menu li a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--bp-radius-sm);
    color: var(--bp-text);
    text-decoration: none;
    font-size: 13px;
}

.bpbytes-profile__menu li a:hover {
    background: var(--bp-surface-alt);
    text-decoration: none;
}
