/**
 * The management application's own page.
 *
 * WHAT THIS FILE IS AND IS NOT
 * ----------------------------
 * It is the document around the dashboards: the sign-in card, the bar across
 * the top, and a small set of WordPress class names the dashboards borrow.
 *
 * It is NOT a restyle of the dashboards. They have their own stylesheets, they
 * are scoped to their own wrapper classes, and they were correct before this
 * application existed. Anything here that reached inside them would be a second
 * opinion about how a table should look, and two opinions is how a design
 * system stops being one.
 *
 * WHY THE WORDPRESS CLASSES ARE REDRAWN RATHER THAN IMPORTED
 * ----------------------------------------------------------
 * The dashboards use `.button`, `.widefat` and `.notice`, which wp-admin
 * supplies. Loading wp-admin's stylesheet to get them would bring WordPress's
 * entire visual identity onto a page whose whole purpose is not to be
 * WordPress — its blues, its greys, its button shapes. So the handful that are
 * actually used are drawn here instead, in this application's language.
 *
 * @package LodgeStay_PMS
 */

/* ============================================================== tokens ==== */

.lspms-manage {
	/*
	 * The accent and its ink are written into the page by PHP, from the
	 * business being shown — teal for the lodge, indigo for the hostel, green
	 * for the group. Everything below reads them, so the page takes on the
	 * identity of whichever business somebody is in without a second
	 * stylesheet per business.
	 */
	--lspms-ground:   #eef1f1;
	--lspms-surface:  #ffffff;
	--lspms-sunken:   #f4f6f6;
	--lspms-line:     #dde3e3;
	--lspms-ink-1:    #16211f;
	--lspms-ink-2:    #4a5654;
	--lspms-ink-3:    #74807e;
	--lspms-danger:   #a3402a;
	--lspms-danger-bg:#f9e9e4;
	--lspms-good:     #146b45;
	--lspms-good-bg:  #e3f2ea;

	--lspms-radius:   6px;
	--lspms-bar:      56px;

	background: var(--lspms-ground);
	color: var(--lspms-ink-1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	margin: 0;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}

.lspms-manage *,
.lspms-manage *::before,
.lspms-manage *::after { box-sizing: border-box; }

.lspms-manage a { color: var(--lspms-manage-accent); }

.lspms-manage :focus-visible {
	outline: 2px solid var(--lspms-manage-accent);
	outline-offset: 2px;
}

/* ============================================================ the door ==== */

/*
 * The sign-in page. Deliberately one card on a plain ground and nothing else:
 * somebody arriving here has exactly one thing to do, and every other element
 * on the page is something for them to read before they can do it.
 */
.lspms-manage--entry {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.lspms-entry {
	width: 100%;
	max-width: 400px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	align-items: center;
}

.lspms-entry__card {
	width: 100%;
	background: var(--lspms-surface);
	border: 1px solid var(--lspms-line);
	border-radius: var(--lspms-radius);
	padding: 32px 28px;
	box-shadow: 0 1px 2px rgba(22, 33, 31, 0.04), 0 8px 24px rgba(22, 33, 31, 0.06);
}

.lspms-entry__mark {
	width: 44px;
	height: 44px;
	margin: 0 auto 16px;
	border-radius: var(--lspms-radius);
	background: var(--lspms-manage-accent);
	color: #fff;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lspms-entry__name {
	margin: 0 0 2px;
	font-size: 1.2rem;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-wrap: balance;
}

.lspms-entry__what {
	margin: 0 0 24px;
	font-size: 0.86rem;
	color: var(--lspms-ink-3);
	text-align: center;
}

.lspms-entry__notice,
.lspms-entry__error {
	margin: 0 0 18px;
	padding: 10px 12px;
	border-radius: var(--lspms-radius);
	font-size: 0.88rem;
	line-height: 1.45;
}

.lspms-entry__notice {
	background: var(--lspms-good-bg);
	color: var(--lspms-good);
}

/*
 * A mark as well as a colour, because a message that is only red is a message
 * that says nothing to somebody who cannot see red.
 */
.lspms-entry__error {
	background: var(--lspms-danger-bg);
	color: var(--lspms-danger);
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.lspms-entry__errormark {
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--lspms-danger);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.lspms-entry__form { margin: 0; }

.lspms-entry__field { margin: 0 0 16px; }

.lspms-entry__field label {
	display: block;
	margin-bottom: 5px;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--lspms-ink-2);
}

.lspms-entry__field input[type="text"],
.lspms-entry__field input[type="email"],
.lspms-entry__field input[type="password"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--lspms-line);
	border-radius: var(--lspms-radius);
	background: var(--lspms-surface);
	color: var(--lspms-ink-1);
	font: inherit;
	font-size: 1rem; /* 16px: anything smaller makes iOS zoom on focus. */
}

/*
 * The address an invited person will sign in with. Shown so they know which of
 * their mailboxes it is, and not editable: it is the address the invitation was
 * sent to, and letting them change it here would let them accept somebody
 * else's invitation as themselves.
 */
.lspms-entry__field input[readonly] {
	background: var(--lspms-sunken);
	color: var(--lspms-ink-2);
	cursor: default;
}

/* The one-line note under a field: what the rule is, before it is broken. */
.lspms-entry__hint {
	display: block;
	margin: 6px 0 0;
	color: var(--lspms-ink-2);
	font-size: 0.8125rem;
}

.lspms-entry__field input:focus {
	border-color: var(--lspms-manage-accent);
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lspms-manage-accent) 18%, transparent);
}

/*
 * The checkbox row. It carries its own bottom margin because the label inside
 * it is one line rather than a label above a control, so the rhythm of the
 * fields above would otherwise close up here.
 */
.lspms-entry__field--check { margin-bottom: 22px; }

.lspms-entry__field--check label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	font-size: 0.86rem;
	color: var(--lspms-ink-2);
}

.lspms-entry__field--check input { margin: 0; }

.lspms-entry__go {
	display: block;
	width: 100%;
	padding: 11px 16px;
	border: 0;
	border-radius: var(--lspms-radius);
	background: var(--lspms-manage-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.lspms-entry__go:hover,
.lspms-entry__go:focus { background: var(--lspms-manage-ink); color: #fff; }

.lspms-entry__actions { margin: 20px 0 0; }

.lspms-entry__help {
	margin: 20px 0 0;
	font-size: 0.8rem;
	line-height: 1.5;
	color: var(--lspms-ink-3);
	text-align: center;
}

.lspms-entry .lspms-credit { text-align: center; }

/* ============================================================= the bar ==== */

.lspms-manage__bar {
	display: flex;
	align-items: center;
	gap: 16px;
	height: var(--lspms-bar);
	padding: 0 16px;
	background: var(--lspms-manage-ink);
	color: #fff;
	position: sticky;
	top: 0;
	z-index: 40;
}

.lspms-manage__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.lspms-manage__mark {
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.16);
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 28px;
	text-align: center;
}

.lspms-manage__brandtext {
	font-weight: 600;
	font-size: 0.94rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/*
 * The business switcher. Shown only to somebody with more than one business,
 * so it is never a row of doors that refuse you.
 */
.lspms-manage__switch {
	display: flex;
	gap: 2px;
	padding: 3px;
	border-radius: var(--lspms-radius);
	background: rgba(255, 255, 255, 0.12);
	margin-left: auto;
}

.lspms-manage__switchlink {
	padding: 5px 12px;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.82rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.lspms-manage__switchlink:hover,
.lspms-manage__switchlink:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* The current business is filled, not merely brighter: shape, not colour alone. */
.lspms-manage__switchlink.is-current {
	background: #fff;
	color: var(--lspms-manage-ink);
}

.lspms-manage__who {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
	min-width: 0;
}

/*
 * When the switcher is present it has already taken the auto margin, so the
 * person's name sits beside it rather than being pushed to a second row.
 */
.lspms-manage__switch ~ .lspms-manage__who { margin-left: 0; }

.lspms-manage__whoname {
	font-size: 0.85rem;
	color: rgba(255, 255, 255, 0.88);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lspms-manage__out {
	padding: 5px 10px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 4px;
	color: #fff;
	font-size: 0.8rem;
	text-decoration: none;
	white-space: nowrap;
}

.lspms-manage__out:hover,
.lspms-manage__out:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }

.lspms-manage__body { min-height: calc(100vh - var(--lspms-bar)); }

@media (max-width: 600px) {
	.lspms-manage__bar {
		height: auto;
		flex-wrap: wrap;
		gap: 10px;
		padding: 10px 12px;
	}

	.lspms-manage__brandtext { font-size: 0.88rem; }
	.lspms-manage__whoname { display: none; }

	.lspms-manage__switch,
	.lspms-manage__switch ~ .lspms-manage__who { margin-left: auto; }
}

/* ================================================ what wp-admin supplied ==== */

/*
 * These are WordPress's class names, drawn in this application's language.
 * Only the ones the dashboards actually use are here — a compatibility layer
 * that grows to cover everything is just wp-admin's stylesheet with extra
 * steps.
 */

.lspms-manage .button,
.lspms-manage .button-primary,
.lspms-manage .button-secondary {
	display: inline-block;
	padding: 7px 14px;
	border: 1px solid var(--lspms-line);
	border-radius: 5px;
	background: var(--lspms-surface);
	color: var(--lspms-ink-1);
	font: inherit;
	font-size: 0.86rem;
	font-weight: 500;
	line-height: 1.35;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	vertical-align: middle;
}

.lspms-manage .button:hover,
.lspms-manage .button:focus { background: var(--lspms-sunken); }

.lspms-manage .button-primary {
	border-color: transparent;
	background: var(--lspms-manage-accent);
	color: #fff;
	font-weight: 600;
}

.lspms-manage .button-primary:hover,
.lspms-manage .button-primary:focus { background: var(--lspms-manage-ink); color: #fff; }

.lspms-manage .button-small { padding: 4px 9px; font-size: 0.8rem; }

.lspms-manage .button-link-delete {
	border-color: transparent;
	background: none;
	color: var(--lspms-danger);
}

.lspms-manage .button-link-delete:hover,
.lspms-manage .button-link-delete:focus {
	background: var(--lspms-danger-bg);
	color: var(--lspms-danger);
}

.lspms-manage .button:disabled,
.lspms-manage .button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.lspms-manage .widefat {
	width: 100%;
	border-collapse: collapse;
	background: var(--lspms-surface);
}

.lspms-manage .widefat th,
.lspms-manage .widefat td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--lspms-line);
	text-align: left;
	vertical-align: top;
}

.lspms-manage .widefat th {
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--lspms-ink-3);
	background: var(--lspms-sunken);
	white-space: nowrap;
}

.lspms-manage .notice {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-left: 3px solid var(--lspms-line);
	border-radius: 0 var(--lspms-radius) var(--lspms-radius) 0;
	background: var(--lspms-sunken);
	font-size: 0.9rem;
}

.lspms-manage .notice-error { border-left-color: var(--lspms-danger); background: var(--lspms-danger-bg); }
.lspms-manage .notice-success { border-left-color: var(--lspms-good); background: var(--lspms-good-bg); }
.lspms-manage .notice-warning { border-left-color: #8a6410; background: #f9f1de; }
.lspms-manage .notice p { margin: 0; }

.lspms-manage .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.lspms-manage .regular-text { width: 100%; max-width: 25em; }

/*
 * wp-admin puts a wrapper around every screen and the dashboards inherit a
 * little spacing from it. Supplied here so they are not flush against the
 * window edge.
 */
.lspms-manage .wrap { margin: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
	.lspms-manage * { transition: none !important; animation: none !important; }
}
