/* =============================================================================
 * Dashboard / Submit shortcodes — frontend styles
 *
 * Scoped under .rmaps-dash so the rules don't leak into surrounding theme
 * elements. Two top-level variants:
 *   .rmaps-dash--auth   — login / register / lostpassword / resetpassword
 *                        (centered card on a neutral background)
 *   .rmaps-dash--submit — submit form (full-width)
 *   (no modifier)      — logged-in dashboard (header + tabs + body)
 *
 * Colour palette mirrors the rest of the plugin:
 *   primary   #2271b1 (WordPress blue)
 *   text-dark #1e293b
 *   text-base #475569
 *   text-mute #6b7280
 *   border    #d1d5db / #e5e7eb
 *   bg        #f9fafb
 * ========================================================================= */

.rmaps-dash {
	max-width: 1100px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
	color: #1e293b;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
}
.rmaps-dash *,
.rmaps-dash *::before,
.rmaps-dash *::after { box-sizing: border-box; }

/* ----- Header (logged-in) ----- */
.rmaps-dash__header {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	margin-bottom: 16px;
}
.rmaps-dash__user { display: flex; align-items: center; gap: 12px; }
.rmaps-dash__avatar { border-radius: 50%; }
.rmaps-dash__user-name { font-weight: 600; }
.rmaps-dash__user-email { color: #6b7280; font-size: 13px; }
.rmaps-dash__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----- Buttons -----
 * Each button-like element ends up either a <button> or an <a>. For
 * anchors WP themes routinely apply rules like `a:hover { color: ... }`
 * with specificity (0,1,1) — same as a plain `.rmaps-dash__btn:hover`,
 * so cascade order decides and themes load AFTER our stylesheet,
 * winning by default. Defensive solution: every button selector below
 * is compounded with `a` (specificity becomes (0,1,1) + type = (0,1,2))
 * AND every state is enumerated explicitly so visited / focus links
 * can't drift into a different color. Same trick used for tabs and
 * link-title cells below.
 *
 * `button` and `input[type=submit]` variants don't suffer the link-color
 * problem (themes don't usually style their hover color), so the plain
 * .rmaps-dash__btn rule still applies to them. The `a.rmaps-dash__btn`
 * overrides are additive — same colors, just bulletproof against
 * link-color overrides. */
.rmaps-dash__btn,
a.rmaps-dash__btn,
a.rmaps-dash__btn:link,
a.rmaps-dash__btn:visited {
	display: inline-block;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	color: #1e293b;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.12s, border-color 0.12s, color 0.12s;
	line-height: 1.4;
}
.rmaps-dash__btn:hover,
.rmaps-dash__btn:focus,
a.rmaps-dash__btn:hover,
a.rmaps-dash__btn:focus,
a.rmaps-dash__btn:active {
	background: #f3f4f6;
	border-color: #9ca3af;
	color: #1e293b;
	text-decoration: none;
}

/* Primary button — colors come from the admin Customization tab via
 * --rmaps-button-primary / --rmaps-button-secondary / --rmaps-button-text
 * (see classes/settings/css_vars.php). The fallbacks match the
 * historical default palette so the button still renders correctly if
 * the vars block somehow didn't emit. */
.rmaps-dash__btn--primary,
a.rmaps-dash__btn--primary,
a.rmaps-dash__btn--primary:link,
a.rmaps-dash__btn--primary:visited {
	background: var(--rmaps-button-primary, #2271b1);
	border-color: var(--rmaps-button-primary, #2271b1);
	color: var(--rmaps-button-text, #ffffff);
}
/* Hover/focus/active: only the BACKGROUND swaps to the secondary color;
 * text stays at --rmaps-button-text on every state (admin's "Button text
 * color" applies always — themes can't sneak their link-hover color in). */
.rmaps-dash__btn--primary:hover,
.rmaps-dash__btn--primary:focus,
a.rmaps-dash__btn--primary:hover,
a.rmaps-dash__btn--primary:focus,
a.rmaps-dash__btn--primary:active {
	background: var(--rmaps-button-secondary, #185a8d);
	border-color: var(--rmaps-button-secondary, #185a8d);
	color: var(--rmaps-button-text, #ffffff);
}
.rmaps-dash__btn--block { display: block; width: 100%; text-align: center; }

/* ----- Tabs ----- */
.rmaps-dash__tabs {
	display: flex;
	gap: 2px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 16px;
}
/* Tabs — same anchor-vs-theme defence as buttons above. */
.rmaps-dash__tab,
a.rmaps-dash__tab,
a.rmaps-dash__tab:link,
a.rmaps-dash__tab:visited {
	padding: 10px 18px;
	color: #6b7280;
	background: transparent;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: 6px 6px 0 0;
	cursor: pointer;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: color 0.12s, background 0.12s, border-color 0.12s;
	position: relative;
	top: 1px;
}
.rmaps-dash__tab:hover,
.rmaps-dash__tab:focus,
a.rmaps-dash__tab:hover,
a.rmaps-dash__tab:focus { color: #1e293b; background: #f9fafb; text-decoration: none; }
.rmaps-dash__tab.is-active,
a.rmaps-dash__tab.is-active,
a.rmaps-dash__tab.is-active:hover,
a.rmaps-dash__tab.is-active:focus {
	color: var(--rmaps-primary, #2271b1);
	background: #fff;
	border-color: #e5e7eb;
}

/* ----- Flash messages ----- */
.rmaps-dash-messages { margin-bottom: 16px; }
.rmaps-dash-msg {
	padding: 10px 14px;
	border: 1px solid;
	border-radius: 6px;
	margin-bottom: 8px;
	font-size: 13px;
}
.rmaps-dash-msg--success {
	background: #ecfdf5;
	border-color: #a7f3d0;
	color: #065f46;
}
.rmaps-dash-msg--error {
	background: #fef2f2;
	border-color: #fecaca;
	color: #991b1b;
}
.rmaps-dash-msg--info {
	background: #eff6ff;
	border-color: #bfdbfe;
	color: #1e40af;
}

/* ----- Anonymous-identity section ([webmap-submit] anon flow) -----
 * Sits ABOVE the React listing form when the visitor is logged out
 * AND the admin enabled anonymous submits. Width matches the React
 * form's `max-w-3xl` (=48rem) via the parent `.rmaps-dash--submit`
 * wrapper — same horizontal padding so name/email inputs line up
 * with the form fields below.
 *
 * Visual treatment: subtle card so it stands apart from the React
 * form below but doesn't shout for attention. */
.rmaps-dash__anon-section {
	margin: 0 1rem 1.5rem;
	padding: 1.25rem 1.5rem 1rem;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Required-field asterisk — universal red dot next to the label. */
.rmaps-dash__required { color: #dc2626; font-weight: 700; margin-left: 2px; }

/* ----- Auth cards ----- */
.rmaps-dash--auth { max-width: 420px; }
.rmaps-dash__auth-card {
	padding: 24px 24px 20px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.rmaps-dash__auth-title {
	margin: 0 0 16px 0;
	font-size: 20px;
	font-weight: 600;
	color: #1e293b;
}
.rmaps-dash__auth-links {
	margin-top: 14px;
	font-size: 13px;
	color: #6b7280;
	text-align: center;
}
.rmaps-dash__auth-links a,
.rmaps-dash__auth-links a:link,
.rmaps-dash__auth-links a:visited {
	color: var(--rmaps-links, #2271b1);
	text-decoration: none;
}
.rmaps-dash__auth-links a:hover,
.rmaps-dash__auth-links a:focus,
.rmaps-dash__auth-links a:active {
	color: var(--rmaps-links-hover, #185a8d);
	text-decoration: underline;
}
.rmaps-dash__auth-divider { color: #d1d5db; padding: 0 6px; }

/* ----- Forms ----- */
.rmaps-dash__form { display: flex; flex-direction: column; gap: 12px; }
.rmaps-dash__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.rmaps-dash__field > span {
	font-size: 13px;
	font-weight: 500;
	color: #475569;
}
.rmaps-dash__field input[type="text"],
.rmaps-dash__field input[type="email"],
.rmaps-dash__field input[type="password"] {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #fff;
	font-size: 14px;
	color: #1e293b;
	transition: border-color 0.12s, box-shadow 0.12s;
}
.rmaps-dash__field input:focus {
	outline: none;
	border-color: var(--rmaps-primary, #2271b1);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}
.rmaps-dash__field input:disabled {
	background: #f3f4f6;
	color: #6b7280;
	cursor: not-allowed;
}
.rmaps-dash__check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #475569;
	cursor: pointer;
}
.rmaps-dash__check input { margin: 0; }
.rmaps-dash__hint {
	font-size: 12px;
	color: #6b7280;
	font-style: italic;
	margin: 4px 0 0;
}
.rmaps-dash__fieldset {
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 12px 16px;
	margin: 8px 0;
}
.rmaps-dash__fieldset legend {
	padding: 0 6px;
	font-weight: 600;
	color: #1e293b;
	font-size: 13px;
}

/* ----- Listings table ----- */
.rmaps-dash__table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	font-size: 13px;
}
.rmaps-dash__table th,
.rmaps-dash__table td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid #f3f4f6;
	vertical-align: middle;
}
.rmaps-dash__table th {
	background: #f9fafb;
	font-weight: 600;
	color: #475569;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.4px;
}
.rmaps-dash__table tr:last-child td { border-bottom: none; }
a.rmaps-dash__link-title,
a.rmaps-dash__link-title:link,
a.rmaps-dash__link-title:visited {
	color: var(--rmaps-links, #2271b1);
	text-decoration: none;
	font-weight: 500;
}
a.rmaps-dash__link-title:hover,
a.rmaps-dash__link-title:focus,
a.rmaps-dash__link-title:active {
	color: var(--rmaps-links-hover, #185a8d);
	text-decoration: underline;
}
.rmaps-dash__muted { color: #9ca3af; font-style: italic; }

/* ----- Status badges ----- */
.rmaps-dash__badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	background: #f3f4f6;
	color: #475569;
}
.rmaps-dash__badge--active   { background: #dcfce7; color: #166534; }
.rmaps-dash__badge--publish  { background: #dcfce7; color: #166534; }
.rmaps-dash__badge--expired  { background: #fee2e2; color: #991b1b; }
.rmaps-dash__badge--pending  { background: #fef3c7; color: #92400e; }
.rmaps-dash__badge--draft    { background: #e0e7ff; color: #3730a3; }
.rmaps-dash__badge--unpaid   { background: #fed7aa; color: #9a3412; }
.rmaps-dash__badge--stopped  { background: #f3f4f6; color: #475569; }

/* ----- Pagination ----- */
.rmaps-dash__pagination {
	margin-top: 16px;
	display: flex;
	justify-content: center;
	gap: 4px;
}
.rmaps-dash__pagination .page-numbers {
	padding: 6px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	color: #475569;
	text-decoration: none;
	font-size: 13px;
}
.rmaps-dash__pagination .page-numbers:hover {
	background: #f3f4f6;
	color: #1e293b;
}
.rmaps-dash__pagination .page-numbers.current {
	background: var(--rmaps-button-primary, #2271b1);
	border-color: var(--rmaps-button-primary, #2271b1);
	color: var(--rmaps-button-text, #ffffff);
}

/* ----- Empty state ----- */
.rmaps-dash__empty {
	padding: 48px 24px;
	text-align: center;
	background: #f9fafb;
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	color: #6b7280;
}
.rmaps-dash__empty p { margin: 0 0 16px 0; font-size: 15px; }

/* ----- Detail view (listing) ----- */
.rmaps-dash__detail {
	display: grid;
	grid-template-columns: 1fr 280px;
	gap: 20px;
	align-items: start;
}
@media (max-width: 768px) {
	.rmaps-dash__detail { grid-template-columns: 1fr; }
}
.rmaps-dash__detail-main {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 16px 20px;
}
.rmaps-dash__breadcrumb { margin-bottom: 8px; font-size: 13px; }
.rmaps-dash__breadcrumb a { color: #6b7280; text-decoration: none; }
.rmaps-dash__breadcrumb a:hover { color: #1e293b; }
.rmaps-dash__detail-title {
	margin: 0 0 16px 0;
	font-size: 22px;
	font-weight: 600;
	color: #1e293b;
}
.rmaps-dash__metabox {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 16px;
}
.rmaps-dash__metabox-title {
	margin: 0 0 12px 0;
	font-size: 13px;
	font-weight: 600;
	color: #475569;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	padding-bottom: 8px;
	border-bottom: 1px solid #f3f4f6;
}
.rmaps-dash__metabox-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 8px 0;
	font-size: 13px;
}
.rmaps-dash__metabox-row + .rmaps-dash__metabox-row {
	border-top: 1px solid #f3f4f6;
}
.rmaps-dash__metabox-label {
	color: #6b7280;
	font-weight: 500;
}

/* ----- Submit page -----
 * The React form renders inside its own Tailwind container with
 * `max-w-3xl mx-auto px-4 py-6` (= 48rem / 768px wide, centered, 1rem
 * horizontal padding, 1.5rem top padding). We apply the same width +
 * centering to the outer `.rmaps-dash--submit` wrap so EVERYTHING — the
 * header above and the React form below — sits within one 48rem-wide
 * column on the page. The form's internal `mx-auto` becomes a no-op
 * (already constrained by parent) but its `px-4` still applies — so
 * we mirror that 1rem horizontal padding on the header to keep both
 * content-edges flush.
 *
 * Numbers chosen to match Tailwind utilities so admin and frontend
 * stay visually identical even when admins inspect element classes. */
.rmaps-dash--submit {
	max-width: 48rem;
	margin-left: auto;
	margin-right: auto;
}
.rmaps-dash__submit-header {
	padding: 1.5rem 1rem 0;
	/* Visual breathing room between the title/userline and the next
	 * section (identity card or React form). The form below already
	 * has its own internal `py-6` top padding, but the gap reads
	 * cleaner with an explicit margin here too. */
	margin-bottom: 1.5rem;
}
.rmaps-dash__submit-title {
	margin: 0 0 4px 0;
	font-size: 24px;
	font-weight: 600;
	color: #1e293b;
}
.rmaps-dash__submit-userline {
	font-size: 13px;
	color: #6b7280;
}
.rmaps-dash__submit-userline a,
.rmaps-dash__submit-userline a:link,
.rmaps-dash__submit-userline a:visited {
	color: var(--rmaps-links, #2271b1);
	text-decoration: none;
}
.rmaps-dash__submit-userline a:hover,
.rmaps-dash__submit-userline a:focus,
.rmaps-dash__submit-userline a:active {
	color: var(--rmaps-links-hover, #185a8d);
	text-decoration: underline;
}

/* Friendly error placeholder when a template file is missing. */
.rmaps-dash-error {
	padding: 14px 18px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 6px;
	color: #991b1b;
	font-family: ui-monospace, SFMono-Regular, monospace;
	font-size: 12px;
}

/* ============================================================
   Password fields — strength meter + show/hide + generate + copy
   Used by templates/dashboard/_password_fields.tpl.php on the
   Profile tab and the reset-password form. Inline JS in the
   partial drives behaviour; this stylesheet just renders the
   button row + the meter bar so the whole component reads as
   one unit (input on the left, action chips on the right,
   strength bar below).
   ============================================================ */
.rmaps-pwd__row {
	display: flex;
	gap: 6px;
	align-items: stretch;
}
.rmaps-pwd__input {
	flex: 1 1 auto;
	min-width: 0;
}
.rmaps-pwd__btn {
	flex: 0 0 auto;
	padding: 6px 10px;
	font-size: 12px;
	line-height: 1.2;
	color: #374151;
	background: #f3f4f6;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	cursor: pointer;
}
.rmaps-pwd__btn:hover {
	background: #e5e7eb;
}
.rmaps-pwd__meter {
	margin-top: 6px;
	font-size: 12px;
	color: #6b7280;
}
.rmaps-pwd__meter-bar {
	width: 100%;
	height: 4px;
	background: #e5e7eb;
	border-radius: 2px;
	overflow: hidden;
	margin-bottom: 4px;
}
.rmaps-pwd__meter-bar > span {
	display: block;
	height: 100%;
	width: 0;
	background: transparent;
	transition: width 120ms ease, background 120ms ease;
}
.rmaps-pwd__match {
	margin-top: 4px;
	font-size: 12px;
}


/* Listing-detail metabox: portal target for React submit messages.
 * Inside .rmaps-dash__metabox-row (display:flex), without an explicit
 * width the success/error notices shrink to their content width — that
 * mismatched the full-width "Update listing" button below them and
 * read as a typographic accident. `flex: 1 1 100%` claims the whole
 * row so the notice and button visually align. */
.rmaps-dash__publish-messages {
	flex: 1 1 100%;
}
.rmaps-dash__publish-messages > div {
	box-sizing: border-box;
	width: 100%;
}

/* -----------------------------------------------------------
 * Listing history — audit log rendered inside the side metabox
 * on the listing-detail page. Compact vertical list (one block
 * per event) so it fits a narrow column. The same markup is
 * also injected into a wp-admin metabox in `side` context
 * (W2GM_Listing_Log::render_metabox); admin carries an inline-
 * style fallback so it doesn't depend on dashboard.css. Keep
 * these two style sources in sync.
 * ----------------------------------------------------------- */
/* Top divider + 8 px padding mirrors `.rmaps-dash__metabox-row +
 * .rmaps-dash__metabox-row` exactly so the line above "History"
 * looks identical to every other row separator in the metabox
 * (the same one that appears just above the Update button). */
.rmaps-dash__metabox-history {
	padding: 8px 0;
	border-top: 1px solid #f3f4f6;
}
.rmaps-dash__metabox-subtitle {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.rmaps-dash .rmaps-log__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.rmaps-dash .rmaps-log__item {
	padding: 8px 0;
	border-bottom: 1px solid #f1f5f9;
}
.rmaps-dash .rmaps-log__item:first-child { padding-top: 0; }
.rmaps-dash .rmaps-log__item:last-child  { border-bottom: 0; padding-bottom: 0; }
.rmaps-dash .rmaps-log__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
.rmaps-dash .rmaps-log__when {
	color: #6b7280;
	font-size: 11px;
	white-space: nowrap;
}
.rmaps-dash .rmaps-log__meta {
	margin-top: 3px;
	color: #475569;
	font-size: 12px;
	line-height: 1.4;
}
.rmaps-dash .rmaps-log__badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	background: #e5e7eb;
	color: #1f2937;
	letter-spacing: 0.2px;
}
.rmaps-dash .rmaps-log__event--created            { background: #dbeafe; color: #1e40af; }
.rmaps-dash .rmaps-log__event--activated          { background: #dcfce7; color: #166534; }
.rmaps-dash .rmaps-log__event--renewed            { background: #ccfbf1; color: #0f766e; }
.rmaps-dash .rmaps-log__event--expired            { background: #fee2e2; color: #991b1b; }
.rmaps-dash .rmaps-log__event--expiration_changed { background: #fef3c7; color: #92400e; }
.rmaps-dash .rmaps-log__empty {
	margin: 0;
	color: #6b7280;
	font-style: italic;
	font-size: 12px;
}

