/**
 * Timely Booking Modal Styles
 *
 * @package eRide
 * @version 2.0.0
 * @description Fully responsive modal with mobile-first design
 */

/* ========================================
   Modal Container & Overlay
   ======================================== */

.timely-booking-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	overflow: hidden;
}

.timely-booking-modal.active {
	display: block;
}

.timely-booking-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(4px);
	animation: fadeIn 0.3s ease-out;
}

/* ========================================
   Modal Wrapper & Content
   ======================================== */

.timely-booking-modal-wrapper {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 1000000;
}

.timely-booking-modal-content {
	position: relative;
	width: 100%;
	height: 100%;
	background: white;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	animation: slideIn 0.3s ease-out;
	display: flex;
	flex-direction: column;
}

/* ========================================
   Responsive Sizing
   ======================================== */

/* Mobile (< 768px): Fixed bottom with 40px gap at top */
@media (max-width: 767px) {
	.timely-booking-modal-wrapper {
		position: fixed;
		align-items: flex-end;
	}

	.timely-booking-modal-content {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		border-radius: 20px 20px 0 0;
		height: calc(90vh - 40px);
		max-height: calc(90vh - 40px);
		width: 100%;
		box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
		animation: slideUpFromBottom 0.4s ease-out;
	}

	.timely-booking-modal-body {
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* Tablet (768px - 1023px): 95% width, rounded corners */
@media (min-width: 768px) and (max-width: 1023px) {
	.timely-booking-modal-wrapper {
		padding: 60px;
	}

	.timely-booking-modal-content {
		width: 95%;
		height: 90vh;
		max-height: 720px;
		border-radius: 12px;
	}
}

/* Desktop (>= 1024px): Fixed width, centered */
@media (min-width: 1024px) {
	.timely-booking-modal-wrapper {
		padding: 40px;
	}

	.timely-booking-modal-content {
		width: 90%;
		max-width: 880px;
		height: 85vh;
		max-height: 800px;
		border-radius: 16px;
	}
}

/* ========================================
   Close Button
   ======================================== */

.timely-booking-modal-close {
	position: fixed;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(100, 197, 178, 0.95); /* eRide primary green */
	color: white;
	cursor: pointer;
	z-index: 1000001;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s ease;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.timely-booking-modal-close:hover {
	background: rgba(100, 197, 178, 1);
	transform: scale(1.1) rotate(90deg);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.timely-booking-modal-close:focus {
	outline: 2px solid rgba(100, 197, 178, 0.5);
	outline-offset: 2px;
}

.timely-booking-modal-close svg {
	width: 22px;
	height: 22px;
	display: block;
}

/* Mobile: Position close button in 40px gap at top */
@media (max-width: 767px) {
	.timely-booking-modal-close {
		position: fixed;
		top: 4px;
		right: 4px;
		width: 44px;
		height: 44px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
		z-index: 1000002;
	}

	.timely-booking-modal-close svg {
		width: 24px;
		height: 24px;
	}
}

/* Desktop: Position close button outside modal */
@media (min-width: 1024px) {
	.timely-booking-modal-close {
		top: 0;
		right: -56px; /* 44px button + 12px spacing */
	}
}

/* ========================================
   Modal Body & Iframe
   ======================================== */

.timely-booking-modal-body {
	flex: 1;
	width: 100%;
	height: 100%;
	overflow: hidden;
	position: relative;
}

.timely-booking-modal-body iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* ========================================
   Body Scroll Lock
   ======================================== */

body.timely-modal-open {
	overflow: hidden;
	position: fixed;
	width: 100%;
	height: 100%;
}

/* iOS Safari fix */
@supports (-webkit-touch-callout: none) {
	body.timely-modal-open {
		position: fixed;
		overflow: hidden;
	}
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: scale(0.95) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@keyframes slideUpFromBottom {
	from {
		opacity: 0;
		transform: translateY(100%); /* Start below viewport */
	}
	to {
		opacity: 1;
		transform: translateY(0); /* Slide up to position */
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.timely-booking-modal-overlay,
	.timely-booking-modal-content,
	.timely-booking-modal-close {
		animation: none;
		transition: none;
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.timely-booking-modal-close {
		background: #000;
		border: 2px solid #fff;
	}
}
