/**
 * Xtra Toast Notifications
 * Mobile-first, accessible, uses theme design tokens
 *
 * @package Xtra
 */

/* ==========================================================================
   Container
   ========================================================================== */

.xtra-toast-container {
	position: fixed;
	top: var(--wp--custom--headerHeight, 60px);
	left: 0;
	right: 0;
	z-index: 999999;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--20);
}

/* ==========================================================================
   Toast Base (Mobile-First)
   ========================================================================== */

.xtra-toast {
	/* Layout */
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	pointer-events: auto;

	/* Colors - using theme dark surface tokens */
	background: var(--wp--preset--color--surface-dark);
	color: var(--wp--preset--color--text-on-dark);
	border: 1px solid var(--wp--preset--color--border-on-dark);

	/* Accent stripe on left edge */
	border-left: 4px solid var(--wp--preset--color--info);

	/* Spacing */
	padding: var(--wp--preset--spacing--30);

	/* Typography */
	font-family: var(--wp--preset--font-family--system-sans);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;

	/* Shape */
	border-radius: var(--wp--custom--radius--md);

	/* Animation - start state */
	opacity: 0;
	transform: translateY(-0.5rem);
	transition:
		opacity var(--wp--custom--transition--normal),
		transform var(--wp--custom--transition--normal);

	/* Interaction */
	cursor: pointer;
}

/* Visible state */
.xtra-toast--visible {
	opacity: 1;
	transform: translateY(0);
}

/* Persistent toasts don't dismiss on click */
.xtra-toast--persistent {
	cursor: default;
}

/* ==========================================================================
   Toast Content
   ========================================================================== */

.xtra-toast__content {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--20);
}

.xtra-toast__message {
	flex: 1;
	margin: 0;
	font-weight: 500;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* ==========================================================================
   Type Variations
   ========================================================================== */

.xtra-toast--success {
	border-left-color: var(--wp--preset--color--success);
}

.xtra-toast--error {
	border-left-color: var(--wp--preset--color--error);
}

.xtra-toast--info {
	border-left-color: var(--wp--preset--color--info);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.xtra-toast__buttons {
	display: flex;
	gap: var(--wp--preset--spacing--20);
	width: 100%;
}

.xtra-toast__button {
	/* Reset */
	appearance: none;
	border: none;
	margin: 0;

	/* Layout */
	flex: 1;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);

	/* Colors */
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);

	/* Typography */
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-align: center;
	text-decoration: none;

	/* Shape */
	border-radius: var(--wp--custom--radius--sm);
	cursor: pointer;

	/* Animation */
	transition:
		background-color var(--wp--custom--transition--fast),
		opacity var(--wp--custom--transition--fast);
}

.xtra-toast__button:hover {
	background: var(--wp--preset--color--primary-dark);
}

.xtra-toast__button:active {
	opacity: 0.8;
}

.xtra-toast__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary-light);
	outline-offset: 2px;
}

/* Secondary button variant */
.xtra-toast__button--secondary {
	background: var(--wp--preset--color--surface-dark-2);
	color: var(--wp--preset--color--text-on-dark);
	border: 1px solid var(--wp--preset--color--border-on-dark);
}

.xtra-toast__button--secondary:hover {
	background: var(--wp--preset--color--contrast-2);
}

/* Single button - full width handled by flex: 1 */
.xtra-toast__buttons--single .xtra-toast__button {
	width: 100%;
}

/* ==========================================================================
   Responsive - Tablet and Up
   ========================================================================== */

@media (min-width: 600px) {
	.xtra-toast-container {
		padding: var(--wp--preset--spacing--30);
	}

	.xtra-toast {
		max-width: 400px;
	}
}

/* ==========================================================================
   Accessibility - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.xtra-toast {
		transition: opacity var(--wp--custom--transition--fast);
		transform: none;
	}

	.xtra-toast--visible {
		transform: none;
	}

	.xtra-toast__button {
		transition: none;
	}
}
