/* ------------------------------------------------------------------ *
 * New-password dialog
 *
 * Injected into <body> by assets/js/admin.js, so it lives outside both the
 * front-end desk wrapper and the wp-admin page wrapper and carries its own
 * colours. Loaded by the desk and by the wp-admin panel alike.
 * ------------------------------------------------------------------ */

.smartmail-modal {
	position: fixed;
	inset: 0;
	z-index: 160000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(0, 0, 0, 0.55);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	overflow-y: auto;
}

/*
 * Themes routinely set `display` on elements like `section` or `div`, which
 * beats the browser default for [hidden] and leaves dialogs stuck open.
 * !important is the reliable fix here.
 */
.smartmail-modal[hidden] { display: none !important; }

/* Stop the page behind a dialog from scrolling. */
body.smartmail-modal-open { overflow: hidden; }

.smartmail-modal-box {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	padding: 1.5rem;
	border-radius: 12px;
	background: #fff;
	color: #1d2327;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
	text-align: center;
}

/* The wider variant carries forms and lists, so it reads left-aligned. */
.smartmail-modal-box-wide { max-width: 660px; text-align: left; }

.smartmail-modal-box *,
.smartmail-modal-box *::before,
.smartmail-modal-box *::after { box-sizing: border-box; }

/*
 * Inherit rather than let the host theme colour headings and text inside the
 * dialog — a theme rule on `h3` beats our inherited colour and renders the
 * section titles invisible.
 */
.smartmail-modal-box h1,
.smartmail-modal-box h2,
.smartmail-modal-box h3,
.smartmail-modal-box h4,
.smartmail-modal-box label,
.smartmail-modal-box strong,
.smartmail-modal-box li { color: inherit; }

.smartmail-modal-title {
	margin: 0 0 0.35rem;
	padding: 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}
.smartmail-modal-address { margin: 0 0 0.75rem; font-size: 0.95rem; word-break: break-all; }
.smartmail-modal-intro { margin: 0 0 1rem; font-size: 0.85rem; color: #646970; line-height: 1.45; }

.smartmail-modal-close {
	position: absolute;
	top: 0.5rem;
	right: 0.6rem;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	background: none;
	color: #646970;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	border-radius: 6px;
}
.smartmail-modal-close:hover { background: rgba(0, 0, 0, 0.06); color: #1d2327; }

/* --- report facts inside the dialog --- */

.smartmail-modal-box .smartmail-report-facts {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.4rem 1rem;
	font-size: 0.9rem;
	color: #646970;
}
.smartmail-modal-box .smartmail-report-facts strong {
	font-size: 1.05rem;
	margin-right: 0.25rem;
	color: #1d2327;
}
.smartmail-modal-box .smartmail-hint {
	display: block;
	margin: 0.5rem 0 0;
	font-size: 0.8rem;
	color: #646970;
	line-height: 1.45;
}
.smartmail-modal-box .smartmail-modal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin: 0;
}

/* The create form supplies its own panel chrome on the desk; inside a dialog
   the box already provides it. */
.smartmail-modal-box .smartmail-create {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
}
.smartmail-modal-box .smartmail-create h3 { margin-bottom: 0.35rem; }

/* Which mailbox the staff-details dialog is editing. */
.smartmail-details-address {
	margin: 0 0 1rem;
	padding: 0.5rem 0.7rem;
	border-radius: 8px;
	background: #f6f7f7;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9rem;
	word-break: break-all;
}
.smartmail-modal--dark .smartmail-details-address { background: #262c32; }

.smartmail-modal-pw {
	display: flex;
	align-items: stretch;
	margin-bottom: 1rem;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	overflow: hidden;
	background: #f6f7f7;
}
.smartmail-modal-code {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.7rem 0.75rem;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1rem;
	letter-spacing: 0.02em;
	text-align: left;
	word-break: break-all;
	background: none;
	color: #1d2327;
	/* One click selects the whole password. */
	user-select: all;
}
.smartmail-modal-copy {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	min-width: 46px;
	padding: 0 0.75rem;
	border: 0;
	border-left: 1px solid #dcdcde;
	background: #fff;
	color: #2271b1;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.12s ease;
}
.smartmail-modal-copy:hover { background: #f0f6fc; }
.smartmail-modal-copy.is-copied { color: #00844a; }

.smartmail-modal-warn {
	margin: 0 0 1rem;
	padding: 0.6rem 0.75rem;
	border-left: 3px solid #bd8600;
	border-radius: 4px;
	background: #fcf9e8;
	color: #674e00;
	font-size: 0.85rem;
	text-align: left;
	line-height: 1.45;
}

.smartmail-modal-actions { margin: 0; }

/*
 * Dark presentation is opt-in only (theme="dark" on the shortcode), never
 * taken from prefers-color-scheme: that reports the visitor OS preference,
 * not the background the theme actually paints, and guessing wrong makes the
 * dialog unreadable.
 */
.smartmail-modal--dark .smartmail-modal-box { background: #1e2429; color: #e9eaeb; }
.smartmail-modal--dark .smartmail-modal-intro,
.smartmail-modal--dark .smartmail-modal-close { color: #a7acb1; }
.smartmail-modal--dark .smartmail-modal-close:hover { background: rgba(255,255,255,0.08); color: #e9eaeb; }
.smartmail-modal--dark .smartmail-modal-pw { border-color: #3a4149; background: #262c32; }
.smartmail-modal--dark .smartmail-modal-code { color: #e9eaeb; }
.smartmail-modal--dark .smartmail-modal-copy { background: #1e2429; border-left-color: #3a4149; color: #5aa0dd; }
.smartmail-modal--dark .smartmail-modal-copy:hover { background: #262c32; }
.smartmail-modal--dark .smartmail-modal-warn { background: #2e2818; border-left-color: #e0b649; color: #e9d9a6; }
.smartmail-modal--dark .smartmail-modal-box .smartmail-report-facts { color: #a7acb1; }
.smartmail-modal--dark .smartmail-modal-box .smartmail-report-facts strong { color: #e9eaeb; }
.smartmail-modal--dark .smartmail-modal-box .smartmail-hint { color: #a7acb1; }
