/**
 * Toast Notifications System
 * Modern notification system untuk StockManager
 * 
 * @author StockManager Development Team
 * @version 1.0.0
 */

/* Toast Container - menampung semua toast notifications */
#toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 400px;
	pointer-events: none; /* Allow clicks through container */
}

/* Individual Toast Notification */
.toast {
	background: white;
	padding: 1rem 1.2rem;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 300px;
	max-width: 400px;
	transform: translateX(450px);
	opacity: 0;
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	pointer-events: auto; /* Allow clicks on toast */
	position: relative;
	overflow: hidden;
}

/* Toast showing animation */
.toast.show {
	transform: translateX(0);
	opacity: 1;
}

/* Toast hiding animation */
.toast.hide {
	transform: translateX(450px);
	opacity: 0;
}

/* Toast Icon */
.toast .toast-icon {
	font-size: 1.8rem;
	flex-shrink: 0;
	line-height: 1;
}

/* Toast Content */
.toast .toast-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.toast .toast-title {
	font-weight: 600;
	font-size: 0.95rem;
	color: #333;
	margin: 0;
}

.toast .toast-message {
	font-size: 0.875rem;
	color: #666;
	line-height: 1.4;
	margin: 0;
}

/* Toast Close Button */
.toast .toast-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	color: #999;
	cursor: pointer;
	padding: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s;
	flex-shrink: 0;
}

.toast .toast-close:hover {
	background: rgba(0, 0, 0, 0.05);
	color: #333;
}

/* Progress Bar */
.toast .toast-progress {
	position: absolute;
	bottom: 0;
	left: 0;
	height: 3px;
	background: rgba(0, 0, 0, 0.2);
	width: 100%;
	transform-origin: left;
	animation: toast-progress linear forwards;
}

@keyframes toast-progress {
	from {
		transform: scaleX(1);
	}
	to {
		transform: scaleX(0);
	}
}

/* Toast Types - Color Schemes */

/* Success Toast */
.toast.toast-success {
	border-left: 4px solid #4caf50;
}

.toast.toast-success .toast-icon {
	color: #4caf50;
}

.toast.toast-success .toast-progress {
	background: #4caf50;
}

/* Error Toast */
.toast.toast-error {
	border-left: 4px solid #f44336;
}

.toast.toast-error .toast-icon {
	color: #f44336;
}

.toast.toast-error .toast-progress {
	background: #f44336;
}

/* Warning Toast */
.toast.toast-warning {
	border-left: 4px solid #ff9800;
}

.toast.toast-warning .toast-icon {
	color: #ff9800;
}

.toast.toast-warning .toast-progress {
	background: #ff9800;
}

/* Info Toast */
.toast.toast-info {
	border-left: 4px solid #2196f3;
}

.toast.toast-info .toast-icon {
	color: #2196f3;
}

.toast.toast-info .toast-progress {
	background: #2196f3;
}

/* Responsive Design */
@media (max-width: 768px) {
	#toast-container {
		top: 10px;
		right: 10px;
		left: 10px;
		max-width: none;
	}

	.toast {
		min-width: auto;
		max-width: none;
		width: 100%;
	}

	.toast.show {
		transform: translateY(0);
	}

	.toast,
	.toast.hide {
		transform: translateY(-120%);
	}
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.toast {
		transition: opacity 0.3s ease;
		transform: translateX(0);
	}

	.toast.show {
		opacity: 1;
	}

	.toast.hide {
		opacity: 0;
	}
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
	.toast {
		background: #2d2d2d;
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	}

	.toast .toast-title {
		color: #f0f0f0;
	}

	.toast .toast-message {
		color: #b0b0b0;
	}

	.toast .toast-close {
		color: #888;
	}

	.toast .toast-close:hover {
		background: rgba(255, 255, 255, 0.1);
		color: #f0f0f0;
	}
}
