/**
 * GastroOne — mobile customer form controls + narrow checkout layout
 *
 * - iPhone Safari: inputs ≥16px (no auto-zoom); do not disable user zoom.
 * - Narrow phones (320–430): stack tight two-column rows, 48px touch targets,
 *   scroll-margin so keyboard + sticky CTA do not hide the active field.
 * - Keyboard inset (--rim-keyboard-inset) lifts fixed docks above iOS keyboard.
 *
 * @package Royal_India_Manager
 */

:root {
	--rim-keyboard-inset: 0px;
}

@media (max-width: 900px) {
	/* Checkout + order form */
	.rim-order-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="file"]),
	.rim-order-form select,
	.rim-order-form textarea,
	.rim-order-form--checkout input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="file"]),
	.rim-order-form--checkout select,
	.rim-order-form--checkout textarea,
	.rim-checkout-auth input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
	.rim-checkout-auth select,
	.rim-checkout-auth textarea,
	/* Mein Konto */
	.rim-customer-account input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="file"]),
	.rim-customer-account select,
	.rim-customer-account textarea,
	/* Dish modal notes */
	.rim-dish-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
	.rim-dish-modal select,
	.rim-dish-modal textarea,
	/* Public reservation (plugin + theme) */
	.rim-public-reservation-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
	.rim-public-reservation-form select,
	.rim-public-reservation-form textarea,
	.reservation-page--pro .reservation-form__field input,
	.reservation-page--pro .reservation-form__field select,
	.reservation-page--pro .reservation-form__field textarea,
	/* Delivery / house-number sheets used on order flow */
	.rim-delivery-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
	.rim-delivery-modal select,
	.rim-delivery-modal textarea,
	.rim-hn-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
	.rim-hn-modal select,
	.rim-hn-modal textarea {
		font-size: 16px !important;
		line-height: 1.35;
		min-height: 48px;
		padding: 14px 16px;
		box-sizing: border-box;
		/* Keep focused field clear of sticky checkout CTA + iOS keyboard chrome */
		scroll-margin-bottom: calc(6.5rem + var(--rim-keyboard-inset, 0px) + env(safe-area-inset-bottom, 0px));
		scroll-margin-top: 5.5rem;
	}

	.rim-order-form textarea,
	.rim-order-form--checkout textarea,
	.rim-checkout-auth textarea,
	.rim-customer-account textarea,
	.rim-dish-modal textarea,
	.rim-public-reservation-form textarea,
	.reservation-page--pro .reservation-form__field textarea {
		min-height: 96px;
		padding-top: 14px;
		padding-bottom: 14px;
	}

	/* Segmented controls — touch-friendly, no clipped labels */
	.rim-checkout-type-toggle__option {
		min-height: 48px;
		padding: 0.75rem 0.5rem;
		box-sizing: border-box;
	}

	.rim-checkout-type-toggle__option span {
		font-size: 15px !important;
		line-height: 1.25;
		white-space: normal;
		overflow-wrap: anywhere;
		hyphens: auto;
	}

	.rim-checkout-time__choice,
	.rim-checkout-payment__option {
		min-height: 48px;
		box-sizing: border-box;
	}

	.rim-checkout-mobile-bar__cta {
		min-height: 48px;
	}

	.rim-order-form--checkout,
	.rim-order-form--checkout-mobile {
		padding-bottom: calc(5.75rem + var(--rim-keyboard-inset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
		overflow-x: clip;
		max-width: 100%;
	}

	html.rim-keyboard-open .rim-order-form--checkout,
	html.rim-keyboard-open .rim-order-form--checkout-mobile {
		/* Extra room so last field can scroll above lifted CTA */
		padding-bottom: calc(6.25rem + var(--rim-keyboard-inset, 0px)) !important;
	}

	.rim-order-checkout,
	.rim-order-checkout-layout,
	.rim-checkout-panel__card {
		max-width: 100%;
		min-width: 0;
	}

	html.rim-keyboard-open .rim-footer-cart__bar,
	html.rim-keyboard-open .rim-order__footer-cart-bar,
	html.rim-keyboard-open .rim-order__mobile-cart-bar {
		padding-bottom: 0.65rem;
	}
}

/* Narrow phones: stack dense two-column rows */
@media (max-width: 390px) {
	.rim-checkout-location,
	.rim-checkout-time__row {
		grid-template-columns: 1fr !important;
		gap: 0.55rem;
	}

	.rim-checkout-tips {
		grid-template-columns: 1fr 1fr;
	}

	.rim-checkout-type-toggle {
		gap: 0.4rem;
		width: 100%;
		max-width: 100%;
	}

	.rim-checkout-type-toggle__option span {
		font-size: 14px !important;
	}

	.rim-checkout-progress {
		gap: 0.25rem;
	}

	.rim-checkout-progress__label {
		font-size: 0.68rem;
		letter-spacing: 0;
	}
}

@media (max-width: 340px) {
	/* Ultra-narrow: guest/login can stack if needed for long DE labels */
	.rim-checkout-auth__mode .rim-checkout-type-toggle {
		grid-template-columns: 1fr;
	}

	.rim-checkout-time__choices {
		grid-template-columns: 1fr !important;
	}
}
