/**
 * DH Suite — shared menus.
 *
 * Split out of components.css, which had grown to 1,073 lines
 * across eleven unrelated families. Same layer, same order: these are
 * linked in the sequence they were concatenated, because within a layer
 * later source wins.
 */

@layer components {

/* ==========================================================================
   User Menu + Avatar
   ========================================================================== */

/* --- Find a page ------------------------------------------------------- */
/* The header's search box over the suite menu. On phones the menu sheet
   carries it instead, so the header keeps its room. */

.suite-search {
    position: relative;
    flex: 0 1 320px;
    margin: 0 var(--spacing-4);
}

.suite-search-input {
    width: 100%;
    padding: var(--spacing-2) var(--spacing-3);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    background-color: var(--color-gray-50);
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-gray-900);
}

.suite-search-input:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 1px;
    background-color: white;
}

.suite-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: var(--spacing-1) 0;
    list-style: none;
    background-color: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 110;
    max-height: 60vh;
    overflow-y: auto;
}

.suite-search-results[hidden] {
    display: none;
}

.suite-search-option {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-gray-900);
}

.suite-search-option[aria-selected="true"],
.suite-search-option:hover {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.suite-search-group {
    color: var(--color-gray-600);
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

.suite-search-empty {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

@media (max-width: 767px) {
    .app-header .suite-search {
        display: none;
    }
}

/* In the phone menu sheet: full width at the top. */
.suite-search--sheet {
    flex: none;
    margin: var(--spacing-3) var(--spacing-4) var(--spacing-1);
}

/* --- Edit shortcuts dialog --------------------------------------------- */

.suite-shortcuts {
    width: min(420px, calc(100vw - 2 * var(--spacing-4)));
    padding: var(--spacing-5);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.suite-shortcuts [hidden] {
    display: none;
}

.suite-shortcuts::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.suite-shortcuts h2 {
    margin: 0 0 var(--spacing-2);
    font-size: var(--font-size-lg);
}

.suite-shortcuts .form-select {
    width: 100%;
}

.suite-shortcuts-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin-top: var(--spacing-4);
}

/* --- Avatar -------------------------------------------------------------- */

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: white;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
}

/* --- Logo card ---------------------------------------------------------- */
/*
 * Holds a customer logo on any surface — typically a brand-colored hero,
 * an email header band, or the dispatch map overlay. The card supplies a
 * neutral background so the logo (usually rendered in the customer's
 * brand color) stays visible against a brand-colored background.
 *
 * Background defaults to the auto-derived `--color-surface` (see
 * shared.utils.branding.derive_surface_color and STYLE-GUIDE.md
 * §Brand-colored and Complementary Surfaces). Falls back to white so
 * the card still renders sensibly on a surface where no branding
 * context is set.
 */
.logo-card {
    display: inline-block;
    padding: var(--spacing-3);
    background: var(--color-surface, white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    line-height: 0; /* Suppress baseline whitespace under the image */
}

.logo-card > img,
.logo-card > svg {
    display: block;
    /* Reset's `max-width: 100%` would zero this out inside the
     * shrink-to-fit card. Let the logo's intrinsic + consumer-set
     * max-height drive the card's size. */
    max-width: none;
    /* Consumers (e.g. .landing-hero-logo) set their own max-height. */
}

/* --- User menu container ------------------------------------------------- */

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-2);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-gray-700);
    font-size: var(--font-size-sm);
}

.user-btn:hover {
    background-color: var(--color-gray-50);
}

.user-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* --- Dropdown ------------------------------------------------------------ */

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background-color: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-2) 0;
    z-index: 150;
}

.dropdown-item {
    display: block;
    padding: var(--spacing-3) var(--spacing-4);
    color: var(--color-gray-700);
    text-decoration: none;
    font-size: var(--font-size-sm);
}

.dropdown-item:hover {
    background-color: var(--color-gray-50);
    text-decoration: none;
}

.dropdown-item:focus-visible {
    outline: var(--focus-ring);
    outline-offset: calc(-1 * var(--focus-ring-offset, 2px));
    background-color: var(--color-gray-50);
}

.user-dropdown hr {
    margin: var(--spacing-2) 0;
    border: none;
    border-top: 1px solid var(--color-gray-200);
}

/* ==========================================================================
   Notification Bell
   ========================================================================== */

.notification-bell {
    position: relative;
}

.notification-bell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-bell-btn:hover {
    background-color: var(--color-gray-100);
    color: var(--color-gray-800);
}

.notification-bell-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.notification-bell-btn svg {
    width: 20px;
    height: 20px;
}

/* Unread count badge — positioned top-right of the bell icon */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 var(--spacing-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    border-radius: var(--radius-full);
    background-color: var(--color-danger);
    color: white;
}

}
