/**
 * Unified modal - the ONE modal pattern for all frontend and admin modals.
 *
 * Structure:
 *   .od-modal-overlay          - fixed backdrop, hidden by default
 *     .od-modal                - white card (flex column, scrollable)
 *       .od-modal-header       - title + close button
 *       .od-modal-body         - scrollable content area
 *
 * Visibility:
 *   Add/remove .od-modal-visible on the overlay.
 *
 * Variants:
 *   .od-modal--accent          - purple header, no padding on .od-modal,
 *                                 padding on each child instead.
 *
 * Consumers must NOT invent new modal structures. Feature-specific
 * styling goes on feature-prefixed classes (.od-pa-*, .od-bp-*, etc.)
 * placed INSIDE the standard modal structure.
 *
 * @package OpenDoors
 */

/* ── Overlay ─────────────────────────────────────────────────────────── */

.od-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.5);
	align-items: center;
	justify-content: center;
}
.od-modal-overlay.od-modal-visible {
	display: flex;
}

/* ── Modal box ───────────────────────────────────────────────────────── */

.od-modal {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
	width: 90%;
	max-width: 640px;
	max-height: 85vh;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.od-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
	flex-shrink: 0;
}
.od-modal-header h3 {
	margin: 0;
	font-size: 1.2rem;
}

/* ── Close button (header X) ─────────────────────────────────────────── */

.od-modal-close {
	background: none;
	border: none;
	cursor: pointer;
	line-height: 1;
	padding: 0.25rem;
	color: #666;
}
.od-modal-close:hover {
	color: #000;
}
.od-modal-close .material-icons {
	font-size: 22px;
}

/* ── Body (scrollable content) ───────────────────────────────────────── */

.od-modal-body {
	overflow-y: auto;
	flex: 1 1 auto;
}

/* ── Paragraph default ───────────────────────────────────────────────── */

.od-modal p {
	font-size: 16px;
}

/* ── Status area (used by export / publish / bulk) ───────────────────── */

.od-modal-status {
	margin-bottom: 1rem;
	font-size: 0.9rem;
	color: #333;
}

/* Shared headings for publish-channel / publish-timing blocks in modals. */
.od-publish-section-label {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--od-color-dark-gray, #3B4037);
}
legend.od-publish-section-label {
	float: left;
	width: 100%;
}

/* ── Actions bar (used by export / publish / bulk) ───────────────────── */

.od-modal-actions {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
}
.od-modal-actions a,
.od-modal-actions button {
	padding: 0.4rem 1.2rem;
	border: none;
	border-radius: 4px;
	font-size: 0.85rem;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
	min-width: 6rem;
	box-sizing: border-box;
}

/* ── Secondary close button (inside actions) ─────────────────────────── */

.od-modal-close-btn {
	background: #e8e8e8;
	color: #333;
}
.od-modal-close-btn:hover {
	background: #ddd;
}

/* ── Inline validation error (rendered inside the modal body, above .od-modal-actions) ─ */

.od-modal-error {
	margin: 0 0 0.75rem;
	padding: 0.5rem 0.75rem;
	background: #fdecea;
	border-left: 3px solid var(--od-color-wwl-red, #c01f1c);
	color: #5a1413;
	font-size: 0.85rem;
	border-radius: 2px;
}
.od-modal-error[hidden] {
	display: none;
}

/* ── Export ratio picker ──────────────────────────────────────────────── */

.od-export-ratio-picker {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #e0e0e0;
	background: #faf8f5;
}
.od-export-ratio-label {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: #333;
}
.od-export-ratio-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
}
.od-export-ratio-option {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.8rem;
	color: #444;
	cursor: pointer;
	white-space: nowrap;
}
.od-export-ratio-option input[type="checkbox"] {
	margin: 0;
	cursor: pointer;
}

/* Start Export button (shown with ratio picker) */
.od-export-start-btn {
	background: var(--od-color-purple);
	color: #fff;
}
.od-export-start-btn:hover {
	background: var(--od-color-purple-dark);
}

/* Download ZIP button */
.od-export-download-btn {
	display: inline-block;
	padding: 0.4rem 1.2rem;
	background: var(--od-color-purple);
	color: #fff !important;
	border: none;
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.85rem;
	cursor: pointer;
}
.od-export-download-btn:hover {
	background: var(--od-color-purple-dark);
}

/* ═══════════════════════════════════════════════════════════════════════
   Accent variant - colored (purple) header
   ═══════════════════════════════════════════════════════════════════════ */

.od-modal--accent {
	padding: 0;
}
.od-modal--accent .od-modal-header {
	padding: 0.75rem 1.25rem;
	margin-bottom: 0;
	background: var(--od-color-purple);
	color: #fff;
	border-radius: 8px 8px 0 0;
}
.od-modal--accent .od-modal-header h3 {
	color: #fff;
}
.od-modal--accent .od-modal-close {
	color: #fff;
}
.od-modal--accent .od-modal-close:hover {
	opacity: 0.7;
	color: #fff;
}
.od-modal--accent .od-modal-body {
	padding: 1rem 1.25rem 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   Info modal - button, video, picker (consumed by od-info-modal.js)
   ═══════════════════════════════════════════════════════════════════════ */

/* Help icon button */
.od-info-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	margin: 0 0.25rem;
	color: var(--od-color-purple);
	vertical-align: middle;
	line-height: 1;
	transition: color 0.15s;
}
.od-info-btn:hover,
.od-info-btn:focus {
	color: #000;
	background: transparent;
	outline: none;
}
.od-info-btn .material-icons {
	font-size: 20px;
}

/* Nav bar variant */
.od-info-btn--nav {
	color: var(--od-color-purple);
}

/* Video embed */
.od-info-video {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 */
	margin-bottom: 1rem;
	border-radius: 4px;
	overflow: hidden;
	background: #000;
}
/* When body text precedes the video, add a gap between them. */
.od-info-content + .od-info-video {
	margin-top: 1rem;
}
.od-info-video iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Text content */
.od-info-content p:first-child {
	margin-top: 0;
}
.od-info-content p:last-child {
	margin-bottom: 0;
}

/* Picker (multi-entry slugs) */
.od-info-picker {
	list-style: none;
	margin: 0;
	padding: 0;
}
.od-info-picker li {
	margin-bottom: 0.35rem;
}
.od-info-picker-btn {
	display: block;
	color: #fff;
	width: 100%;
	text-align: left;
	padding: 0.65rem 0.9rem;
	background: var(--accent);
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.95rem;
	transition: background 0.15s;
}
.od-info-picker-btn:hover {
	color: #222;
	background: #e9e9e9;
}

/* Header heading acts as "Back to help index" when a topic is open. */
.od-modal-header h3.od-modal-title-back {
	cursor: pointer;
	user-select: none;
}
.od-modal-header h3.od-modal-title-back:hover,
.od-modal-header h3.od-modal-title-back:focus {
	text-decoration: underline;
	outline: none;
}

/* Entry title shown at the top of the body when navigated from the picker. */
.od-info-entry-title {
	margin: 0 0 0.75rem;
	font-size: 1.1rem;
	font-weight: 700;
}

/* Pre-rendered GF slots live in the footer until JS mounts them in the modal. */
.od-info-gf-stash {
	display: none !important;
}

/* Gravity Forms inside help / info modals (rendered in .od-modal-body, not #main). */
.od-modal-body .gfield_description {
	margin: 0;
	padding: 0;
}
.od-modal-body .gfield_label,
.od-modal-body .gform-field-label {
	margin: 0 0 5px 0;
	padding: 0;
}
.od-modal-body .gfield {
	margin-bottom: 1rem;
}
.od-modal-body .gfield input,
.od-modal-body .gfield textarea,
.od-modal-body .gfield select {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	border-radius: 10px;
	border: 1px solid #ccc;
	background-color: #fff;
}
.od-modal-body .gfield textarea {
	min-height: 8rem;
	resize: vertical;
}
.od-modal-body .gfield input:focus,
.od-modal-body .gfield textarea:focus,
.od-modal-body .gfield select:focus {
	outline: none;
	border-color: var(--od-color-purple, #6B3267);
}
.od-modal-body .gfield p,
.od-modal-body .gfield p a {
	font-size: 15px;
	margin: 0;
}
.od-modal-body .gform_required_legend {
	display: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   Show Original - content-specific classes inside .od-modal-body
   ═══════════════════════════════════════════════════════════════════════ */

.od-show-original-title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	color: #1e1e1e;
}

.od-show-original-excerpt {
	margin: 8px 0 0;
	font-size: 14px;
	font-weight: 700;
	font-style: italic;
	color: #555;
}

.od-show-original-featured {
	margin: 12px 0 0;
}
.od-show-original-featured img {
	max-width: 100%;
	height: auto;
	border-radius: 4px;
}
.od-show-original-caption {
	margin: 6px 0 0;
	padding: 4px 8px;
	font-size: 13px;
	line-height: 1.4;
	color: #757575;
	font-style: italic;
	background: #f0f0f0;
}

/* Body typography for rendered WP content */
.od-show-original-content {
	margin-top: 16px;
	font-size: 16px;
	line-height: 1.7;
	color: #1e1e1e;
}
.od-show-original-content p,
.od-show-original-content li {
	font-size: 16px;
	line-height: 1.7;
	margin: 0 0 1em;
}
.od-show-original-content ul,
.od-show-original-content ol {
	margin: 0 0 1em;
	padding-left: 1.5em;
}
.od-show-original-content li {
	margin: 0 0 0.35em;
}
.od-show-original-content h1,
.od-show-original-content h2,
.od-show-original-content h3,
.od-show-original-content h4,
.od-show-original-content h5,
.od-show-original-content h6 {
	margin: 1.5em 0 0.5em;
	line-height: 1.3;
	color: #1e1e1e;
}
.od-show-original-content h2 { font-size: 1.4em; }
.od-show-original-content h3 { font-size: 1.2em; }
.od-show-original-content h4 { font-size: 1.05em; }
.od-show-original-content blockquote {
	margin: 0 0 1em;
	padding: 0.5em 1em;
	border-left: 3px solid var(--od-color-purple);
	color: #555;
	font-style: italic;
}
.od-show-original-content img {
	max-width: 100%;
	height: auto;
}
.od-show-original-content figcaption,
.od-show-original-content .wp-element-caption,
.od-show-original-content .wp-caption-text {
	font-size: 13px;
	line-height: 1.4;
	color: #757575;
	font-style: italic;
	margin: 6px 0 1em;
	padding: 4px 8px;
	background: #f0f0f0;
}
.od-show-original-content figure {
	margin: 0 0 1em;
}
.od-show-original-content a {
	color: var(--od-color-purple);
}
