/**
 * Download Report Modal — Stylesheet
 *
 * Scoped under the .kp-modal-* namespace to avoid collisions with
 * Blocksy or Formidable styles.
 *
 * z-index ladder
 *   Blocksy sticky header .............. up to ~9999
 *   This overlay .......................... 100 000   (safely above)
 *   Modal box is a child of the overlay, so no separate z-index needed.
 *
 * @package KerawaPartners
 */

/* ---------------------------------------------------------------
 * 1. Overlay (full-viewport dark backdrop)
 * ------------------------------------------------------------- */
.kp-modal-overlay {
	position: fixed;
	inset: 0;                           /* top/right/bottom/left: 0 */
	z-index: 100000;                    /* above Blocksy sticky header */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;                      /* breathing room on small screens */
	background-color: rgba( 0, 0, 0, 0.65 );

	/* Visibility toggled via opacity + visibility (avoids display:none
	   which would skip the CSS transition). */
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hidden state — toggled by JS adding/removing .kp-modal--hidden */
.kp-modal-overlay.kp-modal--hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;               /* block clicks while hidden */
}

/* ---------------------------------------------------------------
 * 2. Prevent page scroll while modal is open
 * ------------------------------------------------------------- */
body.kp-modal-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------
 * 3. Modal box
 * ------------------------------------------------------------- */
.kp-modal-box {
	position: relative;
	width: 100%;
	max-width: 680px;
	max-height: 90vh;                   /* never taller than the viewport */
	overflow-y: auto;                   /* scroll if form content is tall */
	background: #ffffff;
	border-radius: 0px;
	padding: 2.5rem 2rem 2rem;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.35 );

	/* Slide micro-animation paired with the overlay fade */
	transform: translateY( 0 );
	transition: transform 0.3s ease;
}

/* Box slides down as the overlay fades out */
.kp-modal-overlay.kp-modal--hidden .kp-modal-box {
	transform: translateY( 16px );
}

/* ---------------------------------------------------------------
 * 4. Close button (×)
 * ------------------------------------------------------------- */
.kp-modal-close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;

	/* Reset browser button defaults */
	appearance: none;
	background: transparent;
	border: none;
	padding: 0.25rem 0.5rem;
	cursor: pointer;
	line-height: 1;
	font-size: 1.75rem;
	color: #555555;
	transition: color 0.2s ease, transform 0.2s ease;
}

.kp-modal-close:hover,
.kp-modal-close:focus {
	color: #111111;
	transform: rotate( 90deg );
	/* Visible focus ring for keyboard users */
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
}

/* ---------------------------------------------------------------
 * 5. Modal heading
 * ------------------------------------------------------------- */
.kp-modal-title {
	/* Right margin prevents text from overlapping the × button */
	margin: 0 2rem 1.25rem 0;
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.2;
	color: #111111;
}

/* ---------------------------------------------------------------
 * 6. Form wrapper
 *
 * We keep overrides minimal so Formidable's own styles (validation
 * messages, multi-step progress, file-upload widgets, etc.) display
 * as intended. Only width and spacing are adjusted.
 * ------------------------------------------------------------- */
.kp-modal-form-wrap {
	width: 100%;
}

/* Full-width inputs inside the modal column */
.kp-modal-form-wrap .frm_form_field input,
.kp-modal-form-wrap .frm_form_field select,
.kp-modal-form-wrap .frm_form_field textarea {
	width: 100%;
	box-sizing: border-box;
}

/* Tighten Formidable's default field spacing inside the modal */
.kp-modal-form-wrap .frm_form_field {
	margin-bottom: 1rem;
}

/* Full-width submit on small screens */
@media ( max-width: 480px ) {
	.kp-modal-form-wrap .frm_submit button,
	.kp-modal-form-wrap .frm_submit input[type="submit"] {
		width: 100%;
	}
}

/* ---------------------------------------------------------------
 * 7. Success / thank-you message (shown after AJAX submission)
 * ------------------------------------------------------------- */
.kp-modal-success {
	padding: 1.5rem;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 6px;
	color: #166534;
	font-size: 1rem;
	line-height: 1.6;
	text-align: center;
}

.kp-modal-success p:last-child {
	margin-bottom: 0;
}

/* ---------------------------------------------------------------
 * 8. Mobile — almost full-width, anchored to bottom of screen
 * ------------------------------------------------------------- */
@media ( max-width: 600px ) {
	.kp-modal-overlay {
		padding: 0.5rem;
		align-items: flex-end;          /* slides up from bottom (native feel) */
	}

	.kp-modal-box {
		border-radius: 12px 12px 0 0;
		padding: 1.75rem 1.25rem 1.5rem;
		max-height: 92vh;
	}

	.kp-modal-title {
		font-size: 1.2rem;
	}
}
