/*
 * Register-page-only rules (spec §5.6).
 *
 * The maroon top banner and its `.banner-note`, `.pcfa-panel`, `.form-grid`,
 * `.field`, `.consent-row`, `.pcfa-hp-field`, `.pcfa-form-message`, `.pcfa-notice`,
 * `.pcfa-empty`, `.pcfa-code`, `.pcfa-price`, `.section-heading-sm`, `.accent-bar`,
 * `.bi-row` and the `.btn` family all live in public.css and are not repeated
 * here.
 *
 * Metrics come from the approved prototype
 * (`/home/claude/work/proto/register.html`): an 820px column, 16px choice cards,
 * a maroon grand-total block and dashed "add another" buttons. Raw hex becomes the
 * semantic tokens and physical properties become logical ones, so the whole flow
 * mirrors in Arabic without a second stylesheet.
 *
 * One structural rule runs through this file: **nothing that the script toggles
 * with the `hidden` attribute is given a `display` value here.** A `display:block`
 * on such an element silently defeats `hidden`, which is how a "hidden" section
 * ends up on screen. `.add-btn` is the one exception and it declares its own
 * `[hidden]` rule below.
 */

.register-section .wrap {
	max-width: 860px;
}

/* ==========================================================================
   1. Window status banner
   ========================================================================== */

.register-status {
	display: inline-block;
	max-width: 640px;
	margin-top: 18px;
	padding: 12px 20px;
	border-radius: var(--radius-sm);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.6;
}

/* Sitting on the maroon banner, both states are a light panel; open reads calm
   and closed reads warm, without importing a green/red pair that appears nowhere
   else in the palette. */
.register-status.is-open {
	background: rgba(255, 255, 255, 0.16);
	color: var(--white);
}

.register-status.is-closed {
	background: #fdf6e3;
	color: #7a4a12;
}

.register-status .ar {
	display: block;
	margin-top: 4px;
}

/* ==========================================================================
   2. Steps, headings and hints
   ========================================================================== */

.register-step {
	margin-bottom: 22px;
}

.register-form .section-heading-sm {
	margin-bottom: 12px;
}

.field-hint {
	margin: 0 0 18px;
	font-size: 12.5px;
	line-height: 1.65;
	color: var(--faint);
}

.field-hint .ar {
	display: block;
	margin-top: 4px;
	color: var(--magenta);
}

/* The two-letter marker that says which language a value goes in — not a label in
   its own right, so it is deliberately quiet. */
.field-lang {
	display: inline-block;
	margin-inline-start: 4px;
	padding: 1px 5px;
	border-radius: 4px;
	background: var(--magenta-50);
	font-size: 9.5px;
	font-weight: 800;
	letter-spacing: 0.06em;
	color: var(--magenta);
	vertical-align: 1px;
}

.register-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 20px;
}

/* ==========================================================================
   3. New versus returning company
   ========================================================================== */

.choice-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.choice-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 22px 20px;
	border: 1.5px solid var(--magenta-100);
	border-radius: var(--radius);
	background: var(--white);
	cursor: pointer;
	transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
		background-color var(--dur) var(--ease);
}

.choice-card:hover {
	border-color: var(--magenta);
	box-shadow: var(--shadow);
}

/* Applied by pages/register.js so the chosen path is obvious after the panel
   below it has scrolled the radio out of sight. */
.choice-card.is-selected {
	border-color: var(--magenta-deep);
	background: var(--magenta-50);
}

.choice-card input[type='radio'] {
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 2px;
	accent-color: var(--magenta-deep);
	cursor: pointer;
}

.choice-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.choice-title {
	font-size: 15px;
	font-weight: 800;
	gap: 10px;
}

.choice-note {
	font-size: 12px;
	line-height: 1.55;
	color: var(--muted);
}

.existing-lookup {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1.5px solid var(--magenta-100);
}

.lookup-row {
	display: flex;
	gap: 10px;
	align-items: stretch;
}

.lookup-row input {
	flex: 1 1 auto;
	min-width: 0;
}

.lookup-row .btn {
	flex: none;
}

.lookup-msg {
	margin: 10px 0 0;
	font-size: 12.5px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--muted);
}

.lookup-msg.is-error {
	color: var(--danger);
}

.lookup-msg.is-success {
	color: var(--magenta-deep);
}

/*
 * The read-only identity check. It carries a name and a masked contact address and
 * nothing else — a returning company's previous perfumes are never listed here
 * (spec §5.6 step 2), which is why there is no list style in this block to grow
 * into one.
 */
.company-summary {
	margin-top: 16px;
	padding: 16px 18px;
	border-radius: var(--radius-sm);
	background: var(--magenta-50);
}

.company-summary .label {
	display: block;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--magenta);
}

.company-summary .name {
	margin: 4px 0 0;
	font-size: 16px;
	font-weight: 800;
}

.company-summary .meta {
	margin: 4px 0 0;
	font-size: 12px;
	color: var(--muted);
}

.register-duplicate {
	margin-bottom: 18px;
}

.register-duplicate .register-duplicate-body {
	margin: 0;
	color: var(--ink);
}

/* ==========================================================================
   4. Growable lists
   ========================================================================== */

.grow-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.grow-row {
	display: flex;
	gap: 8px;
}

.grow-row input {
	flex: 1 1 auto;
	min-width: 0;
}

.grow-remove {
	flex: none;
	width: 42px;
	border: 1.5px solid var(--magenta-100);
	border-radius: 10px;
	background: var(--white);
	color: var(--magenta-deep);
	font-size: 18px;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
}

.grow-remove:hover {
	border-color: var(--magenta);
	background: var(--magenta-50);
}

.grow-add {
	align-self: flex-start;
	margin-top: 8px;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--magenta-deep);
	font-family: inherit;
	font-size: 12px;
	font-weight: 800;
	cursor: pointer;
}

.grow-add:hover {
	color: var(--magenta);
}

/* ==========================================================================
   5. Perfume entry rows
   ========================================================================== */

.entry-rows {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-bottom: 14px;
}

/* A fieldset per row: the legend names the group for a screen reader, and the
   border is what visually separates one perfume from the next. */
.entry-row {
	position: relative;
	margin: 0;
	padding: 18px 20px;
	border: 1.5px solid var(--magenta-100);
	border-radius: 14px;
}

/* The prototype's row-number pill, kept as a real `<legend>` so it is also the
   group's accessible name. A browser that ignores `display:flex` on a legend still
   renders both languages, just stacked. */
.entry-num {
	display: flex;
	gap: 10px;
	padding: 3px 12px;
	border-radius: 999px;
	background: var(--magenta-deep);
	color: var(--white);
	font-size: 11px;
	font-weight: 800;
	margin-inline-start: 4px;
}

.entry-num .ar {
	color: var(--magenta-100);
}

.entry-remove {
	position: absolute;
	top: 10px;
	inset-inline-end: 12px;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--magenta);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.entry-remove:hover {
	background: var(--magenta-50);
	color: var(--magenta-deep);
}

.entry-row .form-grid {
	margin-top: 6px;
}

.entry-row .field-error {
	margin: 0;
}

.entry-row .field-error .ar {
	display: block;
}

/* Dashed and full width, so "add another" reads as an empty slot waiting to be
   filled rather than as the form's primary action. */
.add-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 22px;
	border: 1.5px dashed var(--magenta);
	border-radius: var(--radius-sm);
	background: var(--magenta-50);
	color: var(--magenta-deep);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 800;
	cursor: pointer;
}

.add-btn:hover {
	background: var(--magenta-100);
}

/*
 * The Judges' Excellence cap of three hides this button outright (spec §5.6 step
 * 4). The rule is needed because the `display:inline-flex` above would otherwise
 * override the `hidden` attribute the script sets.
 */
.add-btn[hidden] {
	display: none;
}

.subtotal-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1.5px solid var(--magenta-100);
}

.subtotal-row .label {
	flex: 1 1 auto;
	font-size: 13px;
	font-weight: 700;
	color: var(--muted);
}

.subtotal-row .label .ar {
	color: var(--magenta);
}

.subtotal-row .amount {
	flex: none;
	font-size: 20px;
	font-weight: 900;
	color: var(--magenta-deep);
}

/* ==========================================================================
   6. Judges' Excellence toggle
   ========================================================================== */

.je-toggle {
	align-items: center;
}

/* Size and weight on the row so both halves inherit the same ones (spec §2.5). */
.je-toggle label {
	font-size: 15px;
	font-weight: 800;
}

.je-toggle label .bi-row {
	font-size: inherit;
	font-weight: inherit;
}

.je-toggle .ar {
	font-size: inherit;
	font-weight: inherit;
	color: var(--magenta);
}

.je-optional {
	margin-inline-start: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--faint);
}

.je-body {
	margin-top: 20px;
}

/* ==========================================================================
   7. Totals and payment
   ========================================================================== */

.grand-total {
	margin-bottom: 22px;
	padding: 22px 24px;
	border-radius: var(--radius);
	background: var(--magenta-deep);
	color: var(--white);
}

.grand-total .row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin: 0;
	padding: 5px 0;
	font-size: 13px;
	color: var(--magenta-100);
}

.grand-total .row.final {
	margin-top: 10px;
	padding-top: 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.25);
	font-size: 20px;
	font-weight: 900;
	color: var(--white);
}

.register-terms {
	margin-bottom: 22px;
}

.payment-block {
	margin: 0 0 20px;
	padding: 0;
	border: 0;
}

.payment-block legend {
	margin-bottom: 10px;
	padding: 0;
	width: 100%;
}

.payment-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.payment-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px;
	border: 1.5px solid var(--magenta-100);
	border-radius: var(--radius-sm);
	background: var(--white);
	cursor: pointer;
}

.payment-option:hover {
	border-color: var(--magenta);
}

.payment-option.is-selected {
	border-color: var(--magenta-deep);
	background: var(--magenta-50);
}

.payment-option input[type='radio'] {
	flex: none;
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--magenta-deep);
	cursor: pointer;
}

.payment-label {
	flex: 1 1 auto;
	gap: 10px;
	font-size: 13.5px;
	font-weight: 700;
	min-width: 0;
}

.payment-detail {
	margin-top: 14px;
	padding: 16px 18px;
	border-radius: var(--radius-sm);
	background: var(--magenta-50);
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--muted);
}

.payment-detail .ar {
	margin-top: 6px;
}

.register-submit {
	padding-block: 15px;
	font-size: 14.5px;
}

/* ==========================================================================
   8. Thank you and closed states
   ========================================================================== */

.register-thanks {
	text-align: center;
}

.register-thanks-body,
.register-code-help {
	margin: 0 auto;
	max-width: 56ch;
	font-size: 13.5px;
	line-height: 1.7;
	color: var(--muted);
}

.register-thanks-body .ar,
.register-code-help .ar,
.register-closed-body .ar {
	display: block;
	margin-top: 6px;
	color: var(--magenta);
}

.register-code-box {
	display: inline-block;
	margin: 20px 8px 0;
	padding: 16px 26px;
	border-radius: var(--radius-sm);
	background: var(--magenta-50);
	text-align: center;
}

/* The company code is the credential a returning entrant comes back with, so it
   is the loudest thing on the screen (spec §5.6 step 6). */
.register-code-box.is-primary {
	border: 1.5px solid var(--magenta-deep);
}

.register-code-box .label {
	display: block;
	margin-bottom: 6px;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--magenta);
}

.register-code-box .pcfa-code {
	font-size: 18px;
}

.register-code-box.is-primary .pcfa-code {
	font-size: 22px;
}

.register-code-help {
	margin-top: 18px;
}

.register-closed-body {
	margin: 0 auto;
	max-width: 46ch;
}

@media (max-width: 639px) {
	.choice-row,
	.payment-options {
		grid-template-columns: minmax(0, 1fr);
	}

	.register-step {
		padding: 20px 16px;
	}

	.entry-row {
		padding: 16px 14px;
	}

	.lookup-row {
		flex-direction: column;
	}

	.lookup-row .btn {
		width: 100%;
	}

	.register-actions .btn,
	.register-code-box {
		width: 100%;
	}

	.grand-total {
		padding: 18px 16px;
	}
}
