/**
 * Common Styles
 *
 * Shared styles for all Interactive Elements components.
 * Provides base styling and utility classes.
 *
 * @package InteractiveElements
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */

.ie-element-matcher *,
.ie-element-matcher *::before,
.ie-element-matcher *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.ie-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.ie-hidden {
	display: none !important;
}

.ie-visible {
	display: block !important;
}

.ie-text-center {
	text-align: center !important;
}

.ie-text-left {
	text-align: left !important;
}

.ie-text-right {
	text-align: right !important;
}

/* ==========================================================================
   Animation Utilities
   ========================================================================== */

.ie-fade-in {
	animation: ie-fade-in 0.3s ease-out;
}

.ie-fade-out {
	animation: ie-fade-out 0.3s ease-out;
}

.ie-slide-up {
	animation: ie-slide-up 0.3s ease-out;
}

.ie-bounce {
	animation: ie-bounce 0.6s ease-out;
}

.ie-pulse {
	animation: ie-pulse 1s ease-in-out infinite;
}

.ie-shake {
	animation: ie-shake 0.5s ease-in-out;
}

.ie-spin {
	animation: ie-spin 1s linear infinite;
}

/* Keyframes */
@keyframes ie-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes ie-fade-out {
	from { opacity: 1; }
	to { opacity: 0; }
}

@keyframes ie-slide-up {
	from {
		transform: translateY(20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@keyframes ie-bounce {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.1); }
}

@keyframes ie-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

@keyframes ie-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-5px); }
	75% { transform: translateX(5px); }
}

@keyframes ie-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

.ie-button {
	display: inline-block;
	padding: 10px 20px;
	background: #007bff;
	color: white;
	border: none;
	border-radius: 6px;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
	vertical-align: middle;
	user-select: none;
}

.ie-button:hover {
	background: #0056b3;
	transform: translateY(-1px);
	text-decoration: none;
	color: white;
}

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

.ie-button:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

.ie-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* Button Variants */
.ie-button.ie-button-secondary {
	background: #6c757d;
}

.ie-button.ie-button-secondary:hover {
	background: #545b62;
}

.ie-button.ie-button-success {
	background: #28a745;
}

.ie-button.ie-button-success:hover {
	background: #1e7e34;
}

.ie-button.ie-button-warning {
	background: #ffc107;
	color: #212529;
}

.ie-button.ie-button-warning:hover {
	background: #e0a800;
	color: #212529;
}

.ie-button.ie-button-danger {
	background: #dc3545;
}

.ie-button.ie-button-danger:hover {
	background: #c82333;
}

/* Button Sizes */
.ie-button.ie-button-sm {
	padding: 6px 12px;
	font-size: 12px;
}

.ie-button.ie-button-lg {
	padding: 12px 24px;
	font-size: 16px;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */

.ie-card {
	background: white;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	border: 1px solid #e9ecef;
}

.ie-card.ie-card-hover {
	transition: all 0.3s ease;
}

.ie-card.ie-card-hover:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.ie-card-header {
	margin: -20px -20px 20px -20px;
	padding: 15px 20px;
	background: #f8f9fa;
	border-bottom: 1px solid #e9ecef;
	border-radius: 12px 12px 0 0;
	font-weight: 600;
	color: #495057;
}

.ie-card-footer {
	margin: 20px -20px -20px -20px;
	padding: 15px 20px;
	background: #f8f9fa;
	border-top: 1px solid #e9ecef;
	border-radius: 0 0 12px 12px;
}

/* ==========================================================================
   Grid System
   ========================================================================== */

.ie-grid {
	display: grid;
	gap: 20px;
}

.ie-grid-2 {
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.ie-grid-3 {
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.ie-grid-4 {
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 768px) {
	.ie-grid-2,
	.ie-grid-3,
	.ie-grid-4 {
		grid-template-columns: 1fr;
	}
}

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

.ie-loading {
	position: relative;
	opacity: 0.7;
	pointer-events: none;
}

.ie-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid #f3f3f3;
	border-top: 3px solid #007bff;
	border-radius: 50%;
	animation: ie-spin 1s linear infinite;
	z-index: 1000;
}

.ie-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #007bff;
	border-radius: 50%;
	animation: ie-spin 1s linear infinite;
}

/* ==========================================================================
   Tooltips
   ========================================================================== */

.ie-tooltip {
	position: relative;
	cursor: help;
}

.ie-tooltip::before {
	content: attr(data-tooltip);
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	background: #333;
	color: white;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 12px;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	z-index: 1000;
	margin-bottom: 5px;
}

.ie-tooltip::after {
	content: '';
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #333;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.ie-tooltip:hover::before,
.ie-tooltip:hover::after {
	opacity: 1;
	visibility: visible;
}

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

.ie-notification {
	padding: 12px 16px;
	border-radius: 6px;
	margin: 10px 0;
	border-left: 4px solid;
	background: white;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ie-notification.ie-notification-success {
	border-left-color: #28a745;
	background: #d4edda;
	color: #155724;
}

.ie-notification.ie-notification-warning {
	border-left-color: #ffc107;
	background: #fff3cd;
	color: #856404;
}

.ie-notification.ie-notification-error {
	border-left-color: #dc3545;
	background: #f8d7da;
	color: #721c24;
}

.ie-notification.ie-notification-info {
	border-left-color: #17a2b8;
	background: #d1ecf1;
	color: #0c5460;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.ie-heading {
	margin: 0 0 15px 0;
	font-weight: 600;
	line-height: 1.2;
	color: #333;
}

.ie-heading-xl {
	font-size: 2rem;
}

.ie-heading-lg {
	font-size: 1.5rem;
}

.ie-heading-md {
	font-size: 1.25rem;
}

.ie-heading-sm {
	font-size: 1rem;
}

.ie-text-muted {
	color: #6c757d;
}

.ie-text-primary {
	color: #007bff;
}

.ie-text-success {
	color: #28a745;
}

.ie-text-warning {
	color: #ffc107;
}

.ie-text-danger {
	color: #dc3545;
}

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

@media (max-width: 576px) {
	.ie-hide-xs {
		display: none !important;
	}
}

@media (max-width: 768px) {
	.ie-hide-sm {
		display: none !important;
	}
}

@media (max-width: 992px) {
	.ie-hide-md {
		display: none !important;
	}
}

@media (max-width: 1200px) {
	.ie-hide-lg {
		display: none !important;
	}
}

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

/* Focus styles */
.ie-element-matcher [tabindex]:focus,
.ie-element-matcher button:focus,
.ie-element-matcher input:focus,
.ie-element-matcher select:focus,
.ie-element-matcher textarea:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.ie-element-matcher *,
	.ie-element-matcher *::before,
	.ie-element-matcher *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* High contrast mode */
@media (prefers-contrast: high) {
	.ie-element-matcher {
		border: 2px solid;
	}
	
	.ie-card,
	.ie-button {
		border: 2px solid;
	}
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.ie-element-matcher {
		color-scheme: dark;
	}
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.ie-element-matcher {
		background: white !important;
		color: black !important;
		box-shadow: none !important;
	}
	
	.ie-button,
	.ie-game-controls {
		display: none !important;
	}
}