/**
 * 3Syxty Studio — Notification Dropdown Component
 *
 * Bell icon dropdown with grouped notifications, read/unread states,
 * action buttons, and empty state. Accessible with ARIA live region.
 */

/* -----------------------------------------------------------------------
   Trigger Button
   ----------------------------------------------------------------------- */

.notification-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--motion-instant), color var(--motion-instant);
}

.notification-trigger:hover {
    background-color: var(--accent-primary-subtle);
    color: var(--text-primary);
}

.notification-trigger:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.notification-trigger svg {
    width: 18px;
    height: 18px;
}

/* Unread count badge */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font: var(--type-overline);
    font-size: 9px;
    font-weight: 700;
    color: #FFFFFF;
    background-color: var(--error);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--surface-secondary);
    pointer-events: none;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none;
}

/* Pulse animation for new notifications */
.notification-badge-pulse {
    animation: pulse-ring 2s infinite;
}

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

.notification-panel {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    width: 380px;
    max-height: 480px;
    background-color: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-heavy);
    z-index: var(--z-dropdown);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scale-in var(--motion-fast) forwards;
    transform-origin: top right;
}

.notification-panel[data-closing="true"] {
    animation: scale-out 100ms ease-in forwards;
}

/* -----------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------- */

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.notification-header-title {
    font: var(--type-body);
    font-weight: 600;
    color: var(--text-primary);
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.notification-mark-read {
    font: var(--type-caption);
    color: var(--accent-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity var(--motion-instant);
}

.notification-mark-read:hover {
    opacity: 0.8;
}

/* -----------------------------------------------------------------------
   Tabs (All / Unread)
   ----------------------------------------------------------------------- */

.notification-tabs {
    display: flex;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.notification-tab {
    padding: var(--space-2) var(--space-3);
    font: var(--type-body-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color var(--motion-instant), border-color var(--motion-instant);
}

.notification-tab:hover {
    color: var(--text-secondary);
}

.notification-tab[aria-selected="true"] {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* -----------------------------------------------------------------------
   Notification List
   ----------------------------------------------------------------------- */

.notification-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Group date label */
.notification-date {
    padding: var(--space-2) var(--space-4) var(--space-1);
    font: var(--type-overline);
    color: var(--text-muted);
    position: sticky;
    top: 0;
    background-color: var(--surface-elevated);
    z-index: 1;
}

/* -----------------------------------------------------------------------
   Notification Item
   ----------------------------------------------------------------------- */

.notification-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background-color var(--motion-instant);
    position: relative;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.notification-item:hover {
    background-color: var(--accent-primary-subtle);
}

.notification-item:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: -2px;
}

/* Unread indicator */
.notification-item[data-unread="true"]::before {
    content: '';
    position: absolute;
    left: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-primary);
}

.notification-item[data-unread="true"] {
    padding-left: calc(var(--space-4) + var(--space-2));
}

/* Avatar / Icon */
.notification-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.notification-item-icon-info {
    background-color: var(--info-subtle);
    color: var(--info);
}

.notification-item-icon-success {
    background-color: var(--success-subtle);
    color: var(--success);
}

.notification-item-icon-warning {
    background-color: var(--warning-subtle);
    color: var(--warning);
}

.notification-item-icon-error {
    background-color: var(--error-subtle);
    color: var(--error);
}

.notification-item-icon svg {
    width: 18px;
    height: 18px;
}

/* Content */
.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-text {
    font: var(--type-body-sm);
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-item-text strong {
    font-weight: 600;
}

.notification-item-time {
    font: var(--type-caption);
    color: var(--text-muted);
    margin-top: 2px;
}

.notification-item-actions {
    display: flex;
    gap: var(--space-1-5);
    margin-top: var(--space-2);
}

/* -----------------------------------------------------------------------
   Empty State
   ----------------------------------------------------------------------- */

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) var(--space-6);
    text-align: center;
}

.notification-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--surface-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.notification-empty-icon svg {
    width: 22px;
    height: 22px;
}

.notification-empty-title {
    font: var(--type-body);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.notification-empty-desc {
    font: var(--type-body-sm);
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------- */

.notification-footer {
    padding: var(--space-2-5) var(--space-4);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    flex-shrink: 0;
}

.notification-footer a {
    font: var(--type-body-sm);
    font-weight: 500;
    color: var(--accent-primary);
    transition: opacity var(--motion-instant);
}

.notification-footer a:hover {
    opacity: 0.8;
}
