/* TWR Wedding RSVP – Frontend Styles
   Highlight color is injected as --twr-highlight / --twr-highlight-rgb via inline style. */

/* ── Font inheritance: use whatever the theme sets ──────────────────────── */
.twr-wrap,
.twr-wrap input,
.twr-wrap textarea,
.twr-wrap select,
.twr-wrap button {
	font-family: inherit;
	font-size: inherit;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.twr-wrap {
	max-width: 720px;
	margin: 0 auto;
	--twr-highlight: #c8a96e;     /* fallback if inline style not output */
	--twr-highlight-rgb: 200, 169, 110;
}

/* ── Greeting ─────────────────────────────────────────────────────────────── */
.twr-greeting { margin-bottom: 24px; }
.twr-greeting h2 { margin-bottom: 4px; }
.twr-household { color: #666; margin: 0; }

/* ── Notices ─────────────────────────────────────────────────────────────── */
.twr-notice {
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 16px;
	font-weight: 500;
}
.twr-notice-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.twr-notice-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Person cards ─────────────────────────────────────────────────────────── */
.twr-persons h3,
.twr-party-notes h3 { margin-bottom: 16px; }

.twr-person-card {
	background: #fff;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	margin-bottom: 20px;
	overflow: hidden;
	transition: border-color .2s, box-shadow .2s;
}

/* Highlighted / pre-selected person */
.twr-person-card.twr-active {
	border-color: var(--twr-highlight);
	box-shadow: 0 0 0 3px rgba(var(--twr-highlight-rgb), 0.2);
}
.twr-person-card.twr-active .twr-person-header {
	background: rgba(var(--twr-highlight-rgb), 0.1);
}

.twr-person-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	background: #f8f9fa;
	border-bottom: 1px solid #eee;
}

/* "This is you" badge */
.twr-you-badge {
	margin-left: auto;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 20px;
	background: var(--twr-highlight);
	color: #fff;
	letter-spacing: .3px;
	white-space: nowrap;
}

.twr-person-card form { padding: 18px; }

/* ── RSVP Status badge ───────────────────────────────────────────────────── */
.twr-status {
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 20px;
	font-weight: 600;
}
.twr-status-yes     { background: #d4edda; color: #155724; }
.twr-status-no      { background: #f8d7da; color: #721c24; }
.twr-status-pending { background: #fff3cd; color: #856404; }

/* ── Radio buttons (shared base: RSVP + menu + room options) ────────────── */
.twr-fieldset {
	border: none;
	padding: 0;
	margin: 0 0 18px;
}
.twr-fieldset legend {
	font-weight: 600;
	margin-bottom: 10px;
}

/* Shared label style for every radio group */
.twr-rsvp-label,
.twr-room-option {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 2px solid #ddd;
	border-radius: 6px;
	cursor: pointer;
	transition: border-color .15s, background .15s;
	user-select: none;
	font-weight: normal;
	font-size: 1em;
}
.twr-rsvp-label input[type="radio"],
.twr-room-option input[type="radio"] { margin: 0; }

/* Checked state — highlight colour */
.twr-rsvp-label:has(input:checked),
.twr-room-option:has(input:checked) {
	border-color: var(--twr-highlight);
	background: rgba(var(--twr-highlight-rgb), 0.08);
}

/* RSVP-specific overrides for attending / declining */
.twr-rsvp-label.twr-rsvp-1:has(input:checked) { border-color: #198754; background: #d4edda; }
.twr-rsvp-label.twr-rsvp-2:has(input:checked) { border-color: #dc3545; background: #f8d7da; }

/* RSVP buttons sit side-by-side; menu/room options stack */
.twr-rsvp-buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* ── Form fields ──────────────────────────────────────────────────────────── */
.twr-field { margin-bottom: 14px; }
.twr-field > label {
	display: block;
	font-weight: 600;
	font-size: .875em;
	margin-bottom: 5px;
}
.twr-field input,
.twr-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
}
.twr-field input:focus,
.twr-field textarea:focus {
	border-color: var(--twr-highlight);
	outline: none;
	box-shadow: 0 0 0 2px rgba(var(--twr-highlight-rgb), 0.2);
}
.twr-field textarea { resize: vertical; }

.twr-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.twr-btn {
	display: inline-block;
	padding: 9px 22px;
	border: none;
	border-radius: 4px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity .15s;
}
.twr-btn:hover { opacity: .85; }
.twr-btn-primary {
	background: var(--twr-highlight);
	color: #fff;
}
.twr-btn-secondary {
	background: #f0f0f1;
	color: #3c434a;
	border: 1px solid #ccc;
}

/* ── Party notes block ───────────────────────────────────────────────────── */
.twr-party-notes {
	margin-top: 32px;
	padding: 20px;
	background: #f8f9fa;
	border: 1px solid #ddd;
	border-radius: 8px;
}

/* ── Room / menu option containers — same row layout as RSVP buttons ─────── */
.twr-room-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}

/* ── Auto-save status indicator ─────────────────────────────────────────── */
.twr-autosave-status {
	display: block;
	min-height: 1.2em;
	margin-top: 10px;
	font-size: .8em;
	transition: opacity .4s;
}
.twr-autosave-status.twr-saving { color: #888; }
.twr-autosave-status.twr-saved  { color: #198754; }
.twr-autosave-status.twr-error  { color: #dc3545; }
.twr-autosave-status.twr-fade   { opacity: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media ( max-width: 600px ) {
	.twr-rsvp-buttons { flex-direction: column; }
	.twr-field-row    { grid-template-columns: 1fr; }
}
