/*
 * Bell Notification Component
 *
 * BEM classes: .bell, .bell__button, .bell__badge, .bell__panel,
 *              .bell__panel-header, .bell__list, .bell__item,
 *              .bell__item--unread, .bell__empty
 *
 * Design tokens: reuses --primary-color (#c7966c gold), --danger-color (#fa4362),
 * --dark-bg (#263238) from buttons.css. Panel colour mirrors .admin-dropdown-menu
 * and .user-dropdown-menu in header.css (#1f2937 background).
 */

/* ============================================================
   x-cloak guard (hide Alpine-managed elements before init)
   ============================================================ */
[x-cloak] {
    display: none !important;
}

/* ============================================================
   Bell wrapper — anchor point for the dropdown
   ============================================================ */
.bell {
    position: relative;
    display: inline-block;
}

/* ============================================================
   Bell button — sits alongside .nav-btn items in .header-nav
   ============================================================ */
.bell__button {
    position: relative;
    background-color: var(--dark-bg, #263238);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--dark-bg, #263238);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.bell__button:hover {
    background-color: #1a1f22;
    border-color: #1a1f22;
    transform: translateY(-1px);
    color: var(--primary-color, #c7966c);
}

.bell__button[aria-expanded="true"] {
    background-color: #1a1f22;
    color: var(--primary-color, #c7966c);
}

/* ============================================================
   Unread badge — red pill in the upper-right corner
   ============================================================ */
.bell__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--danger-color, #fa4362);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   Dropdown panel
   ============================================================ */
.bell__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 360px;
    background-color: #111827;
    border: 1px solid rgba(199, 150, 108, 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
    z-index: 1100;
    overflow: hidden;
    max-height: 480px;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Panel header row
   ============================================================ */
.bell__panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #1f2937;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(199, 150, 108, 0.15);
    flex-shrink: 0;
}

.bell__panel-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
}

/* Mark-all-read button — reuses .btn--review-outline aesthetic */
.bell__mark-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    background-color: transparent;
    color: var(--primary-color, #c7966c);
    border: 1px solid rgba(199, 150, 108, 0.3);
}

.bell__mark-all-btn:hover {
    background-color: rgba(199, 150, 108, 0.08);
    border-color: var(--primary-color, #c7966c);
}

/* ============================================================
   Notification list
   ============================================================ */
.bell__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* ============================================================
   Individual notification item
   ============================================================ */
.bell__item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s ease;
}

.bell__item:last-child {
    border-bottom: none;
}

.bell__item:hover {
    background-color: rgba(199, 150, 108, 0.06);
}

/* Unread items get a gold left accent and a subtly tinted background */
.bell__item--unread {
    border-left: 3px solid var(--primary-color, #c7966c);
    background-color: rgba(199, 150, 108, 0.05);
}

.bell__item--unread:hover {
    background-color: rgba(199, 150, 108, 0.1);
}

.bell__item-link {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.bell__item-link:hover {
    text-decoration: none;
    color: inherit;
}

.bell__item-body {
    flex: 1;
    min-width: 0;
}

.bell__item-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: #e5e7eb;
    font-family: 'Outfit', sans-serif;
    margin: 0 0 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bell__item--unread .bell__item-title {
    color: #ffffff;
}

.bell__item-body-text {
    font-size: 0.775rem;
    color: #9ca3af;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.bell__item-time {
    font-size: 0.725rem;
    color: #6b7280;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* ============================================================
   Empty state
   ============================================================ */
.bell__empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    font-family: 'Outfit', sans-serif;
    margin: 0;
}

/* ============================================================
   Mobile — panel stretches to full width at narrow viewports
   ============================================================ */
@media (max-width: 480px) {
    .bell__panel {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
    }
}
