/**
 * Registration Drawer Styles
 * Off-canvas slide-out drawer for course registration
 * 
 * @package SureCartCourseExtension
 * @since 1.2.0
 */

/* ===================================
   Backdrop Overlay
   =================================== */

.sce-drawer-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9998;
	opacity: 0;
	transition: opacity 200ms ease-out;
	pointer-events: none;
}

.sce-drawer-backdrop.is-visible {
	opacity: 1;
	pointer-events: auto;
}

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

.sce-registration-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 480px;
	max-width: 100vw;
	background: #FFFFFF;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 300ms ease-out;
	contain: layout style paint;
}

.sce-registration-drawer.is-open {
	transform: translateX(0);
}

.sce-registration-drawer.is-closing {
	transition: transform 250ms ease-in;
}

/* ===================================
   Drawer Header
   =================================== */

.sce-drawer-header {
	flex-shrink: 0;
	padding: 24px;
	border-bottom: 1px solid #E5E7EB;
	background: #FFFFFF;
	position: sticky;
	top: 0;
	z-index: 10;
}

.sce-drawer-header__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.sce-drawer-header__step {
	font-size: 14px;
	font-weight: 600;
	color: #6B7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.sce-drawer-header__close {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	color: #6B7280;
	cursor: pointer;
	border-radius: 4px;
	transition: all 150ms ease;
}

.sce-drawer-header__close:hover {
	background: #F3F4F6;
	color: #1F2937;
}

.sce-drawer-header__close:focus {
	outline: 2px solid #00C896;
	outline-offset: 2px;
}

.sce-drawer-header__close svg {
	width: 20px;
	height: 20px;
}

.sce-drawer-header__title {
	font-size: 20px;
	font-weight: 700;
	color: #1F2937;
	margin: 0;
	line-height: 1.3;
}

/* ===================================
   Drawer Content
   =================================== */

.sce-drawer-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 24px;
	-webkit-overflow-scrolling: touch;
}

.sce-drawer-content::-webkit-scrollbar {
	width: 8px;
}

.sce-drawer-content::-webkit-scrollbar-track {
	background: #F9FAFB;
}

.sce-drawer-content::-webkit-scrollbar-thumb {
	background: #D1D5DB;
	border-radius: 4px;
}

.sce-drawer-content::-webkit-scrollbar-thumb:hover {
	background: #9CA3AF;
}

/* ===================================
   Drawer Footer
   =================================== */

.sce-drawer-footer {
	flex-shrink: 0;
	padding: 20px 24px;
	border-top: 1px solid #E5E7EB;
	background: #FFFFFF;
	display: flex;
	gap: 12px;
	position: sticky;
	bottom: 0;
	z-index: 10;
}

.sce-drawer-footer__back {
	flex: 0 0 auto;
	padding: 12px 20px;
	font-size: 16px;
	font-weight: 600;
	color: #1F2937;
	background: transparent;
	border: 2px solid #1F2937;
	border-radius: 6px;
	cursor: pointer;
	transition: all 150ms ease;
}

.sce-drawer-footer__back:hover:not(:disabled) {
	opacity: 0.8;
}

.sce-drawer-footer__back:focus {
	outline: 2px solid #00C896;
	outline-offset: 2px;
}

.sce-drawer-footer__back:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.sce-drawer-footer__primary {
	flex: 1;
	padding: 12px 24px;
	font-size: 16px;
	font-weight: 600;
	color: #FFFFFF;
	background: #00C896;
	border: 2px solid #00C896;
	border-radius: 6px;
	cursor: pointer;
	transition: all 150ms ease;
	position: relative;
}

.sce-drawer-footer__primary:hover:not(:disabled) {
	border-color: #00B385;
}

.sce-drawer-footer__primary:focus {
	outline: 2px solid #00C896;
	outline-offset: 2px;
}

.sce-drawer-footer__primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.sce-drawer-footer__primary.is-loading {
	color: transparent;
}

.sce-drawer-footer__primary .sce-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 20px;
	height: 20px;
	display: none;
}

.sce-drawer-footer__primary.is-loading .sce-spinner {
	display: block;
}

/* ===================================
   Step Transition
   =================================== */

.sce-drawer-step {
	animation: slideInRight 200ms ease-out;
}

.sce-drawer-step.is-exiting {
	animation: slideOutLeft 200ms ease-in;
}

@keyframes slideInRight {
	from {
		opacity: 0;
		transform: translateX(20px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideOutLeft {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(-20px);
	}
}

/* ===================================
   Loading State
   =================================== */

.sce-drawer-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 48px 24px;
	text-align: center;
}

.sce-drawer-loading__spinner {
	width: 48px;
	height: 48px;
	margin-bottom: 16px;
}

.sce-drawer-loading__text {
	font-size: 16px;
	color: #6B7280;
}

/* ===================================
   Error State
   =================================== */

.sce-drawer-error {
	padding: 16px;
	background: #FEF2F2;
	border: 1px solid #FCA5A5;
	border-radius: 6px;
	margin-bottom: 20px;
}

.sce-drawer-error__title {
	font-size: 16px;
	font-weight: 600;
	color: #991B1B;
	margin: 0 0 8px 0;
}

.sce-drawer-error__message {
	font-size: 14px;
	color: #B91C1C;
	margin: 0;
}

/* ===================================
   Spinner Animation
   =================================== */

.sce-spinner {
	animation: rotate 2s linear infinite;
}

.sce-spinner circle {
	stroke: currentColor;
	stroke-linecap: round;
	animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
	100% {
		transform: rotate(360deg);
	}
}

@keyframes dash {
	0% {
		stroke-dasharray: 1, 150;
		stroke-dashoffset: 0;
	}
	50% {
		stroke-dasharray: 90, 150;
		stroke-dashoffset: -35;
	}
	100% {
		stroke-dasharray: 90, 150;
		stroke-dashoffset: -124;
	}
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablet */
@media (max-width: 767px) {
	.sce-registration-drawer {
		width: 420px;
	}
}

/* Mobile */
@media (max-width: 639px) {
	.sce-registration-drawer {
		width: 100vw;
		height: 100vh;
		transform: translateY(100%);
	}
	
	.sce-registration-drawer.is-open {
		transform: translateY(0);
	}
	
	.sce-drawer-backdrop {
		background: rgba(0, 0, 0, 0.7);
	}
	
	.sce-drawer-header {
		padding: 20px;
	}
	
	.sce-drawer-content {
		padding: 20px;
	}
	
	.sce-drawer-footer {
		padding: 16px 20px;
		flex-direction: column-reverse;
	}
	
	.sce-drawer-footer__back,
	.sce-drawer-footer__primary {
		width: 100%;
	}
}

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

.sce-registration-drawer:focus {
	outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.sce-drawer-backdrop,
	.sce-registration-drawer,
	.sce-drawer-step,
	.sce-drawer-footer__back,
	.sce-drawer-footer__primary {
		transition: none;
		animation: none;
	}
}

/* High contrast mode */
@media (prefers-contrast: high) {
	.sce-drawer-header,
	.sce-drawer-footer {
		border-color: #000000;
	}
	
	.sce-drawer-footer__back,
	.sce-drawer-footer__primary {
		border-width: 3px;
	}
}

/* ===================================
   Order Summary
   =================================== */

.sce-order-summary {
	margin: 0 24px 24px;
	padding: 20px;
	background: #F8F9FA;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
}

.sce-order-summary__title {
	margin: 0 0 16px;
	font-size: 16px;
	font-weight: 600;
	color: #1F2937;
}

.sce-order-summary__content {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sce-order-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid #E5E7EB;
}

.sce-order-summary__row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.sce-order-summary__row--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 2px solid #1F2937;
	border-bottom: none;
	font-weight: 600;
	font-size: 18px;
}

.sce-order-summary__label {
	color: #6B7280;
	font-size: 14px;
	line-height: 1.5;
}

.sce-order-summary__row--total .sce-order-summary__label {
	color: #1F2937;
	font-size: 16px;
}

.sce-order-summary__value {
	color: #1F2937;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	text-align: right;
}

.sce-order-summary__row--total .sce-order-summary__value {
	color: #10B981;
	font-size: 18px;
	font-weight: 700;
}

/* Mobile responsive */
@media (max-width: 480px) {
	.sce-order-summary {
		margin: 0 16px 16px;
		padding: 16px;
	}
	
	.sce-order-summary__title {
		font-size: 15px;
	}
	
	.sce-order-summary__label,
	.sce-order-summary__value {
		font-size: 13px;
	}
	
	.sce-order-summary__row--total {
		font-size: 16px;
	}
	
	.sce-order-summary__row--total .sce-order-summary__value {
		font-size: 16px;
	}
}

/* ===================================
   Breadcrumb Navigation
   =================================== */

.sce-drawer-breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 500;
	margin-bottom: 16px;
	color: #6B7280;
}

.sce-breadcrumb__item {
	text-transform: uppercase;
	letter-spacing: 0.5px;
	transition: color 200ms ease;
	color: #D1D5DB;
}

.sce-breadcrumb__item--active {
	color: #10B981;
}

.sce-breadcrumb__separator {
	color: #D1D5DB;
}

/* ===================================
   Course Title
   =================================== */

.sce-variant-selection__course-title {
	font-size: 18px;
	font-weight: 600;
	color: #111827;
	margin: 0 0 20px 0;
	line-height: 1.4;
}

/* ===================================
   Availability Badge
   =================================== */

.sce-quantity-selector-wrapper {
	display: flex;
	align-items: center;
	gap: 12px;
}

.sce-availability-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
}

.sce-availability-badge--available {
	background-color: #D1FAE5;
	color: #065F46;
}

.sce-availability-badge__icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.sce-availability-badge__text {
	line-height: 1;
}

/* ===================================
   Collapsible Order Summary
   =================================== */

.sce-order-summary {
	margin-bottom: 20px;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
	overflow: hidden;
}

.sce-order-summary__total-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px;
	background: #FFFFFF;
	border-bottom: 1px solid #E5E7EB;
}

.sce-order-summary__total-label {
	font-size: 16px;
	font-weight: 600;
	color: #111827;
}

.sce-order-summary__total-value {
	font-size: 20px;
	font-weight: 700;
	color: #10B981;
}

.sce-order-summary__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	background: #F9FAFB;
	border: none;
	cursor: pointer;
	transition: background-color 200ms ease;
}

.sce-order-summary__toggle:hover {
	background: #F3F4F6;
}

.sce-order-summary__toggle.is-expanded .sce-order-summary__toggle-icon {
	transform: rotate(180deg);
}

.sce-order-summary__toggle-text {
	font-size: 16px;
	font-weight: 600;
	color: #111827;
}

.sce-order-summary__toggle-icon {
	width: 20px;
	height: 20px;
	color: #6B7280;
	transition: transform 200ms ease;
}

.sce-order-summary__content {
	padding: 16px;
	background: #FFFFFF;
}

.sce-order-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #F3F4F6;
}

.sce-order-summary__row:last-child {
	border-bottom: none;
}

.sce-order-summary__row--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 2px solid #E5E7EB;
}

.sce-order-summary__label {
	font-size: 14px;
	color: #6B7280;
}

.sce-order-summary__value {
	font-size: 14px;
	font-weight: 500;
	color: #111827;
}

.sce-order-summary__row--total .sce-order-summary__label {
	font-size: 16px;
	font-weight: 600;
	color: #111827;
}

.sce-order-summary__row--total .sce-order-summary__value {
	font-size: 18px;
	font-weight: 700;
	color: #10B981;
}

/* ===================================
   Copy Details Checkbox
   =================================== */

.sce-copy-details {
	padding: 1rem 0 1.5rem;
	margin: 0 0 1rem;
	border-bottom: 1px solid #E5E7EB;
}

.sce-copy-details__checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	font-size: 0.9375rem;
	color: #374151;
}

.sce-copy-details__checkbox input[type="checkbox"] {
	width: 1.125rem;
	height: 1.125rem;
	cursor: pointer;
	margin: 0;
}

.sce-copy-details__checkbox span {
	user-select: none;
}

.sce-copy-details__checkbox:hover span {
	color: #10B981;
}

/* ===================================
   Billing Contact Form
   =================================== */

.sce-billing-form {
	padding: 0;
}

.sce-billing-form__intro {
	margin-bottom: 1.5rem;
}

.sce-billing-form__description {
	color: #6B7280;
	font-size: 0.9375rem;
	line-height: 1.5;
	margin: 0;
}

.sce-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-bottom: 1rem;
}

.sce-form-group {
	margin-bottom: 1rem;
}

.sce-form-label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	margin-bottom: 0.5rem;
}

.sce-required {
	color: #EF4444;
	margin-left: 0.125rem;
}

.sce-form-input {
	width: 100%;
	padding: 0.625rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: #1F2937;
	background-color: #FFFFFF;
	border: 1px solid #D1D5DB;
	border-radius: 0.375rem;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.sce-form-input:focus {
	outline: none;
	border-color: #10B981;
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.sce-form-input--error {
	border-color: #EF4444;
}

.sce-form-input--error:focus {
	border-color: #EF4444;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.sce-form-error {
	display: block;
	margin-top: 0.375rem;
	font-size: 0.8125rem;
	color: #EF4444;
}

.sce-form-help {
	display: block;
	margin-top: 0.375rem;
	font-size: 0.8125rem;
	color: #6B7280;
	line-height: 1.4;
}

.sce-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	cursor: pointer;
	padding: 1rem;
	background-color: #F9FAFB;
	border: 1px solid #E5E7EB;
	border-radius: 0.5rem;
	transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.sce-checkbox-label:hover {
	background-color: #F3F4F6;
	border-color: #D1D5DB;
}

.sce-checkbox-input {
	flex-shrink: 0;
	width: 1.125rem;
	height: 1.125rem;
	margin-top: 0.125rem;
	cursor: pointer;
	border-radius: 0.25rem;
}

.sce-checkbox-text {
	font-size: 0.9375rem;
	color: #374151;
	font-weight: 500;
	user-select: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
	.sce-form-row {
		grid-template-columns: 1fr;
		gap: 1rem;
	}
}
