/**
 * Bowling Daily Availability Grid Styles
 * Version: 1.2.0 - Added capacity tracking
 */

.bowling-daily-grid {
	/*max-width: 1400px;*/
	margin: 2rem auto;
	/*font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;*/
}

.bowling-daily-header {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
	margin-bottom: 1.5rem;
	gap: 1rem;
	flex-wrap: wrap;
	position: relative;
}

.bowling-current-date-wrapper {
	position: relative;
	text-align: left;
	/*margin-right: auto;*/
}

.bowling-current-date {
	font-size: 1.5rem;
	font-weight: 700;
	color: #000000;
	cursor: pointer;
	/*padding: 0 1rem;*/
	border-radius: 6px;
	transition: all 0.2s;
}

.bowling-current-date:hover {
	color: #000000;
	transform: translateY(-1px);
}

/* IMPORTANT: Keep the date picker input completely hidden but accessible to Flatpickr */
.bowling-date-picker,
input.bowling-date-picker,
input.bowling-date-picker.flatpickr-input,
.bowling-current-date-wrapper input,
.bowling-current-date-wrapper .flatpickr-input,
.bowling-daily-grid input[type="text"].flatpickr-input {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	/* Don't use display:none or visibility:hidden - Flatpickr needs to access it */
}

/* All buttons are now direct children of .bowling-daily-header */

.bowling-date-nav {
	padding: 0.6rem 1.2rem;
	background: linear-gradient(135deg, #2c5f2d 0%, #4a7c4e 100%);
	color: white;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	transition: all 0.2s;
	box-shadow: 0 2px 4px rgba(44, 95, 45, 0.2);
}

.bowling-date-nav:hover {
	background: linear-gradient(135deg, #234d24 0%, #3a6a3d 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(44, 95, 45, 0.3);
}

.bowling-date-nav:active {
	transform: translateY(0);
}

/* Icon spacing in buttons */
.bowling-date-nav i {
	margin-right: 0.4rem;
}

.bowling-availability-grid {
	display: grid;
	grid-template-columns: 100px repeat(6, 1fr);
	gap: 1px;
	background: #d0d0d0;
	border: 1px solid #d0d0d0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.bowling-grid-header {
	background: linear-gradient(135deg, #2c5f2d 0%, #4a7c4e 100%);
	color: white;
	padding: 1rem;
	font-weight: 700;
	text-align: center;
	font-size: 1rem;
}

.bowling-time-slot {
	background: white;
	padding: 1rem;
	text-align: center;
	min-height: 55px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.9rem;
	font-weight: 600;
	transition: all 0.2s;
}

.bowling-slot-available {
	background: #e8f5e9;
	color: #2e7d32;
	cursor: pointer;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

.bowling-slot-available:hover {
	background: #a5d6a7;
	/*transform: scale(1.02);*/
	z-index: 10;
}

.bowling-slot-available:active {
	transform: scale(0.98);
}

.bowling-slot-booked {
	background: #ffebee;
	color: #c62828;
	cursor: not-allowed;
	opacity: 0.8;
}

.bowling-slot-warning {
	background: #fff3e0;
	color: #e65100;
	cursor: pointer;
	position: relative;
	font-weight: 700;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

.bowling-slot-warning:hover {
	background: #ffdaa3;
	z-index: 10;
}

.bowling-slot-locked {
	background: #fafafa;
	color: #757575;
	font-weight: 500;
	position: relative;
	line-height: 1.3;
	padding: 0.25rem;
	white-space: normal;
	word-wrap: break-word;
	/* cursor set by JavaScript based on admin/frontend */
}

/* Hover effect only for admin (pointer cursor) */
.bowling-slot-locked[style*="cursor: pointer"]:hover {
	background: #e0e0e0;
	z-index: 10;
}

/* Full (at capacity, not manually locked) - RED for customers */
.bowling-slot-full {
	background: #ffcdd2;
	color: #b71c1c;
	font-weight: 700;
	cursor: not-allowed;
}

.bowling-slot-unavailable {
	background: #fafafa;
	color: #9e9e9e;
}

.bowling-legend {
	display: flex;
	justify-content: center;
	gap: 2rem;
	margin-top: 1.5rem;
	padding: 1rem;
	background: #f5f5f5;
	border-radius: 6px;
}

.bowling-legend-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.bowling-legend-box {
	width: 24px;
	height: 24px;
	border-radius: 4px;
	border: 1px solid #b8b8b8;
}

.bowling-loading {
	grid-column: 1 / -1;
	padding: 3rem;
	text-align: center;
	color: #666;
	font-size: 1.1rem;
}

/* Mobile responsive */
@media (max-width: 968px) {
	.bowling-availability-grid {
		grid-template-columns: 100px repeat(4, 1fr);
	}

	/* Mobile: Date on top, all 4 buttons on one row below */
	.bowling-daily-header {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
		align-items: center;
		gap: 0.5rem;
	}

	/* Date takes full width */
	.bowling-current-date-wrapper {
		flex-basis: 100%;
		order: 1;
		text-align: left;
		margin-right: 0;
	}

	.bowling-current-date {
		padding: 0;
	}

	/* All buttons are siblings, order them after the date */
	.bowling-date-nav {
		order: 2;
		padding: 0.5rem 0.75rem;
		font-size: 0.75rem;
		white-space: nowrap;
		flex-shrink: 1;
		min-width: 0;
	}

	/* Reduce icon size in mobile */
	.bowling-date-nav i {
		font-size: 0.7rem;
	}
}

@media (max-width: 768px) {
	.bowling-availability-grid {
		grid-template-columns: 100px repeat(3, 1fr);
	}

	.bowling-date-nav {
		padding: 0.5rem 1rem;
		font-size: 0.85rem;
	}

	.bowling-current-date {
		font-size: 1.2rem;
	}

	.bowling-legend {
		flex-direction: column;
		gap: 0.5rem;
	}
}

@media (max-width: 480px) {
	.bowling-availability-grid {
		grid-template-columns: 80px repeat(2, 1fr);
	}

	.bowling-grid-header,
	.bowling-time-slot,
	.bowling-slot {
		padding: 0.5rem;
		font-size: 0.85rem;
	}
}

/* Flatpickr mobile improvements */
.flatpickr-calendar.flatpickr-mobile {
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	border-radius: 12px;
	overflow: hidden;
	max-width: 90vw !important;
}

/* Hide calendar until positioned - prevents layout shift */
/* Use visibility instead of opacity for more reliable hiding */
.flatpickr-calendar.open:not(.positioned) {
	visibility: hidden !important;
	opacity: 0 !important;
	z-index: 9999 !important;
}

/* Show calendar once positioned */
.flatpickr-calendar.open.positioned {
	visibility: visible !important;
	opacity: 1 !important;
	transition: opacity 0.2s ease-in !important;
}

/* Mobile: Add backdrop when calendar is open */
@media (max-width: 768px) {
	/*.flatpickr-calendar.open::before {
		content: '';
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: -1;
	}*/

	.flatpickr-calendar {
		box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
		border-radius: 12px;
	}
}

/* Ensure calendar is touchable on iOS */
.flatpickr-calendar * {
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
}

.flatpickr-day {
	touch-action: manipulation;
}

/* Enquiry Modal Popup */
.bowling-enquiry-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	padding: 1rem;
}

.bowling-enquiry-content {
	background: white;
	border-radius: 12px;
	padding: 2rem;
	max-width: 600px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.bowling-modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: transparent;
	border: none;
	font-size: 2rem;
	color: #666;
	cursor: pointer;
	line-height: 1;
	padding: 0;
	width: 32px;
	height: 32px;
	transition: color 0.2s;
}

.bowling-modal-close:hover {
	color: #000;
}

.bowling-enquiry-content h3 {
	margin: 0 0 1rem 0;
	color: #b71c1c;
	font-size: 1.5rem;
}

.capacity-info {
	background: #ffebee;
	padding: 0.75rem 1rem;
	border-radius: 6px;
	margin-bottom: 1rem;
	color: #c62828;
	font-size: 0.95rem;
}

.enquiry-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	margin-top: 1.5rem;
}

.enquiry-option {
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	padding: 1.5rem;
	background: #fafafa;
}

.enquiry-option h4 {
	margin: 0 0 0.75rem 0;
	font-size: 1.1rem;
	color: #333;
}

.enquiry-option p {
	font-size: 0.9rem;
	color: #666;
	margin-bottom: 1rem;
	line-height: 1.4;
}

.bowling-phone-btn {
	display: inline-block;
	background: linear-gradient(135deg, #2c5f2d 0%, #4a7c4e 100%);
	color: white;
	padding: 0.75rem 1.5rem;
	border-radius: 6px;
	text-decoration: none;
	font-weight: 600;
	transition: all 0.2s;
	box-shadow: 0 2px 4px rgba(44, 95, 45, 0.2);
}

.bowling-phone-btn:hover {
	background: linear-gradient(135deg, #234d24 0%, #3a6a3d 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(44, 95, 45, 0.3);
	color: white;
}

.bowling-enquiry-form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.bowling-enquiry-form input,
.bowling-enquiry-form textarea {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 0.9rem;
	font-family: inherit;
	transition: border-color 0.2s;
}

.bowling-enquiry-form input:focus,
.bowling-enquiry-form textarea:focus {
	outline: none;
	border-color: #2c5f2d;
	box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.bowling-submit-btn {
	background: linear-gradient(135deg, #2c5f2d 0%, #4a7c4e 100%);
	color: white;
	padding: 0.75rem 1.5rem;
	border: none;
	border-radius: 6px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: 0 2px 4px rgba(44, 95, 45, 0.2);
}

.bowling-submit-btn:hover:not(:disabled) {
	background: linear-gradient(135deg, #234d24 0%, #3a6a3d 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(44, 95, 45, 0.3);
}

.bowling-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Mobile responsive for modal */
@media (max-width: 768px) {
	.enquiry-options {
		grid-template-columns: 1fr;
	}

	.bowling-enquiry-content {
		padding: 1.5rem;
	}

	.bowling-enquiry-content h3 {
		font-size: 1.25rem;
		padding-right: 2rem;
	}
}

/* ── Early-booking enquiry modal ─────────────────────────────────────────── */
.bowling-early-enquiry-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, 0.55);
	align-items: center;
	justify-content: center;
}

.bowling-early-enquiry-modal.is-open {
	display: flex;
}

.bowling-early-enquiry-inner {
	background: #fff;
	border-radius: 10px;
	padding: 36px 32px 28px;
	max-width: 780px;
	width: 92%;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
}

.bowling-early-enquiry-close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0;
}

.bowling-early-enquiry-close:hover {
	color: #111;
}

/* Enquiry calendar slot */
.bowling-slot-enquiry {
	background: #e0f4f6 !important;
	color: #2b6f7b !important;
	cursor: pointer !important;
	font-weight: 600 !important;
}

.bowling-slot-enquiry:hover {
	background: #c5eaee !important;
}

/* GF grid inside the modal — theme scopes its own grid to .gform-main-wrapper */
.bowling-early-enquiry-inner .gform_fields {
	display: grid !important;
	grid-template-columns: repeat(12, 1fr) !important;
	gap: 16px !important;
}

/* Fields with no explicit width class are full-width (GF doesn't add gfield--width-full for 100% fields) */
.bowling-early-enquiry-inner .gfield:not([class*="gfield--width"]),
.bowling-early-enquiry-inner .gfield--width-full {
	grid-column: 1 / -1;
}

.bowling-early-enquiry-inner .gfield--width-half {
	grid-column: span 12;
}

.bowling-early-enquiry-inner .gfield--width-third {
	grid-column: span 12;
}

.bowling-early-enquiry-inner .gfield--width-quarter {
	grid-column: span 12;
}

.bowling-early-enquiry-inner .gfield--width-three-quarter {
	grid-column: span 12;
}

/* Inputs fill their grid cell */
.bowling-early-enquiry-inner .gfield input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="hidden"]),
.bowling-early-enquiry-inner .gfield textarea,
.bowling-early-enquiry-inner .gfield select {
	width: 100%;
	box-sizing: border-box;
	/*border: solid 1px #dfdbdb;*/
	padding: 9px 0px;
}

.bowling-early-enquiry-inner .gfield_label {
	color: #7e785e;
}

/* Pre-filled read-only field (e.g. date/time injected from calendar) */
.bowling-early-enquiry-inner .gfield-prefilled {
	/*background: #f9f9f9;*/
	color: #555;
	cursor: default;
}

@media (min-width: 768px) {
	.bowling-early-enquiry-inner .gfield--width-half {
		grid-column: span 6;
	}

	.bowling-early-enquiry-inner .gfield--width-third {
		grid-column: span 4;
	}

	.bowling-early-enquiry-inner .gfield--width-quarter {
		grid-column: span 3;
	}

	.bowling-early-enquiry-inner .gfield--width-three-quarter {
		grid-column: span 9;
	}
}