/**
 * ModcuAbi Notification Manager - Public CSS
 * High-performance, responsive & modern notification toast styling
 */

:root {
	--mc-primary: #6366f1;
	--mc-primary-hover: #4f46e5;
	--mc-success: #10b981;
	--mc-warning: #f59e0b;
	--mc-danger: #ef4444;
	--mc-info: #0ea5e9;
	--mc-update: #8b5cf6;
	--mc-dark-bg: rgba(15, 23, 42, 0.94);
	--mc-light-bg: rgba(255, 255, 255, 0.96);
	--mc-dark-text: #f8fafc;
	--mc-light-text: #0f172a;
	--mc-radius: 14px;
	--mc-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Root Fixed Container */
.modcuabi-notifications-root {
	position: fixed;
	z-index: 999999;
	pointer-events: none; /* Let clicks pass through when empty */
	display: flex;
	flex-direction: column;
	max-width: 100%;
	box-sizing: border-box;
}

/* Positions */
.modcuabi-pos-bottom-right {
	bottom: 24px;
	right: 24px;
	align-items: flex-end;
}

.modcuabi-pos-bottom-left {
	bottom: 24px;
	left: 24px;
	align-items: flex-start;
}

.modcuabi-pos-top-right {
	top: 24px;
	right: 24px;
	align-items: flex-end;
}

.modcuabi-pos-top-left {
	top: 24px;
	left: 24px;
	align-items: flex-start;
}

/* Notification Toast Card */
.modcuabi-toast-card {
	pointer-events: auto; /* Enable clicks on the card */
	position: relative;
	width: var(--mc-card-width, 380px);
	max-width: 100%;
	border-radius: var(--mc-card-radius, 14px);
	padding: 18px 20px;
	box-sizing: border-box;
	box-shadow: var(--mc-shadow);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	overflow: hidden;
	transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

/* Themes */
/* 1. Dark Theme (ModcuAbi Default) */
.modcuabi-theme-dark .modcuabi-toast-card {
	background: var(--mc-dark-bg);
	color: var(--mc-dark-text);
	border: 1px solid rgba(255, 255, 255, 0.12);
}
.modcuabi-theme-dark .modcuabi-toast-title {
	color: #ffffff;
}
.modcuabi-theme-dark .modcuabi-toast-message {
	color: #cbd5e1;
}
.modcuabi-theme-dark .modcuabi-toast-close {
	color: #94a3b8;
}
.modcuabi-theme-dark .modcuabi-toast-close:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.1);
}

/* 2. Light Theme */
.modcuabi-theme-light .modcuabi-toast-card {
	background: var(--mc-light-bg);
	color: var(--mc-light-text);
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.06);
}
.modcuabi-theme-light .modcuabi-toast-title {
	color: #0f172a;
}
.modcuabi-theme-light .modcuabi-toast-message {
	color: #475569;
}
.modcuabi-theme-light .modcuabi-toast-close {
	color: #64748b;
}
.modcuabi-theme-light .modcuabi-toast-close:hover {
	color: #0f172a;
	background: rgba(0, 0, 0, 0.05);
}

/* 3. Auto / System Theme */
@media (prefers-color-scheme: light) {
	.modcuabi-theme-auto .modcuabi-toast-card {
		background: var(--mc-light-bg);
		color: var(--mc-light-text);
		border: 1px solid rgba(0, 0, 0, 0.08);
	}
	.modcuabi-theme-auto .modcuabi-toast-title { color: #0f172a; }
	.modcuabi-theme-auto .modcuabi-toast-message { color: #475569; }
	.modcuabi-theme-auto .modcuabi-toast-close { color: #64748b; }
}
@media (prefers-color-scheme: dark) {
	.modcuabi-theme-auto .modcuabi-toast-card {
		background: var(--mc-dark-bg);
		color: var(--mc-dark-text);
		border: 1px solid rgba(255, 255, 255, 0.12);
	}
	.modcuabi-theme-auto .modcuabi-toast-title { color: #ffffff; }
	.modcuabi-theme-auto .modcuabi-toast-message { color: #cbd5e1; }
	.modcuabi-theme-auto .modcuabi-toast-close { color: #94a3b8; }
}

/* Type Accent Border */
.modcuabi-toast-card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 5px;
}

.modcuabi-type-info::before { background: var(--mc-info); }
.modcuabi-type-success::before { background: var(--mc-success); }
.modcuabi-type-warning::before { background: var(--mc-warning); }
.modcuabi-type-danger::before { background: var(--mc-danger); }
.modcuabi-type-update::before { background: var(--mc-update); }

/* Card Content Structure */
.modcuabi-toast-header {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

/* Icon */
.modcuabi-toast-icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.3s ease;
}

.modcuabi-toast-card:hover .modcuabi-toast-icon {
	transform: scale(1.08);
}

.modcuabi-toast-icon svg {
	width: 22px;
	height: 22px;
}

.modcuabi-type-info .modcuabi-toast-icon { background: rgba(14, 165, 233, 0.15); color: var(--mc-info); }
.modcuabi-type-success .modcuabi-toast-icon { background: rgba(16, 185, 129, 0.15); color: var(--mc-success); }
.modcuabi-type-warning .modcuabi-toast-icon { background: rgba(245, 158, 11, 0.15); color: var(--mc-warning); }
.modcuabi-type-danger .modcuabi-toast-icon { background: rgba(239, 68, 68, 0.15); color: var(--mc-danger); }
.modcuabi-type-update .modcuabi-toast-icon { background: rgba(139, 92, 246, 0.15); color: var(--mc-update); }

/* Text Body */
.modcuabi-toast-body {
	flex: 1;
	min-width: 0;
}

.modcuabi-toast-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 6px 0;
	letter-spacing: -0.2px;
}

.modcuabi-toast-message {
	font-size: 13px;
	line-height: 1.5;
	margin: 0;
	word-break: break-word;
}

.modcuabi-toast-message a {
	color: var(--mc-primary);
	text-decoration: underline;
}

/* Close Button */
.modcuabi-toast-close {
	background: transparent;
	border: none;
	padding: 6px;
	cursor: pointer;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	line-height: 1;
	margin: -4px -6px 0 0;
	flex-shrink: 0;
}

.modcuabi-toast-close svg {
	width: 18px;
	height: 18px;
}

.modcuabi-toast-close:hover svg {
	transform: rotate(90deg);
	transition: transform 0.25s ease;
}

/* Action Button */
.modcuabi-toast-action-wrap {
	margin-top: 14px;
	padding-left: 54px; /* Aligns with text body */
}

.modcuabi-toast-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 18px;
	background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
	color: #ffffff !important;
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
	transition: all 0.25s ease;
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
	line-height: 1.2;
}

.modcuabi-toast-button:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
	filter: brightness(1.1);
}

.modcuabi-toast-button:active {
	transform: translateY(0);
}

.modcuabi-toast-button svg {
	width: 14px;
	height: 14px;
}

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

/* 1. Slide Animations */
@keyframes mcSlideInRight {
	from {
		opacity: 0;
		transform: translateX(110%);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}
@keyframes mcSlideOutRight {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(110%);
	}
}

@keyframes mcSlideInLeft {
	from {
		opacity: 0;
		transform: translateX(-110%);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}
@keyframes mcSlideOutLeft {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(-110%);
	}
}

/* 2. Fade Animations */
@keyframes mcFadeIn {
	from { opacity: 0; transform: scale(0.95); }
	to { opacity: 1; transform: scale(1); }
}
@keyframes mcFadeOut {
	from { opacity: 1; transform: scale(1); }
	to { opacity: 0; transform: scale(0.95); }
}

/* 3. Bounce Animations */
@keyframes mcBounceIn {
	0% { opacity: 0; transform: scale(0.3) translateY(60px); }
	50% { opacity: 0.9; transform: scale(1.05) translateY(-5px); }
	70% { transform: scale(0.98) translateY(2px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes mcBounceOut {
	0% { transform: scale(1); opacity: 1; }
	20% { transform: scale(1.05); }
	100% { transform: scale(0.5); opacity: 0; }
}

/* Animation Classes Applied via JS */
.modcuabi-anim-slide.modcuabi-pos-bottom-right .modcuabi-toast-enter,
.modcuabi-anim-slide.modcuabi-pos-top-right .modcuabi-toast-enter {
	animation: mcSlideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modcuabi-anim-slide.modcuabi-pos-bottom-right .modcuabi-toast-leave,
.modcuabi-anim-slide.modcuabi-pos-top-right .modcuabi-toast-leave {
	animation: mcSlideOutRight 0.35s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

.modcuabi-anim-slide.modcuabi-pos-bottom-left .modcuabi-toast-enter,
.modcuabi-anim-slide.modcuabi-pos-top-left .modcuabi-toast-enter {
	animation: mcSlideInLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modcuabi-anim-slide.modcuabi-pos-bottom-left .modcuabi-toast-leave,
.modcuabi-anim-slide.modcuabi-pos-top-left .modcuabi-toast-leave {
	animation: mcSlideOutLeft 0.35s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

.modcuabi-anim-fade .modcuabi-toast-enter {
	animation: mcFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modcuabi-anim-fade .modcuabi-toast-leave {
	animation: mcFadeOut 0.3s ease forwards;
}

.modcuabi-anim-bounce .modcuabi-toast-enter {
	animation: mcBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.modcuabi-anim-bounce .modcuabi-toast-leave {
	animation: mcBounceOut 0.35s ease forwards;
}

/* ==========================================================================
   Responsive / Mobile Optimization
   ========================================================================== */
@media (max-width: 640px) {
	.modcuabi-notifications-root {
		left: 12px !important;
		right: 12px !important;
		bottom: 12px !important;
		top: auto !important;
		align-items: center !important;
	}

	.modcuabi-toast-card {
		width: 100% !important;
		border-radius: 12px !important;
		padding: 14px 16px !important;
	}

	.modcuabi-toast-action-wrap {
		padding-left: 0;
		margin-top: 12px;
	}

	.modcuabi-toast-button {
		width: 100%;
	}
}
