/**
 * Notification System - FAB + Slide Panel Styles
 *
 * @package KNS_Dynamic_Discounts
 */

/* ===========================
   Floating Action Button (FAB)
   =========================== */

.knsdd-fab {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
}

.knsdd-fab-button {
	position: relative;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #0073aa;
	border: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.knsdd-fab-button:hover {
	background: #005a87;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transform: scale(1.05);
}

.knsdd-fab-button:active {
	transform: scale(0.95);
}

.knsdd-fab-icon {
	width: 20px;
	height: 20px;
	color: #fff;
}

.knsdd-fab-badge {
	position: absolute;
	top: -1px;
	right: -1px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	background: #d63638;
	color: #fff;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	line-height: 16px;
	text-align: center;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.knsdd-fab-badge.knsdd-badge-ready {
	opacity: 1;
}

/* ===========================
   Slide Panel
   =========================== */

.knsdd-notification-panel {
	position: fixed;
	top: 0;
	right: -420px;
	width: 400px;
	height: 100vh;
	background: #fff;
	box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
	z-index: 100000;
	transition: right 0.3s ease;
	display: flex;
	flex-direction: column;
}

.knsdd-notification-panel.open {
	right: 0;
}

/* Panel Header */
.knsdd-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #ddd;
	background: #f9f9f9;
}

.knsdd-panel-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #1d2327;
}

.knsdd-panel-close {
	background: none;
	border: none;
	font-size: 16px;
	line-height: 1;
	color: #646970;
	cursor: pointer;
	padding: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: color 0.2s ease;
}

.knsdd-panel-close:hover {
	color: #2271b1;
}

/* Panel Body */
.knsdd-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: 0;
}

/* States: Loading, Empty, Error */
.knsdd-notifications-loading,
.knsdd-notifications-empty,
.knsdd-notifications-error {
	padding: 40px 20px;
	text-align: center;
	color: #646970;
}

.knsdd-notifications-empty { padding: 60px 20px; }
.knsdd-notifications-error { color: #d63638; }
.knsdd-notifications-loading .spinner { float: none; margin: 0 auto 16px; }
.knsdd-notifications-empty p,
.knsdd-notifications-error p { margin: 0; font-size: 14px; }

/* Notifications List */
.knsdd-notifications-list {
	padding: 0;
	margin: 0;
}

/* Single Notification Item */
.knsdd-notification-item {
	padding: 12px 16px;
	border-bottom: 1px solid #f0f0f0;
	transition: background 0.2s ease;
}

.knsdd-notification-item:hover {
	background: #f9f9f9;
}

.knsdd-notification-item:last-child {
	border-bottom: none;
}

.knsdd-notification-content {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 10px;
}

.knsdd-notification-icon {
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
}

/* Icon colors based on notification type */
.knsdd-notification-item[data-priority="95"] .knsdd-notification-icon,
.knsdd-notification-item[data-priority="90"] .knsdd-notification-icon {
	color: #d63638; /* Red for urgent */
}

.knsdd-notification-item[data-priority="85"] .knsdd-notification-icon,
.knsdd-notification-item[data-priority="80"] .knsdd-notification-icon {
	color: #f0a000; /* Orange for warning */
}

.knsdd-notification-item[data-priority="75"] .knsdd-notification-icon,
.knsdd-notification-item[data-priority="70"] .knsdd-notification-icon {
	color: #2271b1; /* Blue for info */
}

.knsdd-notification-message {
	flex: 1;
	font-size: 13px;
	line-height: 1.5;
	color: #1d2327;
}

.knsdd-notification-actions {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 8px;
	margin-left: 32px;
}

.knsdd-notification-action-buttons {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: nowrap;
	min-width: 0;
}

.knsdd-notification-control-buttons {
	display: flex;
	align-items: center;
	gap: 5px;
	flex-wrap: nowrap;
	justify-self: end;
	min-width: max-content;
}

#knsdd-notification-panel .knsdd-notification-actions .button {
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: auto !important;
	min-width: 0 !important;
	height: 28px !important;
	min-height: 28px !important;
	margin: 0 !important;
	padding: 0 8px !important;
	font-size: 12px !important;
	font-weight: 600;
	line-height: 26px !important;
	text-decoration: none;
	white-space: nowrap;
}

.knsdd-mark-read-notification,
.knsdd-dismiss-notification {
	box-sizing: border-box;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	color: #2c3338;
	cursor: pointer;
	font-size: 12px;
	padding: 0 8px;
	height: 28px;
	min-height: 28px;
	line-height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 3px;
	transition: all 0.2s ease;
	text-decoration: none;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.knsdd-mark-read-notification:hover {
	background: #f0f0f1;
	border-color: #8c8f94;
	color: #2271b1;
}

.knsdd-dismiss-notification:hover {
	background: #f0f0f1;
	border-color: #8c8f94;
	color: #1d2327;
}

/* Read state */
.knsdd-notification-item.read {
	opacity: 0.8;
}

.knsdd-notification-item.read .knsdd-notification-message {
	color: #646970;
}

/* Panel Footer */
.knsdd-panel-footer {
	padding: 16px 20px;
	border-top: 1px solid #ddd;
	background: #f9f9f9;
}

.knsdd-panel-footer .button {
	width: 100%;
	justify-content: center;
}

.knsdd-remaining-count {
	margin-left: 4px;
	color: #646970;
}

/* ===========================
   Overlay
   =========================== */

.knsdd-notification-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.knsdd-notification-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* ===========================
   Animations
   =========================== */

@keyframes slideIn {
	from {
		right: -420px;
	}
	to {
		right: 0;
	}
}

@keyframes fadeOut {
	to {
		opacity: 0;
		transform: translateX(20px);
	}
}

.knsdd-notification-item.dismissed {
	animation: fadeOut 0.3s ease forwards;
}

/* ===========================
   Responsive
   =========================== */

@media screen and (max-width: 782px) {
	.knsdd-notification-panel {
		width: 100%;
		right: -100%;
	}

	.knsdd-notification-panel.open {
		right: 0;
	}

	.knsdd-fab {
		bottom: 16px;
		right: 16px;
	}

	.knsdd-fab-button {
		width: 48px;
		height: 48px;
	}

	.knsdd-fab-icon {
		font-size: 20px;
	}
}

/* ===========================
   RTL Support
   =========================== */

body.rtl .knsdd-fab { right: auto; left: 20px; }
body.rtl .knsdd-fab-badge { right: auto; left: -4px; }
body.rtl .knsdd-notification-panel { right: auto; left: -420px; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15); }
body.rtl .knsdd-notification-panel.open { left: 0; }
body.rtl .knsdd-notification-actions { margin-left: 0; margin-right: 32px; }
body.rtl .knsdd-dismiss-notification { margin-left: 0; margin-right: auto; }

@media screen and (max-width: 782px) {
	body.rtl .knsdd-fab { left: 16px; right: auto; }
	body.rtl .knsdd-notification-panel { left: -100%; right: auto; }
	body.rtl .knsdd-notification-panel.open { left: 0; }
}

/* ===========================
   Accessibility
   =========================== */

.knsdd-fab-button:focus,
.knsdd-panel-close:focus,
.knsdd-dismiss-notification:focus {
	outline: 1px solid #2271b1;
	outline-offset: 1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.knsdd-fab-button {
		border: 2px solid #fff;
	}

	.knsdd-notification-item {
		border-bottom: 2px solid #000;
	}
}
