/* =================================================================
 * TW-Survey — Frontend styles
 *
 * When the TariffWolf theme is active the form already inherits
 * .tw-form-card, .tw-input, .tw-btn-primary, .tw-section, etc., so
 * this file:
 *   1. Adds survey-specific bits the theme can’t supply
 *      (per-field width grid, radio/checkbox option groups, captcha,
 *      reset button, acceptance checkboxes, status states).
 *   2. Provides a sane visual fallback for any other theme so the
 *      form still looks polished out of the box.
 * ================================================================= */

/* ============ SURVEY-SPECIFIC (always applied) ============ */

/* Per-field width: each field consumes --tws-w of the row. On mobile
   we override to 100% so fields stack. */
.tws-fields-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 18px;
}
.tws-field {
	flex: 0 0 calc(var(--tws-w, 100%) - 16px);
	max-width: calc(var(--tws-w, 100%) - 16px);
	min-width: 0;
}
/* gap math: subtract gap so widths add up nicely. For 50% + 50% with
   16px gap, each becomes calc(50% - 16px). One row, two columns,
   space between matches gap visually. */
@media (max-width: 768px) {
	.tws-field {
		flex: 0 0 100%;
		max-width: 100%;
	}
}

/* Choices (radio / checkbox option groups) */
.tws-choices {
	display: grid;
	gap: 8px;
}
.tws-choice {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .2s ease, background .2s ease;
	color: inherit;
	font-size: 0.95rem;
}
.tws-choice:hover {
	border-color: #c9a84c;
	background: rgba(201, 168, 76, 0.06);
}
.tws-choice input[type="radio"],
.tws-choice input[type="checkbox"] {
	margin: 0;
	flex-shrink: 0;
}

/* Acceptance checkboxes */
.tws-acceptances {
	display: grid;
	gap: 10px;
	margin: 6px 0 18px;
}
.tws-acceptance {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 10px;
	align-items: start;
	padding: 12px 14px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .2s ease, background .2s ease;
}
.tws-acceptance:hover {
	border-color: #c9a84c;
	background: rgba(201, 168, 76, 0.05);
}
.tws-acceptance input[type="checkbox"] {
	margin: 4px 0 0;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	accent-color: #c9a84c;
}
.tws-acceptance-text {
	font-size: 0.92rem;
	line-height: 1.5;
}
.tws-acceptance-text a {
	color: #c9a84c;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.tws-acceptance-text a:hover { color: #d4b85a; }
.tws-acceptance-text .req { color: #ff5733; margin-left: 2px; }

/* Captcha */
.tws-captcha-box {
	background: rgba(8, 17, 31, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	padding: 14px 16px;
	margin-bottom: 18px;
}
.tws-captcha-label {
	display: block;
	font-size: 0.86rem;
	font-weight: 600;
	color: #b3becf;
	margin-bottom: 8px;
}
.tws-captcha-label i { color: #c9a84c; margin-right: 6px; }
.tws-captcha-label .req { color: #ff5733; }
.tws-captcha-row {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}
.tws-captcha-q {
	font-weight: 700;
	font-size: 1.05rem;
	color: #fff;
	background: linear-gradient(135deg, rgba(201, 168, 76, 0.18), rgba(201, 168, 76, 0.08));
	border: 1px solid rgba(201, 168, 76, 0.35);
	padding: 8px 14px;
	border-radius: 8px;
	letter-spacing: 0.5px;
	user-select: none;
}
.tws-cap-input {
	max-width: 140px;
	flex: 0 0 auto;
	/* Default gold border so the answer box is visibly the active
	   interactive element (matches the question pill). */
	border-color: rgba(201, 168, 76, 0.45) !important;
	box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.08) !important;
}
.tws-cap-input:focus {
	border-color: #c9a84c !important;
	box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.22) !important;
}

/* Status messages */
.tws-status {
	margin-top: 14px;
	padding: 0;
	font-size: 0.94rem;
	display: none;
}
.tws-status.is-success {
	display: block;
	color: #16a34a;
	background: rgba(22, 163, 74, 0.08);
	border: 1px solid rgba(22, 163, 74, 0.3);
	padding: 12px 14px;
	border-radius: 8px;
}
.tws-status.is-error {
	display: block;
	color: #ef4444;
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.3);
	padding: 12px 14px;
	border-radius: 8px;
}

/* Actions row */
.tws-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
	flex-wrap: wrap;
}

/* Reset button — ghost style that pairs with TariffWolf primary
   gold OR the bundled fallback gold. Always overridable by the theme. */
.tws-reset {
	background: transparent;
	color: #b3becf;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 10px;
	padding: 12px 20px;
	font-weight: 600;
	font-size: 0.92rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.tws-reset:hover {
	color: #fff;
	border-color: #c9a84c;
	background: rgba(201, 168, 76, 0.06);
}

/* Disabled submit clearly shows it's locked until captcha solved */
.tws-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none !important;
	box-shadow: none !important;
	filter: grayscale(0.4);
}

/* Page-level header (sits above the form card, NOT inside it) */
.tws-page-head {
	margin: 0 auto 28px;
	max-width: 760px;
	text-align: center;
}
.tws-page-title {
	margin: 0 0 12px;
	font-size: 2rem;
	font-weight: 800;
	letter-spacing: -0.6px;
	line-height: 1.2;
	color: inherit;
	text-align: center;
}
.tws-page-intro {
	text-align: center;
	color: inherit;
	font-size: 1rem;
	line-height: 1.65;
	margin: 0 auto;
}
.tws-page-intro p { margin: 0 0 10px; text-align: center; }
.tws-page-intro p:last-child { margin-bottom: 0; }
.tws-page-intro a { color: #c9a84c; }
.tws-page-intro a:hover { color: #d4b85a; }
.tws-page-intro img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
	margin: 8px auto;
	display: block;
}

/* Form intro (rich-text block from admin) */
.tws-form-intro {
	margin: 0 0 22px;
	color: inherit;
}
.tws-form-intro p { margin: 0 0 10px; }
.tws-form-intro p:last-child { margin-bottom: 0; }
.tws-form-intro a { color: #c9a84c; }
.tws-form-intro a:hover { color: #d4b85a; }
.tws-form-intro img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; }

.tws-error {
	padding: 14px 18px;
	border-radius: 10px;
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.3);
	color: #ef4444;
}

/* Plugin page-template wrapper — give the form some breathing room
   when the theme doesn’t supply a section wrapper. */
.tws-page-main {
	padding-top: 96px; /* clears fixed headers like TariffWolf's */
	padding-bottom: 64px;
}

/* =================================================================
 * Fallback styling for non-TariffWolf themes
 * ================================================================= */

.tws-survey-section { padding: 64px 0; }
.tws-container {
	max-width: 760px;
	margin: 0 auto;
	padding: 0 24px;
}

.tws-form-card {
	background: rgba(15, 23, 42, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 18px;
	padding: 40px 36px;
	color: #e6edf6;
	box-shadow: 0 8px 28px -10px rgba(0,0,0,0.45);
}

.tws-field { margin-bottom: 0; } /* gap handled by flex container */
.tws-field > label {
	display: block;
	font-size: 0.86rem;
	font-weight: 600;
	color: #b3becf;
	margin-bottom: 6px;
}
.tws-field .req { color: #ff5733; }
.tws-field .opt { color: #7e8aa0; font-weight: 400; font-size: 0.78rem; }

.tws-input {
	width: 100%;
	padding: 12px 14px;
	background: #08111f;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 10px;
	color: #e6edf6;
	font-size: 0.92rem;
	font-family: inherit;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.tws-input:focus {
	outline: none;
	border-color: #c9a84c;
	box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}
textarea.tws-input { resize: vertical; min-height: 110px; }
select.tws-input {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23c9a84c' d='M6 8L0 0h12z'/></svg>");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 38px;
}

.tws-submit {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: linear-gradient(135deg, #c9a84c 0%, #d4b85a 100%);
	color: #0a1628;
	border: 0;
	border-radius: 10px;
	padding: 13px 24px;
	font-weight: 700;
	font-size: 0.95rem;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}
.tws-submit:not(:disabled):hover {
	transform: translateY(-1px);
	box-shadow: 0 12px 30px -12px rgba(201, 168, 76, 0.5);
}

.tws-spinner { color: #c9a84c; font-size: 1.2rem; }

@media (max-width: 600px) {
	.tws-form-card { padding: 28px 22px; }
	.tws-survey-section { padding: 40px 0; }
	.tws-page-main { padding-top: 80px; padding-bottom: 40px; }
	.tws-actions { gap: 10px; }
	.tws-submit, .tws-reset { width: 100%; justify-content: center; }
}
