/**
 * Header User Menu Styles
 *
 * BuddyBoss-style header actions: messages icon, notifications bell,
 * username + avatar with dropdown.
 *
 * @package IncuCommunity
 * @since 2.0.0
 */

/* ==========================================================================
   1. HEADER OVERRIDES (Bricks template)
   Make the Bricks-rendered header look like BuddyBoss.
   ========================================================================== */

/* Target the Bricks header section */
#brx-header .brxe-section {
    min-height: var(--incuc-header-height, 64px) !important;
    background: var(--incuc-surface, #fff) !important;
    border-bottom: 1px solid var(--incuc-border, #e2e8f0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Container inside header */
#brx-header .brxe-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 24px !important;
    max-width: var(--incuc-container-max, 1280px) !important;
    height: var(--incuc-header-height, 64px) !important;
    padding: 0 24px !important;
    margin: 0 auto !important;
}

/* Logo in header */
#brx-header .brxe-image,
#brx-header .brxe-logo {
    flex-shrink: 0;
    max-width: 160px;
}

#brx-header .brxe-image img,
#brx-header .brxe-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

/* Search bar in header - BuddyBoss style */
#brx-header .incuc-search-bar {
    flex: 1;
    max-width: 520px;
}

#brx-header .incuc-search-bar__wrapper {
    background: #f7f7f8;
    border: 1px solid transparent;
    border-radius: 24px;
    height: 42px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#brx-header .incuc-search-bar__wrapper:focus-within {
    background: #fff;
    border-color: var(--incuc-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#brx-header .incuc-search-bar__icon {
    padding-left: 16px;
    color: #a0a5b1;
    font-size: 14px;
}

#brx-header .incuc-search-bar__input {
    font-size: 14px;
    padding: 10px 16px 10px 8px;
    color: var(--incuc-text, #1e293b);
}

#brx-header .incuc-search-bar__input::placeholder {
    color: #a0a5b1;
}

/* ==========================================================================
   2. HEADER ACTIONS (icon buttons + user menu)
   ========================================================================== */

.incuc-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.incuc-header-actions .incuc-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--incuc-text-secondary, #64748b);
    transition: all 150ms ease;
    cursor: pointer;
    position: relative;
    border: none;
    background: transparent;
    text-decoration: none;
    font-size: 18px;
}

.incuc-header-actions .incuc-icon-btn:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
    color: var(--incuc-text, #1e293b);
}

/* Badges on icon buttons */
.incuc-header-actions .incuc-header-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--incuc-error, #ef4444);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ==========================================================================
   3. USER MENU (avatar + dropdown)
   ========================================================================== */

.incuc-user-menu {
    position: relative;
    margin-left: 4px;
}

.incuc-user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 12px;
    border-radius: 9999px;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: background 150ms ease;
    font-family: var(--incuc-font-family, 'Inter', sans-serif);
}

.incuc-user-menu-trigger:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
}

.incuc-user-menu-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--incuc-text, #1e293b);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incuc-user-menu-trigger img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Dropdown */
.incuc-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--incuc-surface, #fff);
    border: 1px solid var(--incuc-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -4px rgba(0, 0, 0, 0.06);
    z-index: var(--incuc-z-dropdown, 50);
    padding: 6px;
    animation: incuc-dropdown-in 150ms ease;
}

@keyframes incuc-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.incuc-user-dropdown.is-open {
    display: block;
}

.incuc-user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--incuc-text, #1e293b);
    text-decoration: none;
    border-radius: 8px;
    transition: background 150ms ease;
}

.incuc-user-dropdown a:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
}

.incuc-user-dropdown a i {
    font-size: 16px;
    color: var(--incuc-text-secondary, #64748b);
    width: 20px;
    text-align: center;
}

.incuc-dropdown-divider {
    height: 1px;
    background: var(--incuc-border, #e2e8f0);
    margin: 4px 8px;
}

/* ==========================================================================
   4. NOTIFICATION BELL DROPDOWN
   ========================================================================== */

.incuc-notif-bell-wrap {
    position: relative;
}

.incuc-notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -60px;
    width: 360px;
    background: var(--incuc-surface, #fff);
    border: 1px solid var(--incuc-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -4px rgba(0, 0, 0, 0.06);
    z-index: var(--incuc-z-dropdown, 50);
    animation: incuc-dropdown-in 150ms ease;
    overflow: hidden;
}

.incuc-notif-dropdown.is-open {
    display: block;
}

.incuc-notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--incuc-border, #e2e8f0);
}

.incuc-notif-dropdown-header span {
    font-size: 15px;
    font-weight: 600;
    color: var(--incuc-text, #1e293b);
}

.incuc-notif-mark-all {
    border: none;
    background: transparent;
    color: var(--incuc-text-secondary, #64748b);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 150ms, color 150ms;
}

.incuc-notif-mark-all:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
    color: var(--incuc-text, #1e293b);
}

.incuc-notif-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Individual notification item in dropdown */
.incuc-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 150ms;
    cursor: pointer;
}

.incuc-notif-item:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
}

.incuc-notif-item.is-unread {
    background: #eff6ff;
}

.incuc-notif-item.is-unread:hover {
    background: #dbeafe;
}

.incuc-notif-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.incuc-notif-item-body {
    flex: 1;
    min-width: 0;
}

.incuc-notif-item-text {
    font-size: 13px;
    color: var(--incuc-text, #1e293b);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.incuc-notif-item-time {
    font-size: 11px;
    color: var(--incuc-text-secondary, #64748b);
    margin-top: 2px;
}

.incuc-notif-item-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    margin-top: 6px;
}

.incuc-notif-empty {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: var(--incuc-text-secondary, #64748b);
}

.incuc-notif-loading {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: var(--incuc-text-secondary, #64748b);
}

.incuc-notif-view-all {
    display: block;
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--incuc-primary, #6366f1);
    text-decoration: none;
    border-top: 1px solid var(--incuc-border, #e2e8f0);
    transition: background 150ms;
}

.incuc-notif-view-all:hover {
    background: var(--incuc-surface-hover, #f1f5f9);
}

@media (max-width: 480px) {
    .incuc-notif-dropdown {
        width: 300px;
        right: -100px;
    }
}

/* ==========================================================================
   5. GUEST ACTIONS (login/register buttons)
   ========================================================================== */

.incuc-header-actions .incuc-btn-sm {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */

/* Hide username on small screens */
@media (max-width: 768px) {
    .incuc-user-menu-name {
        display: none;
    }

    .incuc-user-menu-trigger {
        padding: 4px;
    }

    #brx-header .brxe-container {
        padding: 0 12px !important;
        gap: 12px !important;
    }

    #brx-header .incuc-search-bar__wrapper {
        height: 38px;
    }
}

/* Very small screens - hide messages icon */
@media (max-width: 480px) {
    .incuc-header-actions .incuc-icon-btn:first-child {
        display: none;
    }
}

/* Admin bar offset */
body.admin-bar #brx-header .brxe-section[style*="sticky"] {
    top: 32px !important;
}

@media (max-width: 782px) {
    body.admin-bar #brx-header .brxe-section[style*="sticky"] {
        top: 46px !important;
    }
}
