/**
 * GTAW Bridge Component Library
 * Reusable UI components with consistent styling
 *
 * @package GTAW_Bridge
 */

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

.gtaw-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--gtaw-spacing-sm);
	padding: 12px 24px;
	border: none;
	border-radius: var(--gtaw-radius-md);
	font-family: var(--gtaw-font-family-base);
	font-size: var(--gtaw-font-size-base);
	font-weight: var(--gtaw-font-weight-medium);
	line-height: var(--gtaw-line-height-normal);
	text-decoration: none;
	cursor: pointer;
	transition: all var(--gtaw-transition-base);
	min-height: var(--gtaw-touch-target-min);
	box-sizing: border-box;
}

.gtaw-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	pointer-events: none;
}

.gtaw-button:focus-visible {
	outline: var(--gtaw-focus-width) solid var(--gtaw-focus-color);
	outline-offset: var(--gtaw-focus-offset);
	box-shadow: 0 0 0 4px rgba(47, 103, 246, 0.2);
}

/* Button Variants */
.gtaw-button--primary {
	background-color: var(--gtaw-color-primary);
	color: var(--gtaw-color-text-inverse);
	box-shadow: var(--gtaw-shadow-sm);
}

.gtaw-button--primary:hover:not(:disabled) {
	background-color: var(--gtaw-color-primary-hover);
	box-shadow: var(--gtaw-shadow-md);
	transform: translateY(-1px);
	color: var(--gtaw-color-text-inverse);
	text-decoration: none;
}

.gtaw-button--primary:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: var(--gtaw-shadow-sm);
}

.gtaw-button--secondary {
	background-color: var(--gtaw-color-surface-alt);
	color: var(--gtaw-color-text);
	border: 1px solid var(--gtaw-color-border);
}

.gtaw-button--secondary:hover:not(:disabled) {
	background-color: var(--gtaw-color-surface);
	border-color: var(--gtaw-color-primary);
	color: var(--gtaw-color-primary);
	text-decoration: none;
}

.gtaw-button--ghost {
	background-color: transparent;
	color: var(--gtaw-color-primary);
	border: 1px solid var(--gtaw-color-primary);
}

.gtaw-button--ghost:hover:not(:disabled) {
	background-color: var(--gtaw-color-surface-alt);
	color: var(--gtaw-color-primary);
	text-decoration: none;
}

.gtaw-button--danger {
	background-color: var(--gtaw-color-danger);
	color: var(--gtaw-color-text-inverse);
}

.gtaw-button--danger:hover:not(:disabled) {
	background-color: var(--gtaw-color-danger-dark);
	color: var(--gtaw-color-text-inverse);
	text-decoration: none;
}

/* Button Sizes */
.gtaw-button--sm {
	padding: 8px 16px;
	font-size: var(--gtaw-font-size-sm);
	min-height: 36px;
}

.gtaw-button--lg {
	padding: 16px 32px;
	font-size: var(--gtaw-font-size-lg);
	min-height: 52px;
}

/* Full Width Button */
.gtaw-button--full {
	width: 100%;
}

/* Button with Icon */
.gtaw-button__icon {
	display: inline-flex;
	align-items: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.gtaw-button__icon svg {
	width: 100%;
	height: 100%;
}

/* Loading State */
.gtaw-button--loading {
	pointer-events: none;
	opacity: 0.7;
	cursor: wait;
}

.gtaw-button--loading .gtaw-button__text {
	opacity: 0;
}

/* ============================================
   Form Inputs
   ============================================ */

.gtaw-form-group {
	margin-bottom: var(--gtaw-spacing-xl);
}

.gtaw-form-label {
	display: block;
	font-size: var(--gtaw-font-size-sm);
	font-weight: var(--gtaw-font-weight-medium);
	color: var(--gtaw-color-text);
	margin-bottom: var(--gtaw-spacing-sm);
	line-height: var(--gtaw-line-height-normal);
}

.gtaw-form-label--required::after {
	content: " *";
	color: var(--gtaw-color-danger);
}

.gtaw-form-input,
.gtaw-form-select,
.gtaw-form-textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--gtaw-color-border);
	border-radius: var(--gtaw-radius-md);
	font-family: var(--gtaw-font-family-base);
	font-size: var(--gtaw-font-size-base);
	line-height: var(--gtaw-line-height-normal);
	color: var(--gtaw-color-text);
	background-color: var(--gtaw-color-surface);
	box-sizing: border-box;
	transition: border-color var(--gtaw-transition-base), box-shadow var(--gtaw-transition-base);
}

.gtaw-form-input:focus,
.gtaw-form-select:focus,
.gtaw-form-textarea:focus {
	outline: none;
	border-color: var(--gtaw-color-primary);
	box-shadow: 0 0 0 3px rgba(47, 103, 246, 0.1);
}

.gtaw-form-input:disabled,
.gtaw-form-select:disabled,
.gtaw-form-textarea:disabled {
	background-color: var(--gtaw-color-surface-alt);
	color: var(--gtaw-color-text-muted);
	cursor: not-allowed;
	opacity: 0.6;
}

.gtaw-form-input::placeholder,
.gtaw-form-textarea::placeholder {
	color: var(--gtaw-color-text-light);
}

.gtaw-form-description {
	font-size: var(--gtaw-font-size-sm);
	color: var(--gtaw-color-text-secondary);
	margin-top: var(--gtaw-spacing-sm);
	line-height: var(--gtaw-line-height-relaxed);
}

.gtaw-form-description a {
	color: var(--gtaw-color-primary);
	text-decoration: none;
}

.gtaw-form-description a:hover {
	text-decoration: underline;
}

/* Error State */
.gtaw-form-group--error .gtaw-form-input,
.gtaw-form-group--error .gtaw-form-select,
.gtaw-form-group--error .gtaw-form-textarea {
	border-color: var(--gtaw-color-danger);
}

.gtaw-form-error {
	display: block;
	font-size: var(--gtaw-font-size-sm);
	color: var(--gtaw-color-danger);
	margin-top: var(--gtaw-spacing-sm);
}

/* Success State */
.gtaw-form-group--success .gtaw-form-input,
.gtaw-form-group--success .gtaw-form-select,
.gtaw-form-group--success .gtaw-form-textarea {
	border-color: var(--gtaw-color-success);
}

/* ============================================
   Cards
   ============================================ */

.gtaw-card {
	background: var(--gtaw-color-surface);
	border-radius: var(--gtaw-radius-lg);
	padding: var(--gtaw-spacing-2xl);
	box-shadow: var(--gtaw-shadow-sm);
	border: 1px solid var(--gtaw-color-border);
	transition: box-shadow var(--gtaw-transition-base);
}

.gtaw-card:hover {
	box-shadow: var(--gtaw-shadow-md);
}

.gtaw-card--elevated {
	box-shadow: var(--gtaw-shadow-lg);
}

.gtaw-card--elevated:hover {
	box-shadow: var(--gtaw-shadow-xl);
}

.gtaw-card__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: var(--gtaw-spacing-xl);
	padding-bottom: var(--gtaw-spacing-lg);
	border-bottom: 1px solid var(--gtaw-color-border);
}

.gtaw-card__title {
	font-family: var(--gtaw-font-family-heading);
	font-size: var(--gtaw-font-size-xl);
	font-weight: var(--gtaw-font-weight-semibold);
	color: var(--gtaw-color-text);
	margin: 0;
	line-height: var(--gtaw-line-height-tight);
}

.gtaw-card__subtitle {
	font-size: var(--gtaw-font-size-base);
	color: var(--gtaw-color-text-secondary);
	margin: var(--gtaw-spacing-sm) 0 0 0;
	line-height: var(--gtaw-line-height-normal);
}

.gtaw-card__body {
	margin: 0;
	padding: 0;
}

.gtaw-card__footer {
	margin-top: var(--gtaw-spacing-xl);
	padding-top: var(--gtaw-spacing-lg);
	border-top: 1px solid var(--gtaw-color-border);
}

/* ============================================
   Loading States
   ============================================ */

.gtaw-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: currentColor;
	border-radius: var(--gtaw-radius-full);
	animation: gtaw-spin 0.6s linear infinite;
	vertical-align: middle;
	flex-shrink: 0;
}

.gtaw-spinner--sm {
	width: 12px;
	height: 12px;
	border-width: 2px;
}

.gtaw-spinner--lg {
	width: 24px;
	height: 24px;
	border-width: 3px;
}

.gtaw-spinner--dark {
	border-color: rgba(0, 0, 0, 0.2);
	border-top-color: currentColor;
}

@keyframes gtaw-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Skeleton Loading */
.gtaw-skeleton {
	background: linear-gradient(
		90deg,
		var(--gtaw-color-surface-alt) 0%,
		var(--gtaw-color-border-light) 50%,
		var(--gtaw-color-surface-alt) 100%
	);
	background-size: 200% 100%;
	animation: gtaw-skeleton-loading 1.5s ease-in-out infinite;
	border-radius: var(--gtaw-radius-md);
}

@keyframes gtaw-skeleton-loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* ============================================
   Toast Notifications
   ============================================ */

.gtaw-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	display: flex;
	align-items: center;
	gap: var(--gtaw-spacing-md);
	padding: var(--gtaw-spacing-lg) var(--gtaw-spacing-xl);
	background: var(--gtaw-color-surface);
	border-radius: var(--gtaw-radius-lg);
	box-shadow: var(--gtaw-shadow-lg);
	max-width: 400px;
	z-index: var(--gtaw-z-toast);
	opacity: 0;
	transform: translateY(20px);
	transition: all var(--gtaw-transition-slow);
}

.gtaw-toast--visible {
	opacity: 1;
	transform: translateY(0);
}

.gtaw-toast--success {
	border-left: 4px solid var(--gtaw-color-success);
}

.gtaw-toast--error {
	border-left: 4px solid var(--gtaw-color-danger);
}

.gtaw-toast--warning {
	border-left: 4px solid var(--gtaw-color-warning);
}

.gtaw-toast__content {
	flex: 1;
	font-size: var(--gtaw-font-size-sm);
	color: var(--gtaw-color-text);
	line-height: var(--gtaw-line-height-normal);
}

.gtaw-toast__dismiss {
	background: none;
	border: none;
	color: var(--gtaw-color-text-muted);
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--gtaw-radius-sm);
	transition: background-color var(--gtaw-transition-base);
}

.gtaw-toast__dismiss:hover {
	background-color: var(--gtaw-color-surface-alt);
	color: var(--gtaw-color-text);
}

.gtaw-toast__dismiss:focus-visible {
	outline: var(--gtaw-focus-width) solid var(--gtaw-focus-color);
	outline-offset: var(--gtaw-focus-offset);
}

/* ============================================
   Badges/Pills
   ============================================ */

.gtaw-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: var(--gtaw-radius-full);
	font-size: var(--gtaw-font-size-xs);
	font-weight: var(--gtaw-font-weight-medium);
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.gtaw-badge--success {
	background-color: var(--gtaw-color-success-light);
	color: var(--gtaw-color-success-dark);
}

.gtaw-badge--warning {
	background-color: var(--gtaw-color-warning-light);
	color: var(--gtaw-color-warning-dark);
}

.gtaw-badge--danger {
	background-color: var(--gtaw-color-danger-light);
	color: var(--gtaw-color-danger-dark);
}

.gtaw-badge--neutral {
	background-color: var(--gtaw-color-surface-alt);
	color: var(--gtaw-color-text);
}

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

@media (max-width: 768px) {
	.gtaw-card {
		padding: var(--gtaw-spacing-xl);
	}

	.gtaw-button {
		min-height: var(--gtaw-touch-target-min);
		min-width: var(--gtaw-touch-target-min);
	}

	.gtaw-toast {
		right: var(--gtaw-spacing-lg);
		left: var(--gtaw-spacing-lg);
		max-width: none;
	}
}

/* Safe Area Insets for Mobile */
@supports (padding: max(0px)) {
	.gtaw-safe-area {
		padding-left: max(var(--gtaw-spacing-lg), env(safe-area-inset-left));
		padding-right: max(var(--gtaw-spacing-lg), env(safe-area-inset-right));
		padding-top: max(var(--gtaw-spacing-lg), env(safe-area-inset-top));
		padding-bottom: max(var(--gtaw-spacing-lg), env(safe-area-inset-bottom));
	}
}

/* ============================================
   Shared Utility Classes
   ============================================
   Common utility classes used across admin and public pages.
   Uses design tokens for full compatibility with design system.
   These utilities replace inline styles throughout the plugin.
   */

/* Status Indicators */
.gtaw-status-success {
	color: var(--gtaw-color-success, #1f9d55);
}

.gtaw-status-error {
	color: var(--gtaw-color-danger, #dc2626);
}

.gtaw-status-text-secondary {
	color: var(--gtaw-color-text-secondary, #646970);
}

/* Paragraph Spacing */
.gtaw-paragraph-spacing {
	margin-top: var(--gtaw-spacing-lg, 20px);
}

.gtaw-paragraph-spacing-sm {
	margin-top: 1.5rem;
}

.gtaw-paragraph-spacing-lg {
	margin-top: 2rem;
}

/* Message Components */
.gtaw-message-warning {
	background: var(--gtaw-color-warning-light, #fef3c7);
	border-left: 4px solid var(--gtaw-color-warning, #f59e0b);
	padding: var(--gtaw-spacing-md, 12px);
	margin-bottom: var(--gtaw-spacing-lg, 20px);
}

.gtaw-message-error {
	background: var(--gtaw-color-danger-light, #fee2e2);
	border-left: 4px solid var(--gtaw-color-danger, #dc2626);
	padding: var(--gtaw-spacing-md, 12px);
	margin-bottom: var(--gtaw-spacing-lg, 20px);
}

/* ============================================
   Message Components (for character switcher)
   Standardized BEM naming: .gtaw-message (design system standard)
   Backward compatibility: .bridge-message aliases maintained
   ============================================ */

.gtaw-message,
.bridge-message {
	display: none;
	opacity: 0;
	transition: opacity var(--gtaw-transition-base, 0.3s ease);
	padding: var(--gtaw-spacing-md, 12px);
	margin: var(--gtaw-spacing-md, 12px) 0;
	border-radius: var(--gtaw-radius-md, 4px);
}

.gtaw-message--visible,
.bridge-message--visible {
	display: block;
	opacity: 1;
}

.gtaw-message--success,
.bridge-message--success {
	background: var(--gtaw-color-success-light, #d1fae5);
	border-left: 4px solid var(--gtaw-color-success, #1f9d55);
	color: var(--gtaw-color-success-dark, #065f46);
}

.gtaw-message--error,
.bridge-message--error {
	background: var(--gtaw-color-danger-light, #fee2e2);
	border-left: 4px solid var(--gtaw-color-danger, #dc2626);
	color: var(--gtaw-color-danger-dark, #991b1b);
}

/* ============================================
   Utility Classes (for replacing inline styles)
   ============================================ */

/* Margin Utilities */
.gtaw-m-0 {
	margin: 0;
}

.gtaw-mt-lg {
	margin-top: var(--gtaw-spacing-lg);
}

.gtaw-mt-xl {
	margin-top: var(--gtaw-spacing-xl);
}

.gtaw-mt-sm {
	margin-top: var(--gtaw-spacing-sm);
}

.gtaw-mt-xs {
	margin-top: var(--gtaw-spacing-xs);
}

.gtaw-mt-2 {
	margin-top: 2px;
}

.gtaw-mb-lg {
	margin-bottom: var(--gtaw-spacing-lg);
}

.gtaw-mb-xl {
	margin-bottom: var(--gtaw-spacing-xl);
}

.gtaw-mb-md {
	margin-bottom: var(--gtaw-spacing-md);
}

.gtaw-mb-sm {
	margin-bottom: var(--gtaw-spacing-sm);
}

.gtaw-mb-xs {
	margin-bottom: var(--gtaw-spacing-xs);
}

.gtaw-ml-xs {
	margin-left: var(--gtaw-spacing-xs);
}

.gtaw-ml-sm {
	margin-left: var(--gtaw-spacing-sm);
}

.gtaw-ml-10 {
	margin-left: 10px;
}

/* Margin combinations - e.g., margin: 0 0 var(--gtaw-spacing-xs) 0; */
.gtaw-m-0-tb-xs {
	margin-top: 0;
	margin-bottom: var(--gtaw-spacing-xs);
}

.gtaw-m-0-tb-sm {
	margin-top: 0;
	margin-bottom: var(--gtaw-spacing-sm);
}

.gtaw-m-0-tb-md {
	margin-top: 0;
	margin-bottom: var(--gtaw-spacing-md);
}

/* Text Color Utilities */
.gtaw-text-red {
	color: var(--gtaw-color-danger, #dc2626);
}

.gtaw-text-green {
	color: var(--gtaw-color-success, #10b981);
}

.gtaw-text-success {
	color: var(--gtaw-color-success, #10b981);
}

.gtaw-text-error {
	color: var(--gtaw-color-danger, #dc2626);
}

.gtaw-text-secondary {
	color: var(--gtaw-color-text-secondary);
}

.gtaw-text-muted {
	color: var(--gtaw-color-text-muted);
}

/* Opacity Utilities */
.gtaw-opacity-80 {
	opacity: 0.8;
}

/* Font Size Utilities */
.gtaw-text-xs {
	font-size: var(--gtaw-font-size-xs);
}

.gtaw-text-sm {
	font-size: var(--gtaw-font-size-sm);
}

.gtaw-text-base {
	font-size: var(--gtaw-font-size-base);
}

.gtaw-text-50 {
	font-size: 0.5em;
	font-weight: normal;
}

/* Display Utilities */
.gtaw-display-inline-block {
	display: inline-block;
}

.gtaw-display-flex {
	display: flex;
}

/* Flex Utilities */
.gtaw-flex-start {
	display: flex;
	align-items: flex-start;
	gap: var(--gtaw-spacing-md);
}

.gtaw-flex-wrap {
	flex-wrap: wrap;
}

/* Layout Utilities */
.gtaw-flex-1 {
	flex: 1;
}

.gtaw-flex-shrink-0 {
	flex-shrink: 0;
}

.gtaw-items-start {
	align-items: flex-start;
}

.gtaw-gap-md {
	gap: var(--gtaw-spacing-md);
}

/* Spacing Utilities */
.gtaw-p-lg {
	padding: var(--gtaw-spacing-lg);
}

.gtaw-p-md {
	padding: var(--gtaw-spacing-md);
}

.gtaw-p-0 {
	padding: 0;
}

/* Padding combinations */
.gtaw-p-0-b-sm {
	padding: 0;
	padding-bottom: var(--gtaw-spacing-sm);
}

.gtaw-p-0-b-md {
	padding: 0;
	padding-bottom: var(--gtaw-spacing-md);
}

/* Font Weight Utilities */
.gtaw-font-normal {
	font-weight: normal;
}

.gtaw-font-semibold {
	font-weight: var(--gtaw-font-weight-semibold);
}

/* Border Utilities */
.gtaw-border-t-2 {
	border-top: 2px solid var(--gtaw-color-border);
}

/* Background Utilities */
.gtaw-bg-surface-alt {
	background: var(--gtaw-color-surface-alt);
}

/* Border Radius Utilities */
.gtaw-rounded-md {
	border-radius: var(--gtaw-radius-md);
}

/* Recommendation Card Component */
.bridge-recommendation {
	margin-bottom: var(--gtaw-spacing-lg);
	padding: var(--gtaw-spacing-lg);
	background: var(--gtaw-color-surface-alt);
	border-radius: var(--gtaw-radius-md);
}

.bridge-recommendation--danger {
	border-left: 4px solid var(--gtaw-color-danger);
}

.bridge-recommendation--warning {
	border-left: 4px solid var(--gtaw-color-warning);
}

.bridge-recommendation--info {
	border-left: 4px solid var(--gtaw-color-primary);
}

.bridge-recommendation__header {
	display: flex;
	align-items: flex-start;
	gap: var(--gtaw-spacing-md);
}

.bridge-recommendation__icon {
	flex-shrink: 0;
	margin-top: 2px;
}

.bridge-recommendation__icon--danger {
	color: var(--gtaw-color-danger);
}

.bridge-recommendation__icon--warning {
	color: var(--gtaw-color-warning);
}

.bridge-recommendation__icon--info {
	color: var(--gtaw-color-primary);
}

.bridge-recommendation__content {
	flex: 1;
}

.bridge-recommendation__title {
	margin: 0 0 var(--gtaw-spacing-xs) 0;
	font-size: var(--gtaw-font-size-base);
	font-weight: var(--gtaw-font-weight-semibold);
}

.bridge-recommendation__title--sm {
	margin: 0 0 var(--gtaw-spacing-sm) 0;
	font-size: var(--gtaw-font-size-base);
	font-weight: var(--gtaw-font-weight-semibold);
}

.bridge-recommendation__text {
	margin: 0;
	color: var(--gtaw-color-text-secondary);
}

.bridge-recommendation__text--spaced {
	margin: 0 0 var(--gtaw-spacing-md) 0;
	color: var(--gtaw-color-text-secondary);
}

.bridge-recommendation__hint {
	margin: 0;
	font-size: var(--gtaw-font-size-sm);
	color: var(--gtaw-color-text-muted);
}

/* Button Group Component */
.bridge-button-group {
	display: flex;
	gap: var(--gtaw-spacing-md);
	flex-wrap: wrap;
}

