/* ============================================================
   Unified User Area — Notification + Profile
   Mobile First Design
   ============================================================ */

/* CSS Variables */
:root {
	--nls-red: #c62828;
	--nls-red-soft: rgba(225, 29, 46, 0.08);
	--nls-text: #111827;
	--nls-text-muted: #6b7280;
	--nls-border: #e5e7eb;
	--nls-bg: #f9fafb;
	--nls-shadow: 0 4px 20px rgba(17, 24, 39, 0.12);
	--nls-radius: 12px;
	--nls-radius-lg: 16px;
	--nls-transition: 180ms;
	--nls-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== CONTAINER ==================== */
.nls-user-area {
	position: relative;
	display: inline-flex;
	align-items: center;
}

/* ==================== GUEST STATE: Login Link ==================== */
.nls-login-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: none;
	background: transparent;
	color: var(--nls-red);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: all var(--nls-transition) var(--nls-ease);
	min-height: 44px;
	min-width: 44px;
	border-radius: 8px;
}

.nls-login-btn:hover {
	background: var(--nls-red-soft);
	text-decoration: none;
	text-underline-offset: 2px;
}

.nls-login-btn:active {
	background: rgba(225, 29, 46, 0.15);
}

.nls-login-btn .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
}

/* ==================== LOGGED IN: Avatar Button ==================== */
.nls-user-avatar-btn {
	position: relative;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	border-radius: 999px;
	transition: box-shadow var(--nls-transition) var(--nls-ease), transform var(--nls-transition) var(--nls-ease);
	min-height: 44px;
	min-width: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.nls-user-avatar-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(17, 24, 39, 0.12);
}

.nls-user-avatar-btn[aria-expanded="true"] {
	box-shadow: 0 0 0 2px var(--nls-red);
}

.nls-avatar-img {
	width: 40px;
	height: 40px;
	border-radius: 50% !important;
	object-fit: cover;
	display: block;
	box-shadow: 0 2px 10px rgba(17, 24, 39, 0.08);
}

.nls-avatar-circle {
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--nls-red), rgba(225, 29, 46, 0.75));
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 16px;
	box-shadow: 0 2px 10px rgba(17, 24, 39, 0.08);
}

/* Notification Badge on Avatar */
.nls-notification-badge {
	position: absolute;
	top: 0;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: var(--nls-red);
	color: #fff;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(225, 29, 46, 0.4);
	pointer-events: none;
}

.nls-notification-badge[hidden] {
	display: none;
}

/* ==================== DROPDOWN PANEL ==================== */
.nls-user-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 340px;
	max-height: 480px;
	background: #fff;
	border: 1px solid var(--nls-border);
	border-radius: var(--nls-radius-lg);
	box-shadow: var(--nls-shadow);
	z-index: 100;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: top right;
	animation: nlsPanelIn 0.2s var(--nls-ease);
}

.nls-user-panel[hidden] {
	display: none;
}

@keyframes nlsPanelIn {
	from {
		opacity: 0;
		transform: translateY(-8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ==================== TABS ==================== */
.nls-panel-tabs {
	display: flex;
	border-bottom: 1px solid var(--nls-border);
	flex-shrink: 0;
}

.nls-panel-tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 16px;
	border: none;
	background: transparent;
	color: var(--nls-text-muted);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--nls-transition) var(--nls-ease);
	position: relative;
	min-height: 44px;
}

.nls-panel-tab:hover {
	color: var(--nls-red);
	background: var(--nls-bg);
}

.nls-panel-tab--active {
	color: var(--nls-red);
}

.nls-panel-tab--active::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: var(--nls-red);
}

.nls-panel-tab .dashicons {
	width: 16px;
	height: 16px;
	font-size: 16px;
}

/* ==================== TAB PANELS ==================== */
.nls-tab-panel {
	display: none;
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.nls-tab-panel:not([hidden]) {
	display: flex;
	flex-direction: column;
}

/* ==================== NOTIFICATIONS PANEL ==================== */
.nls-notifications-header {
	display: flex;
	justify-content: flex-end;
	padding: 10px 14px;
	border-bottom: 1px solid var(--nls-border);
	flex-shrink: 0;
}

.nls-mark-all-btn {
	background: none;
	border: none;
	color: var(--nls-red);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	transition: background var(--nls-transition) var(--nls-ease);
}

.nls-mark-all-btn:hover {
	background: var(--nls-red-soft);
}

.nls-notifications-list {
	flex: 1;
	overflow-y: auto;
	min-height: 120px;
}

/* Loading Spinner */
.nls-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
}

.nls-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid var(--nls-border);
	border-top-color: var(--nls-red);
	border-radius: 50%;
	animation: nlsSpin 0.7s linear infinite;
}

@keyframes nlsSpin {
	to { transform: rotate(360deg); }
}

/* Notification Item */
.nls-notification-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--nls-border);
	text-decoration: none;
	color: inherit;
	transition: background var(--nls-transition) var(--nls-ease);
	cursor: pointer;
}

.nls-notification-item:last-child {
	border-bottom: none;
}

.nls-notification-item:hover {
	background: var(--nls-bg);
}

.nls-notification-item--unread {
	background: var(--nls-red-soft);
}

.nls-notification-item--unread:hover {
	background: rgba(225, 29, 46, 0.12);
}

.nls-notification-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: var(--nls-bg);
}

.nls-notification-avatar--initial {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 14px;
	color: var(--nls-text-muted);
	background: #e5e7eb;
}

.nls-notification-body {
	flex: 1;
	min-width: 0;
}

.nls-notification-msg {
	font-size: 13px;
	line-height: 1.45;
	color: var(--nls-text);
	margin-bottom: 3px;
}

.nls-notification-msg strong {
	font-weight: 600;
}

.nls-notification-time {
	font-size: 11px;
	color: var(--nls-text-muted);
}

.nls-notification-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--nls-red);
	flex-shrink: 0;
	margin-top: 5px;
}

.nls-notification-item--read .nls-notification-dot {
	visibility: hidden;
}

/* Empty State */
.nls-notifications-empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--nls-text-muted);
	font-size: 13px;
}

.nls-notifications-empty .dashicons {
	width: 40px;
	height: 40px;
	font-size: 40px;
	margin-bottom: 10px;
	opacity: 0.5;
}

/* Load More Footer */
.nls-notifications-footer {
	padding: 10px 14px;
	border-top: 1px solid var(--nls-border);
	text-align: center;
	flex-shrink: 0;
}

.nls-notifications-footer[hidden] {
	display: none;
}

.nls-load-more-btn {
	background: #fff;
	border: 1px solid var(--nls-border);
	color: var(--nls-text);
	font-size: 13px;
	padding: 8px 16px;
	border-radius: 8px;
	cursor: pointer;
	transition: all var(--nls-transition) var(--nls-ease);
	width: 100%;
}

.nls-load-more-btn:hover {
	background: var(--nls-bg);
	border-color: var(--nls-red);
}

/* ==================== PROFILE PANEL ==================== */
.nls-profile-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 14px;
	border-bottom: 1px solid var(--nls-border);
	flex-shrink: 0;
}

.nls-profile-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--nls-bg);
}

.nls-profile-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nls-profile-avatar .nls-avatar-circle {
	width: 100%;
	height: 100%;
}

.nls-profile-info {
	flex: 1;
	min-width: 0;
}

.nls-profile-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--nls-text);
	display: block;
}

.nls-profile-menu {
	display: flex;
	flex-direction: column;
	flex: 1;
	overflow-y: auto;
}

.nls-profile-menu-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border: none;
	background: transparent;
	color: var(--nls-text);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	text-align: left;
	cursor: pointer;
	transition: all var(--nls-transition) var(--nls-ease);
	width: 100%;
}

.nls-profile-menu-item:hover {
	background: var(--nls-red-soft);
	color: var(--nls-red);
}

.nls-profile-menu-item .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
	flex-shrink: 0;
}

.nls-logout-btn:hover {
	background: rgba(239, 68, 68, 0.1);
	color: #dc2626;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 479px) {
	.nls-user-panel {
		width: calc(100vw - 60px);
		max-height: calc(100vh - 150px);
		transform-origin: bottom center;
		animation: nlsPanelInMobile 0.1s var(--nls-ease);
	}

	@keyframes nlsPanelInMobile {
		from {
			opacity: 0;
			transform: translateX(-60%) translateY(8px) scale(0.98);
		}
		to {
			opacity: 1;
			transform: translateX(-60%) translateY(0) scale(1);
		}
	}

	.nls-login-btn {
		padding: 8px 14px;
		font-size: 13px;
	}

	.nls-panel-tab {
		padding: 10px 12px;
		font-size: 12px;
	}

	.nls-notification-item {
		padding: 10px 12px;
	}

	.nls-profile-menu-item {
		padding: 11px 12px;
	}
}

/* ==================== ACCESSIBILITY ==================== */
.nls-user-avatar-btn:focus-visible,
.nls-login-btn:focus-visible,
.nls-panel-tab:focus-visible,
.nls-profile-menu-item:focus-visible,
.nls-load-more-btn:focus-visible,
.nls-mark-all-btn:focus-visible {
	outline: 2px solid var(--nls-red);
	outline-offset: 2px;
}

/* Focus visible for tab items */
.nls-panel-tab--active:focus-visible {
	outline-offset: 0;
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
	.nls-user-panel,
	.nls-login-btn,
	.nls-user-avatar-btn,
	.nls-panel-tab,
	.nls-profile-menu-item,
	.nls-notification-item {
		transition: none;
		animation: none;
	}

	.nls-spinner {
		animation-duration: 1.4s;
	}
}
