/**
 * Button Components
 * Modern Ocean Gradient button system with glassmorphism and glow effects
 *
 * @package Techtronic_Learning
 * @since 1.0.0 (Redesigned 2025)
 */

/* ==========================================================================
   Base Button Styles
   ========================================================================== */

button,
.button,
[type="button"],
[type="submit"],
[type="reset"] {
	font-family: var(--font-display);
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--spacing-2);
	border: none;
	outline: none;
	user-select: none;
	vertical-align: middle;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	transition: all var(--duration-base) var(--ease-out);
}

button:disabled,
.button:disabled,
[type="button"]:disabled,
[type="submit"]:disabled,
[type="reset"]:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

/* ==========================================================================
   Primary Button (Ocean Gradient CTA)
   ========================================================================== */

.btn-primary {
	/* Size */
	height: 48px;
	padding: 0 var(--spacing-8);

	/* Typography */
	font-family: var(--font-display);
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	letter-spacing: 0.01em;
	line-height: 1;

	/* Perfect centering */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	vertical-align: middle;

	/* Colors - Ocean Gradient */
	background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
	color: #ffffff;
	border: none;
	border-radius: var(--radius-md);

	/* Elevation */
	box-shadow: var(--shadow-md);

	/* Transition */
	transition: all var(--duration-slow) var(--ease-out);
	position: relative;
	overflow: hidden;
}

/* Glow effect on hover */
.btn-primary::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-400) 100%);
	opacity: 0;
	transition: opacity var(--duration-slow) var(--ease-out);
	border-radius: var(--radius-md);
	z-index: -1;
}

.btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-xl), var(--glow-primary);
}

.btn-primary:hover::before {
	opacity: 1;
}

.btn-primary:active {
	transform: translateY(0);
	box-shadow: var(--shadow-base);
}

.btn-primary:disabled {
	background: var(--gray-600);
	color: var(--gray-300);
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.btn-primary:disabled::before {
	display: none;
}

/* Size Variants */
.btn-primary--small {
	height: 36px;
	padding: 0 var(--spacing-5);
	font-size: var(--text-sm);
}

.btn-primary--large {
	height: 56px;
	padding: 0 var(--spacing-10);
	font-size: var(--text-lg);
	font-weight: var(--weight-bold);
}

/* ==========================================================================
   Secondary Button (Coral Accent)
   ========================================================================== */

.btn-secondary {
	height: 48px;
	padding: 0 var(--spacing-8);

	font-family: var(--font-display);
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	line-height: 1;

	/* Perfect centering */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	vertical-align: middle;

	background: transparent;
	color: var(--accent-700);
	border: 2px solid var(--accent-700);
	border-radius: var(--radius-md);

	transition: all var(--duration-slow) var(--ease-out);
	position: relative;
	overflow: hidden;
}

.btn-secondary::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--accent-700);
	opacity: 0;
	transition: opacity var(--duration-slow) var(--ease-out);
	z-index: -1;
}

.btn-secondary:hover {
	color: #ffffff;
	border-color: var(--accent-600);
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg), var(--glow-accent);
}

.btn-secondary:hover::before {
	opacity: 1;
}

.btn-secondary:active {
	transform: translateY(0);
	box-shadow: var(--shadow-base);
}

.btn-secondary:disabled {
	border-color: var(--gray-600);
	color: var(--gray-600);
	cursor: not-allowed;
	transform: none;
}

/* Size Variants */
.btn-secondary--small {
	height: 36px;
	padding: 0 var(--spacing-5);
	font-size: var(--text-sm);
}

.btn-secondary--large {
	height: 56px;
	padding: 0 var(--spacing-10);
	font-size: var(--text-lg);
}

/* ==========================================================================
   Ghost Button (Glassmorphism)
   ========================================================================== */

.btn-ghost {
	height: 48px;
	padding: 0 var(--spacing-8);

	font-family: var(--font-display);
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	line-height: 1;

	/* Perfect centering */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	vertical-align: middle;

	background: var(--glass-light);
	color: var(--gray-50);
	border: 2px solid var(--glass-border);
	border-radius: var(--radius-md);
	backdrop-filter: blur(var(--blur-md));

	transition: all var(--duration-slow) var(--ease-out);
}

.btn-ghost:hover {
	background: rgba(255, 255, 255, 0.15);
	border-color: var(--primary-400);
	color: var(--primary-300);
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
	backdrop-filter: blur(var(--blur-lg));
}

.btn-ghost:active {
	transform: translateY(0);
	box-shadow: var(--shadow-base);
}

.btn-ghost:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
}

/* Size Variants */
.btn-ghost--small {
	height: 36px;
	padding: 0 var(--spacing-5);
	font-size: var(--text-sm);
}

.btn-ghost--large {
	height: 56px;
	padding: 0 var(--spacing-10);
	font-size: var(--text-lg);
}

/* ==========================================================================
   Text Button (Link Style)
   ========================================================================== */

.btn-text {
	padding: var(--spacing-2) var(--spacing-4);

	font-family: var(--font-display);
	font-size: var(--text-base);
	font-weight: var(--weight-medium);
	line-height: var(--leading-normal);

	background: transparent;
	color: var(--primary-400);
	border: none;
	text-decoration: none;

	transition: all var(--duration-base) var(--ease-out);
}

.btn-text:hover {
	color: var(--primary-300);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.btn-text:active {
	color: var(--primary-500);
}

.btn-text:disabled {
	color: var(--gray-600);
	cursor: not-allowed;
}

/* Size Variants */
.btn-text--small {
	font-size: var(--text-sm);
}

.btn-text--large {
	font-size: var(--text-lg);
	font-weight: var(--weight-semibold);
}

/* ==========================================================================
   Icon Button
   ========================================================================== */

.btn-icon {
	width: 48px;
	height: 48px;
	padding: 0;

	background: transparent;
	border: none;
	border-radius: var(--radius-md);
	color: var(--primary-400);

	display: flex;
	align-items: center;
	justify-content: center;

	transition: all var(--duration-base) var(--ease-out);
}

.btn-icon:hover {
	background: var(--glass-light);
	color: var(--primary-300);
	backdrop-filter: blur(var(--blur-md));
}

.btn-icon:active {
	background: var(--surface-3);
}

.btn-icon svg {
	width: 24px;
	height: 24px;
}

/* Size Variants */
.btn-icon--small {
	width: 36px;
	height: 36px;
}

.btn-icon--small svg {
	width: 18px;
	height: 18px;
}

.btn-icon--large {
	width: 56px;
	height: 56px;
}

.btn-icon--large svg {
	width: 28px;
	height: 28px;
}

/* Circular Variant */
.btn-icon--circle {
	border-radius: var(--radius-full);
}

/* ==========================================================================
   Success/Danger Variants
   ========================================================================== */

.btn-success {
	background: linear-gradient(135deg, var(--success-600) 0%, var(--success-500) 100%);
	color: #ffffff;
}

.btn-success::before {
	background: linear-gradient(135deg, var(--success-500) 0%, var(--success-400) 100%);
}

.btn-success:hover {
	box-shadow: var(--shadow-xl), var(--glow-success);
}

.btn-danger {
	background: linear-gradient(135deg, var(--error-600) 0%, var(--error-500) 100%);
	color: #ffffff;
}

.btn-danger::before {
	background: linear-gradient(135deg, var(--error-500) 0%, var(--error-400) 100%);
}

.btn-danger:hover {
	box-shadow: var(--shadow-xl), 0 0 20px rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Button Group
   ========================================================================== */

.btn-group {
	display: inline-flex;
	gap: var(--spacing-3);
	flex-wrap: wrap;
}

.btn-group--vertical {
	flex-direction: column;
	align-items: stretch;
}

.btn-group--vertical > * {
	width: 100%;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.btn-loading {
	position: relative;
	color: transparent;
	pointer-events: none;
}

.btn-loading::after {
	content: '';
	position: absolute;
	width: 16px;
	height: 16px;
	top: 50%;
	left: 50%;
	margin-left: -8px;
	margin-top: -8px;
	border: 2px solid currentColor;
	border-radius: var(--radius-full);
	border-top-color: transparent;
	animation: btn-spin 0.6s linear infinite;
	color: #ffffff;
}

@keyframes btn-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 767px) {
	.btn-primary,
	.btn-secondary,
	.btn-ghost {
		min-width: 120px;
	}

	.btn-primary--large,
	.btn-secondary--large,
	.btn-ghost--large {
		height: 52px;
		padding-left: var(--spacing-12);
		padding-right: var(--spacing-12);
		font-size: var(--text-base);
	}

	.btn-group {
		width: 100%;
	}

	.btn-group > * {
		flex: 1;
	}
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	button,
	.btn-primary,
	.btn-secondary,
	.btn-ghost,
	.btn-text,
	.btn-icon {
		box-shadow: none;
		transform: none;
		background: #fff;
		color: #000;
		border: 1px solid #000;
	}

	.btn-primary::before,
	.btn-secondary::before {
		display: none;
	}
}
