/*
 * Standalone Booking Page Styles
 * No modal, no transforms - designed to work inside iframes without pointer offset issues
 */

* {
    box-sizing: border-box;
}

html, body.wprb-standalone-page {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

#wprb-booking-modal.wprb-standalone {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: none !important;
    /*
     * On mobile 100vh is the viewport WITHOUT the browser bars, so the footer
     * ends up hidden behind the address bar / toolbar. 100dvh follows the bars
     * as they show and hide; 100vh stays as the fallback for older browsers.
     */
    height: 100vh !important;
    height: 100dvh !important;
    background: var(--wprb-widget-bg) !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative !important;
}

/* Header bar with gradient */
#wprb-booking-modal.wprb-standalone .header-bar {
    background: linear-gradient(135deg, var(--wprb-header-gradient-start) 0%, var(--wprb-header-gradient-end) 100%);
    color: var(--wprb-title-color);
    padding: 20px 20px 15px;
    flex-shrink: 0;
    position: relative;
}

#wprb-booking-modal.wprb-standalone .wprb-modal-header-image {
    text-align: center;
    margin-bottom: 10px;
}

#wprb-booking-modal.wprb-standalone .wprb-modal-header-image img {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

#wprb-booking-modal.wprb-standalone .wprb-widget-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--wprb-title-color);
}

/* Steps navigation */
#wprb-booking-modal.wprb-standalone .header-bar_steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    padding-top: 10px;
}

#wprb-booking-modal.wprb-standalone .header-bar_steps li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--wprb-step-pending-bg);
    color: var(--wprb-step-pending-text);
    font-size: 11px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

#wprb-booking-modal.wprb-standalone .header-bar_steps li span {
    font-size: 16px;
}

#wprb-booking-modal.wprb-standalone .header-bar_steps li.current {
    background: var(--wprb-step-current-bg);
    color: var(--wprb-step-current-text);
    font-weight: 600;
}

#wprb-booking-modal.wprb-standalone .header-bar_steps li.completed {
    background: var(--wprb-step-completed-bg);
    color: var(--wprb-step-completed-text);
}

/* Main content area */
#wprb-booking-modal.wprb-standalone .main_container_booking {
    /*
     * min-height: 0 lets the scrolling area shrink inside the flex column.
     * Without it a tall step grows past the container and pushes the footer
     * out of the screen.
     */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /*Extra room at the bottom so the last element never touches the footer*/
    padding: 10px 10px 40px;
    position: relative;
}

/* Steps */
#wprb-booking-modal.wprb-standalone .booking-step {
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

/* Hours grid */
#wprb-booking-modal.wprb-standalone .booking-hours ul {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    list-style: none;
    margin: 15px 0;
    padding: 0;
}

#wprb-booking-modal.wprb-standalone .booking-hours ul li {
    text-align: center;
}

#wprb-booking-modal.wprb-standalone .booking-hours ul li.no-hours {
    grid-column: 1 / -1;
    padding: 25px 15px;
    color: #666;
    font-size: 14px;
    background: #f9f9f9;
    border-radius: 8px;
}

#wprb-booking-modal.wprb-standalone .booking-hours ul li input {
    width: 100%;
    min-width: 70px;
    height: 40px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--wprb-text-color);
    background-color: var(--wprb-widget-bg);
    border-radius: 5px;
    border: 1px dotted var(--wprb-primary-color);
    transition: all 0.2s ease;
}

#wprb-booking-modal.wprb-standalone .booking-hours ul li input:hover {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
    font-weight: 700;
}

#wprb-booking-modal.wprb-standalone .booking-hours ul li input.active,
#wprb-booking-modal.wprb-standalone .booking-hours ul li input.selected-confirmed {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Room buttons */
#wprb-booking-modal.wprb-standalone .room-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

#wprb-booking-modal.wprb-standalone .room-select-btn {
    min-width: 120px;
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 500;
    color: var(--wprb-text-color);
    background-color: var(--wprb-widget-bg);
    border-radius: 5px;
    border: 1px dotted var(--wprb-primary-color);
    transition: all 0.2s ease;
}

#wprb-booking-modal.wprb-standalone .room-select-btn:hover {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
}

#wprb-booking-modal.wprb-standalone .room-select-btn.active {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Table buttons */
#wprb-booking-modal.wprb-standalone .basic-table-button {
    background: var(--wprb-widget-bg);
    border: 1px dotted var(--wprb-primary-color);
    color: var(--wprb-text-color);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin: 4px;
    display: inline-block;
    min-width: 90px;
    text-align: center;
    transition: all 0.2s ease;
}

#wprb-booking-modal.wprb-standalone .basic-table-button:hover:not(.occupied):not(.insufficient-seats) {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background: var(--wprb-bg-primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#wprb-booking-modal.wprb-standalone .basic-table-button.occupied {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    cursor: not-allowed;
}

#wprb-booking-modal.wprb-standalone .basic-table-button.insufficient-seats {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
    cursor: not-allowed;
}

/* Version footer: always pinned at the bottom, above the browser bars */
#wprb-booking-modal.wprb-standalone .wprb-version-footer {
    flex: 0 0 auto;
    text-align: right;
    font-size: 10px;
    color: #999;
    background: var(--wprb-widget-bg);
    border-top: 1px solid #eee;
    /*env() is 0 unless the page opts into the display cutout: harmless either way*/
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
}

#wprb-booking-modal.wprb-standalone .wprb-version-footer a {
    color: #999;
    text-decoration: none;
}

/* Additional content for steps */
#wprb-booking-modal.wprb-standalone .wprb-step-additional-content {
    margin-top: 15px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

#wprb-booking-modal.wprb-standalone .wprb-step-additional-content img {
    max-width: 100%;
    height: auto;
}

/* Service buttons */
#wprb-booking-modal.wprb-standalone .service-select-btn {
    border: 1px dotted var(--wprb-primary-color);
    background: var(--wprb-widget-bg);
    color: var(--wprb-text-color);
    padding: 12px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#wprb-booking-modal.wprb-standalone .service-select-btn:hover,
#wprb-booking-modal.wprb-standalone .service-select-btn.active {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
}

/* People selection */
#wprb-booking-modal.wprb-standalone .booking-people_numbers__number input[type="button"] {
    border: 1px dotted var(--wprb-primary-color);
    background: var(--wprb-widget-bg);
    color: var(--wprb-text-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#wprb-booking-modal.wprb-standalone .booking-people_numbers__number input[type="button"]:hover,
#wprb-booking-modal.wprb-standalone .booking-people_numbers__number input[type="button"].active {
    border: 2px solid var(--wprb-primary-color);
    color: var(--wprb-primary-color);
    background-color: var(--wprb-bg-primary-color);
}

/* Submit loader overlay */
#wprb-submit-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

#wprb-submit-loader .submit-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Shown instead of the steps while online bookings are switched off */
#wprb-booking-modal.wprb-standalone .wprb-booking-closed {
    max-width: 600px;
    margin: 40px auto;
    padding: 25px 20px;
    text-align: center;
    font-size: 16px;
    border-radius: 8px;
    background: #f9f9f9;
}

/*
 * Welcome popup, set in Personalizzazioni.
 * Above the language selector; the [hidden] rule is needed because
 * display: flex would otherwise win over the attribute.
 */
.wprb-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.wprb-popup-overlay[hidden] {
    display: none;
}

.wprb-popup {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 36px 24px 24px;
    border-top: 5px solid var(--wprb-header-gradient-start);
    border-radius: 10px;
    background: var(--wprb-widget-bg);
    color: var(--wprb-text-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-size: 15px;
    line-height: 1.6;
}

.wprb-popup-content > :first-child {
    margin-top: 0;
}

.wprb-popup-content > :last-child {
    margin-bottom: 0;
}

.wprb-popup-content img {
    max-width: 100%;
    height: auto;
}

.wprb-popup-content a {
    color: var(--wprb-primary-color);
}

.wprb-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--wprb-text-color);
    font-size: 28px;
    line-height: 36px;
    cursor: pointer;
}

.wprb-popup-close:hover,
.wprb-popup-close:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: var(--wprb-primary-color);
    outline: 2px solid var(--wprb-primary-color);
    outline-offset: 1px;
}

/* Hide admin bar */
#wpadminbar {
    display: none !important;
}

html {
    margin-top: 0 !important;
}

/* Google Translate banner is hidden via inline <style> injected by JS (same as gtranslate) */

/* ------------------------------------------------- privacy policy overlay */

/*
 * Full screen, above everything: the welcome popup sits at 100000 and this one
 * can legitimately open on top of it.
 */
.wprb-policy-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	flex-direction: column;
	background: #fff;
}

.wprb-policy-modal[hidden] {
	display: none;
}

.wprb-policy-modal__bar {
	display: flex;
	align-items: center;
	gap: 14px;
	flex: 0 0 auto;
	padding: 12px 16px;
	border-bottom: 1px solid #e3e3e3;
	background: #fafafa;
}

.wprb-policy-modal__title {
	flex: 1 1 auto;
	font-size: 15px;
	font-weight: 600;
	color: #222;
}

.wprb-policy-modal__external {
	font-size: 13px;
	color: #555;
}

.wprb-policy-modal__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #efefef;
	font-size: 22px;
	line-height: 1;
	color: #333;
	cursor: pointer;
}

.wprb-policy-modal__close:hover,
.wprb-policy-modal__close:focus {
	background: #e0e0e0;
}

.wprb-policy-modal__frame {
	flex: 1 1 auto;
	width: 100%;
	border: 0;
}

@media (max-width: 600px) {

	.wprb-policy-modal__external {
		display: none;
	}
}

/*
 * The header button that offers the installation again.
 *
 * A browser proposes an app once and never returns to it on its own, and the
 * dialog stores a refusal so that it stays closed as well: without this button
 * a no is final. Hidden until the script confirms there is something to offer,
 * so it never appears on a phone that already runs the app.
 */
#wprb-booking-modal .wprb-install-app {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 7px 14px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

#wprb-booking-modal .wprb-install-app.is-ready {
    display: inline-flex;
}

#wprb-booking-modal .wprb-install-app:active {
    background: rgba(255, 255, 255, 0.35);
}
