/*
 * DESIGN NOTES (read before changing colors/type):
 *
 * Palette and type are chosen deliberately for this subject — a Chinmaya
 * Gurukul (Hindu spiritual/educational nonprofit) attendance form — not
 * generic SaaS defaults:
 *   - Deep maroon (--caa-maroon) is the one bold, memorable color: the
 *     header band and the primary action button. Keep it to those two
 *     places; don't spread it thin across every element.
 *   - Warm saffron (--caa-saffron) is the secondary accent: links, the
 *     "show other classes" toggle, focus rings, small highlights.
 *   - Muted gold (--caa-gold) is for quiet structural things: borders,
 *     dividers — never large fills.
 *   - Warm ivory (--caa-cream) is the card body background; warm near-
 *     black brown (--caa-ink) is body text instead of pure/tinted black.
 *
 * Typography: "Yatra One" (a display face evoking Indian sign-painting)
 * is used ONLY for the page title in the header band — never for body
 * text, buttons, or labels, since it's decorative and would hurt
 * legibility at small sizes. Everything else uses "Mukta", a clean,
 * highly legible sans-serif with South Asian type-design roots. Both are
 * enqueued via Google Fonts in includes/class-caa-public.php.
 *
 * If you retint this for a different organization, change the six
 * --caa-* variables below — the rest of the file references them, so a
 * palette swap doesn't require hunting through every rule.
 */
.caa-app {
	--caa-maroon: #6E1F2A;
	--caa-maroon-dark: #551722;
	--caa-saffron: #C9692F;
	--caa-gold: #B8892A;
	--caa-cream: #FBF6EC;
	--caa-cream-deep: #F3E7D2;
	--caa-ink: #2B1810;
	--caa-ink-soft: #7A6A5D;
	--caa-border: #E4D6BC;
	--caa-success: #3F7D4F;
	--caa-success-bg: #EAF3EA;
	--caa-error: #A6342A;
	--caa-error-bg: #FBEAE7;

	box-sizing: border-box;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	padding: 16px;
	font-size: 16px;
	font-family: 'Mukta', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--caa-ink);
}

/*
 * Every element inside the widget inherits border-box sizing, so padding
 * and borders are included in an element's declared width instead of
 * adding to it — this is what actually prevents things like the phone
 * country-code row from quietly overflowing a narrow phone screen.
 */
.caa-app,
.caa-app *,
.caa-app *::before,
.caa-app *::after {
	box-sizing: border-box;
}

/* Small phones (iPhone SE, compact Android): tighter padding and a
   stacked (not side-by-side) phone row so nothing feels cramped or
   risks overflowing horizontally. */
@media (max-width: 380px) {
	.caa-app { padding: 10px; font-size: 15px; }
	.caa-card-header { padding: 16px 14px 14px; }
	.caa-card-body { padding: 14px; }
	.caa-title { font-size: 1.4em; }
	.caa-phone-row { flex-direction: column; }
	.caa-phone-row .caa-new-country-code {
		max-width: 100% !important;
		width: 100% !important;
	}
}

.caa-loading { text-align: center; color: var(--caa-ink-soft); padding: 24px 0; }

.caa-card {
	background: var(--caa-cream);
	border: 1px solid var(--caa-border);
	border-radius: 14px;
	margin-bottom: 16px;
	overflow: hidden; /* keeps the header band's corners rounded to match the card */
}

.caa-card-header {
	background: var(--caa-maroon);
	color: var(--caa-cream);
	padding: 20px 20px 18px;
	position: relative;
}

.caa-card-body {
	padding: 20px;
}

.caa-title {
	font-family: 'Yatra One', cursive;
	font-size: 1.7em;
	font-weight: 400; /* Yatra One only ships one weight */
	line-height: 1.15;
	margin: 0 0 6px;
	color: #fff;
}
.caa-subtitle {
	color: #EBD9CE;
	margin: 0;
	font-size: 0.95em;
	line-height: 1.4;
}

.caa-choice-grid {
	display: grid;
	gap: 12px;
}

.caa-choice-btn {
	display: block;
	width: 100%;
	padding: 18px 16px;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 600;
	border: 2px solid var(--caa-maroon);
	background: #fff;
	color: var(--caa-maroon);
	border-radius: 10px;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.caa-choice-btn:hover { background: var(--caa-cream-deep); }
.caa-choice-btn:active { background: var(--caa-maroon); color: #fff; }
.caa-choice-btn:focus-visible { outline: 3px solid var(--caa-saffron); outline-offset: 2px; }

.caa-field { margin-bottom: 16px; position: relative; }
.caa-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--caa-ink);
	font-size: 0.95em;
}

.caa-hint {
	font-size: 0.85em;
	color: var(--caa-ink-soft);
	margin: 6px 0 0;
}

.caa-phone-row {
	display: flex;
	gap: 8px;
}
.caa-phone-row .caa-new-country-code {
	flex: 0 0 auto !important;
	width: auto !important;
	max-width: 42% !important;
}
.caa-phone-row .caa-new-phone {
	flex: 1 1 auto;
	min-width: 0;
}
.caa-field input[type="text"],
.caa-field input[type="tel"],
.caa-field input[type="email"],
.caa-field input[type="date"],
.caa-field select {
	width: 100%;
	padding: 12px;
	font-family: inherit;
	font-size: 1em;
	color: var(--caa-ink);
	background: #fff;
	border: 1.5px solid var(--caa-border);
	border-radius: 8px;
	box-sizing: border-box;
}
.caa-field input:focus,
.caa-field select:focus {
	outline: none;
	border-color: var(--caa-saffron);
	box-shadow: 0 0 0 3px rgba(201, 105, 47, 0.18);
}

/*
 * Many WordPress themes/plugins (WooCommerce's Select2/SelectWoo skin is
 * the most common culprit) apply global CSS that hides native <select>
 * elements sitewide, expecting their own JS to inject a styled
 * replacement. Since our selects are created dynamically after page
 * load, that replacement JS never touches them — they're left present
 * in the DOM but visually invisible/collapsed, with no console error to
 * flag it. These !important overrides force our own selects back to a
 * normal, visible, native appearance regardless of what the surrounding
 * page does to <select> in general. If classes/dates are silently not
 * appearing again despite the data being correct (check via
 * document.querySelector('.caa-class-select').outerHTML in devtools),
 * this block — or a stronger site-specific override — is where to look.
 */
.caa-app select {
	-webkit-appearance: menulist !important;
	-moz-appearance: menulist !important;
	appearance: menulist !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	height: auto !important;
	min-height: 44px !important;
	max-width: 100% !important;
	background-color: #fff !important;
	color: var(--caa-ink) !important;
	line-height: normal !important;
	position: static !important;
}

.caa-suggestions {
	position: absolute;
	z-index: 10;
	background: #fff;
	border: 1.5px solid var(--caa-border);
	border-radius: 8px;
	width: 100%;
	max-height: 220px;
	overflow-y: auto;
	box-shadow: 0 4px 14px rgba(43, 24, 16, 0.12);
}
.caa-suggestions div {
	padding: 10px 12px;
	cursor: pointer;
	border-bottom: 1px solid var(--caa-border);
}
.caa-suggestions div:last-child { border-bottom: none; }
.caa-suggestions div:hover,
.caa-suggestions div:active { background: var(--caa-cream-deep); }

.caa-purpose-options {
	display: grid;
	gap: 8px;
	margin-bottom: 14px;
}
.caa-purpose-options label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1.5px solid var(--caa-border);
	border-radius: 8px;
	font-weight: 500;
	cursor: pointer;
	background: #fff;
}
.caa-purpose-options input { margin: 0; accent-color: var(--caa-maroon); }

.caa-submit-btn {
	width: 100%;
	padding: 14px;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 700;
	background: var(--caa-maroon);
	color: var(--caa-cream);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}
.caa-submit-btn:hover:not(:disabled) { background: var(--caa-maroon-dark); }
.caa-submit-btn:disabled { opacity: 0.45; cursor: default; }
.caa-submit-btn:focus-visible { outline: 3px solid var(--caa-saffron); outline-offset: 2px; }

.caa-back-link {
	display: inline-block;
	margin-bottom: 10px;
	color: #EBD9CE;
	text-decoration: underline;
	cursor: pointer;
	background: none;
	border: none;
	font-family: inherit;
	font-size: 0.9em;
	padding: 0;
}
.caa-back-link:hover { color: #fff; }

.caa-message {
	padding: 14px;
	border-radius: 8px;
	font-weight: 600;
	text-align: center;
}
.caa-message.success { background: var(--caa-success-bg); color: var(--caa-success); }
.caa-message.error { background: var(--caa-error-bg); color: var(--caa-error); }

.caa-inline-error { color: var(--caa-error) !important; }

.caa-nudge {
	background: #FCF3E3;
	border: 1.5px solid var(--caa-gold);
	border-radius: 8px;
	padding: 12px;
	margin-bottom: 16px;
	font-size: 0.95em;
	color: var(--caa-ink);
}
.caa-nudge button {
	margin-top: 8px;
	background: none;
	border: 1.5px solid var(--caa-maroon);
	color: var(--caa-maroon);
	border-radius: 6px;
	padding: 6px 10px;
	cursor: pointer;
	font-weight: 600;
	font-family: inherit;
}

/* Links generally (e.g. the "Show other classes" toggle) use the saffron accent. */
.caa-app a {
	color: var(--caa-saffron);
}

/* Respect reduced-motion preferences — this app has no non-essential motion, but keep this as a floor for any future additions. */
@media (prefers-reduced-motion: reduce) {
	.caa-app * { transition: none !important; }
}
