/**
 * Toolset CSS.
 * 
 * @package RHD
 * 
 * Table of Contents:
 * 1. Base & Utility
 * 2. Form Layout
 * 3. Form Elements
 * 4. Search Components
 * 5. Profile & Connection Styles
 * 6. Disciplines Table
 * 7. Toggle Switch
 * 8. Sponsor Components
 * 9. Loading States
 * 10. Financial Section
 */

/* -----------------------------------------------------------------------------
 * 1. Base & Utility
 * -------------------------------------------------------------------------- */
p:empty {
	display: none;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* -----------------------------------------------------------------------------
 * 2. Form Layout
 * -------------------------------------------------------------------------- */
.test-form {
	max-width: 1200px;
	margin: 0 auto;
}

.test-form-header {
	padding: 1rem;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.test-form-footer {
	text-align: center;
}

.test-form-footer button[type="submit"] {
	margin-top: 1rem;
	font-size: var(--wp--preset--font-size--small);
}

.test-form-actions {
	margin: 1rem 0;
}

.profile-section:not(:last-child) {
	margin-bottom: 2rem;
}

.adjudicators-section h3 {
	font-size: var(--wp--preset--font-size--large);
	margin-top: 0;
	margin-bottom: 0;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #ddd;
}

.adjudicators-container {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.adjudicator-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.3rem 0.5rem;
	background: rgba(0, 128, 0, 0.1);
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small);
}

.test-form .remove-adjudicator {
	border: none;
	background: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1;
	color: var(--wp--preset--color--red);
}

.test-form .remove-adjudicator:hover {
	color: var(--wp--preset--color--red);
	background-color: inherit;
}

/* -----------------------------------------------------------------------------
 * 3. Form Elements
 * -------------------------------------------------------------------------- */
.test-field-group {
	padding: 0.5rem 0.75rem;
}

.test-field-group:last-child {
	margin-bottom: 0;
}

.test-field-group label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
	color: var(--wp--preset--color--charcoal);
}

.test-field-group input:not([type="checkbox"]),
.test-field-group select {
	width: 100%;
	padding: 0.375rem 0.5rem;
	border: 1px solid var(--wp--preset--color--dark-gray);
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.4;
}

.test-field-group input[type="date"] {
	padding-top: 0.105em;
	padding-bottom: 0.105em;
}

.test-field-group input:focus {
	border-color: var(--wp--preset--color--purple);
	outline: 0;
	box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.test-field-group.test-id-field {
	background: rgba(114, 0, 164, 0.03);
	border: 1px solid rgba(114, 0, 164, 0.2);
	border-radius: 4px;
}

.test-field-group.test-certify-results-checkbox {
	background: #dd4150;
	border: 1px solid rgba(114, 0, 164, 0.3);
	border-radius: 4px;
}

.test-field-group.test-certify-results-checkbox label {
	color: var(--wp--preset--color--white);
}

.test-field-group.test-certify-results-checkbox input[type="checkbox"] {
	margin: 0;
}

.test-field-group.test-certify-results-checkbox .certification-notice-container {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.test-field-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.test-field-row .test-field-group:not(.test-field-group-spacer) {
	flex: 1 1 200px;
	margin-bottom: 0;
}

.test-field-row .test-field-group.test-field-group-shrink {
	flex: 0 0 auto;
}

.test-field-row .test-field-group.test-field-group-spacer {
	flex: 1 1 auto;
}

.test-field-group.align-right {
	text-align: right;
}

.test-field-group br,
.test-field-row br {
	display: none;
}

.certification-notice {
	font-size: var(--wp--preset--font-size--xx-small);
	color: var(--wp--preset--color--white);
	opacity: 0.9;
	line-height: 1.3;
	display: inline-block;
	max-width: 120px; /* Limit the width to maintain original box size */
}

/* Buttons */
.test-form button {
	color: var(--wp--preset--color--white);
	border: none;
	padding: 0.6em 1em 0.5em;
	font-size: var(--wp--preset--font-size--x-small);
	background: #737c83; /* A medium gray */
	cursor: pointer;
	border-radius: 4px;
	text-decoration: none;
	text-shadow: none;
}

.test-form button:hover {
	background: #495057; /* Slightly darker on hover */
}

.test-form button.remove-button {
	font-size: var(--wp--preset--font-size--xx-small);
}

/* -----------------------------------------------------------------------------
 * 4. Search Components
 * -------------------------------------------------------------------------- */
.search-container {
	position: relative;
	z-index: 100;
}

.search-container br {
	display: none; /* Hack to prevent extra line breaks from WP autop */
}

.profile-search {
	width: 100%;
	padding: 0.5rem;
	margin-bottom: 1rem;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 2px;
	max-height: 200px;
	overflow-y: auto;
	background: white;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	z-index: 101;
}

.profile-result {
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.profile-result:hover,
.profile-result:focus {
	background-color: var(--wp--preset--color--light-gray);
}

.profile-result:not(:last-child) {
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

/* -----------------------------------------------------------------------------
 * 5. Profile & Connection Styles
 * -------------------------------------------------------------------------- */
.teachers-section h3,
.participants-section h3 {
	font-size: var(--wp--preset--font-size--large);
	margin-top: 0;
	margin-bottom: 0;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--wp--preset--color--light-gray);
}

.connections-list {
	margin-top: 1rem;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--light-gray);
}

.connection-item {
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

.connection-item.participant-item.invalid-participant {
	border: 2px solid var(--wp--preset--color--red);
}

.connection-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.75rem;
	cursor: pointer;
	transition: background-color 0.2s;
	background: var(--wp--preset--color--off-white);
}

.connection-header:hover {
	background: white;
}

.profile-info {
	flex: 0 0 200px;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.profile-name {
	font-weight: 600;
	margin: 0;
	line-height: 1.2;
}

.profile-link {
	font-size: var(--wp--preset--font-size--xx-small);
	color: inherit;
	text-decoration: underline;
	text-decoration-style: dotted;
}

.profile-link:hover {
	text-decoration: underline;
}

.disciplines-section {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.connection-disciplines {
	flex: 1;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	min-height: 24px;
}

.discipline-chip {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.75rem;
	background: rgba(114, 0, 164, 0.08);
	border: 1px solid rgba(114, 0, 164, 0.15);
	border-radius: 12px;
	font-size: var(--wp--preset--font-size--xx-small);
	line-height: 1;
	color: var(--wp--preset--color--charcoal);
}

.discipline-chip.is-renewal {
	background: rgba(38, 147, 95, 0.12);
	border: 1px solid rgba(38, 147, 95, 0.25);
}

.discipline-chip .grade {
	margin-left: 0.5rem;
	padding-left: 0.5rem;
	border-left: 1px solid rgba(0, 0, 0, 0.2);
}

.connection-row-spacer {
	flex: 1 1 auto;
}

.connection-actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.connection-details {
	display: none;
	width: 100%;
	padding: 1rem;
	background: white;
	border-top: 1px solid var(--wp--preset--color--light-gray);
}

.connection-item.is-expanded .connection-details {
	display: block;
}

.connection-item.is-expanded .connection-header {
	background: white;
	border-bottom: 2px solid rgba(114, 0, 164, 0.3);
}

/* Disciplines Grid in expanded view */
.disciplines-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.discipline-option {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.75rem;
	background: var(--wp--preset--color--off-white);
	border-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	border: 1px solid var(--wp--preset--color--light-gray);
	flex: 0 1 auto;
	min-width: 200px;
	max-width: calc(33.33% - 1rem);
}

/* Responsive adjustments for disciplines grid */
@media (max-width: 768px) {
	.discipline-option {
		min-width: calc(50% - 1rem);
		max-width: calc(50% - 1rem);
	}
}

@media (max-width: 480px) {
	.discipline-option {
		min-width: 100%;
		max-width: 100%;
	}
}

.discipline-option.is-disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.discipline-option-content {
	flex: 1;
}

.discipline-option-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.discipline-name {
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
}

.renewal-badge {
	font-size: var(--wp--preset--font-size--xx-small);
	padding: 0.125rem 0.375rem;
	background: rgba(38, 147, 95, 0.12);
	border-radius: 4px;
	color: var(--wp--preset--color--charcoal);
	border: 1px solid rgba(38, 147, 95, 0.25);
}

.grade-select {
	width: 100%;
	margin-top: 0.5rem;
}

.connection-item.is-expanded .toggle-expand {
	background: rgba(114, 0, 164, 0.8);
	border-color: rgba(114, 0, 164, 0.3);
	color: white;
	transform: rotate(180deg);
}

.test-form .remove-connection {
	border: 1px solid var(--wp--preset--color--gray);
	background: none;
	color: var(--wp--preset--color--charcoal);
	border-radius: 4px;
	cursor: pointer;
	font-size: var(--wp--preset--font-size--xx-small);
}

.test-form .remove-connection:hover {
	background: var(--wp--preset--color--red);
	border-color: var(--wp--preset--color--red);
	color: white;
}

.fee-exempt-toggle {
	margin-left: auto;
	margin-right: 1rem;
}

/* -----------------------------------------------------------------------------
 * 6. Disciplines Table
 * -------------------------------------------------------------------------- */
.disciplines-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 1rem;
	background: white;
	border-radius: 4px;
	overflow: hidden;
}

.disciplines-table th,
.disciplines-table td {
	padding-right: 0.75rem;
	padding-left: 0.75rem;
	text-align: left;
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

.teachers-section .disciplines-table th,
.teachers-section .disciplines-table td {
	padding-top: 0.65rem;
	padding-bottom: 0.55rem;
}

.participants-section .disciplines-table th,
.participants-section .disciplines-table td {
	padding-top: 0.2em;
	padding-bottom: 0.2em;
}

.disciplines-table th {
	background: var();
	font-weight: 600;
	color: var(--wp--preset--color--gray);
	font-size: var(--wp--preset--font-size--small);
}

.disciplines-table tr:last-child td {
	border-bottom: none;
}

.disciplines-table tr:hover {
	background-color: var();
}

.discipline-checkbox-wrapper {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
}

.discipline-checkbox-wrapper.disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.discipline-checkbox-wrapper.disabled input[type="checkbox"],
.discipline-checkbox-wrapper.disabled .discipline-name {
	cursor: not-allowed;
}

input.discipline-checkbox[type="checkbox"] {
	cursor: pointer;
	position: relative;
	top: 2px;
}

.discipline-name {
	font-size: var(--wp--preset--font-size--xx-small);
	line-height: 1;
}

.grade-select {
	width: 100px;
	display: block;
	padding: 0.25rem 0.375rem;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	background-color: white;
	font-size: var(--wp--preset--font-size--xx-small);
	transition: opacity 0.2s ease;
}

.grade-select:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	background-color: var(--wp--preset--color--light-gray);
}

.grade-select:not(:disabled):focus {
	border-color: var(--);
	outline: 0;
	box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* -----------------------------------------------------------------------------
 * 7. Toggle Switch
 * -------------------------------------------------------------------------- */
.toggle-switch-wrapper {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	user-select: none;
	margin: 1rem 0;
}

.toggle-switch-input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	visibility: hidden;
}

.toggle-switch {
	position: relative;
	display: inline-block;
	width: 36px;
	height: 20px;
	flex-shrink: 0;
	background-color: #ccc;
	border-radius: 20px;
	transition: background-color 0.2s;
}

.toggle-switch-slider {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	background-color: white;
	border-radius: 50%;
	transition: transform 0.2s;
}

.toggle-switch-input:checked + .toggle-switch .toggle-switch-slider {
	transform: translateX(16px);
}

.toggle-switch-input:checked + .toggle-switch {
	background-color: #4caf50;
}

.toggle-switch-label {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--charcoal);
}

/* -----------------------------------------------------------------------------
 * 8. Sponsor Components
 * -------------------------------------------------------------------------- */

.sponsor-search-container {
	position: relative;
	z-index: 102;
}

.sponsor-search {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid #dee2e6;
	border-radius: 4px;
}

.sponsor-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 2px;
	max-height: 200px;
	overflow-y: auto;
	background: white;
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	z-index: 101;
}

.search-container.is-open .sponsor-search-results {
	border: 1px solid #dee2e6;
	display: block;
}

.sponsor-result {
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.sponsor-result:hover,
.sponsor-result:focus {
	background-color: var();
}

.selected-sponsors {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.5rem;
	min-height: 2rem;
}

.sponsor-tag {
	display: inline-flex;
	align-items: flex-start;
	gap: 0.25rem;
	padding: 0.25rem 0.5rem;
	font-size: var(--wp--preset--font-size--small);
	background: var(--wp--preset--color--light-gray);
	border-radius: 4px;
}

.test-form .remove-sponsor {
	border: none;
	background: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	color: var(--wp--preset--color--red);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1;
}

.test-form .remove-sponsor:hover {
	color: var(--wp--preset--color--red);
	background-color: inherit;
}

/* -----------------------------------------------------------------------------
 * 9. Loading States
 * -------------------------------------------------------------------------- */
.loading-spinner {
	display: inline-block;
	width: var(--wp--preset--font-size--medium);
	height: var(--wp--preset--font-size--medium);
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-left-color: currentColor;
	border-radius: 50%;
	animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.test-form.loading {
	opacity: 0.7;
	pointer-events: none;
}

.test-form button[type="submit"].loading {
	position: relative;
	padding-right: 2.5em;
	pointer-events: none;
}

.test-form button[type="submit"].loading .loading-spinner {
	position: absolute;
	right: 0.75em;
	top: 50%;
	transform: translateY(-50%);
}

.search-container.loading::after,
.sponsor-search-container.loading::after {
	content: "";
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-left-color: currentColor;
	border-radius: 50%;
	animation: spinner 0.75s linear infinite;
}

/* -----------------------------------------------------------------------------
 * 10. Financial Section
 * -------------------------------------------------------------------------- */

.test-form .finances-toggle-btn {
	background: none;
	border: none;
	color: var(--wp--preset--color--dark-gray);
	cursor: pointer;
	padding: 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.test-form .finances-toggle-btn:hover {
	background: inherit;
}

.finances-toggle-text {
	text-decoration: underline;
	text-decoration-style: dotted;
}

.finances-toggle-btn .toggle-icon {
	font-size: 0.8em;
}

.finances-section {
	padding: 1rem;
	background: #f0f0f1;
	border-radius: 4px;
}

.finances-section .test-field-row {
	margin-bottom: 1rem;
}

.finances-section .test-field-row:last-child {
	margin-bottom: 0;
}

.finances-section .test-field-row .test-field-group {
	flex: 1 1 100px;
	max-width: 130px;
}

.finances-section .test-field-row .test-field-group label {
	font-size: var(--wp--preset--font-size--medium);
	line-height: var(--wp--preset--line-height--normal);
}

.covered-by-host {
	flex: 0 0 200px;
	margin-left: 2rem;
	padding-bottom: 2rem;
	display: flex;
	flex-direction: column;
	float: right;
}

.covered-by-host fieldset {
	border: none;
	padding: 0;
	margin: 0;
}

.covered-by-host legend {
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.checkbox-group label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.finances-total {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #ddd;
	font-size: var(--wp--preset--font-size--small);
}

.total-breakdown {
	margin-bottom: 0.5rem;
}

.total-breakdown p {
	margin: 0.25rem 0;
	color: var(--wp--);
}

.grand-total {
	font-size: var(--wp--preset--font-size--medium);
}

.input-mask {
	position: relative;
	display: inline-block;
	width: 100%;
}

.input-mask .currency-symbol,
.input-mask .days-symbol {
	position: absolute;
	transform: translateY(-50%);
	font-size: var(--wp--preset--font-size--xx-small);
}

.input-mask .currency-symbol {
	top: 51%;
	left: 8px;
	color: var(--wp--preset--color--charcoal);
	pointer-events: none;
}

.input-mask input[type="number"] {
	padding-left: 20px;
	width: 100%;
}

.input-mask .days-symbol {
	right: 8px;
	left: auto;
	top: 55%;
}

/* Hide spinner buttons on number inputs */
.input-mask input[type="number"]::-webkit-outer-spin-button,
.input-mask input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.input-mask input[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
}

.input-mask.disabled {
	opacity: 0.6;
}

.input-mask.disabled input {
	background-color: var(--wp--preset--color--light-gray);
	cursor: not-allowed;
}

.input-mask.disabled .currency-symbol {
	opacity: 0.6;
}

/* Add styles for ARIA live regions */
[aria-live="polite"],
[aria-live="assertive"] {
	min-height: 1px; /* Ensures empty regions remain in DOM */
}

/* Improve loading state visibility */
.loading-spinner {
	/* Add high contrast colors for better visibility */
	border-color: rgba(0, 0, 0, 0.2);
	border-left-color: #000;
}

[data-loading="true"] {
	position: relative;
}

[data-loading="true"]::after {
	content: "Loading...";
	position: absolute;
	left: -9999px;
}

/* Add styles for renewal checkbox column */
.disciplines-table td:nth-child(2) {
	text-align: center;
	width: 80px;
}

.renewal-checkbox {
	cursor: pointer;
}

.renewal-checkbox:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/* Adjust the grade select column width */
.disciplines-table td:nth-child(3) {
	width: 100px;
}

.certification-locked {
	color: var(--wp--);
	font-size: 0.9em;
}

input[type="checkbox"]:disabled + label {
	opacity: 0.7;
	cursor: not-allowed;
}

.locked {
	cursor: not-allowed;
}

.renewal-icon {
	display: inline-block;
	margin-left: 0.25rem;
	font-size: 1em;
	color: rgba(38, 147, 95, 0.9);
}

.discipline-chip .renewal-icon {
	margin-right: 0.25rem;
}

.renewal-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.25rem 0.5rem;
	background: rgba(38, 147, 95, 0.12);
	border-radius: 4px;
	color: var(--wp--preset--color--charcoal);
	border: 1px solid rgba(38, 147, 95, 0.25);
}

.discipline-chip.is-renewal {
	padding-right: 0.5rem;
}

.renewal-status {
	text-align: center;
	min-width: 15px;
	position: relative;
	min-height: 25px; /* Match height of renewal icon */
}

.renewal-status.loading::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	border: 2px solid rgba(34, 113, 177, 0.1);
	border-left-color: var(--wp--preset--color--purple);
	border-radius: 50%;
	animation: renewal-spinner 0.75s linear infinite;
}

@keyframes renewal-spinner {
	0% {
		transform: translate(-50%, -50%) rotate(0deg);
	}
	100% {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* Toast Notification */
.test-toast {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	z-index: 9999;
	animation: toast-slide-in 0.3s ease-out;
}

.test-toast-content {
	color: white;
	padding: 1rem 1.5rem;
	border-radius: 4px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.success-toast {
	background: #4caf50;
}

.error-toast {
	background: var(--wp--preset--color--red);
}

.test-toast-icon {
	font-size: 1.2em;
}

.test-toast-message {
	font-size: var(--wp--preset--font-size--small);
}

.test-toast-fade-out {
	animation: toast-fade-out 0.3s ease-out forwards;
}

@keyframes toast-slide-in {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes toast-fade-out {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

.expand-icon {
	display: inline-flex;
	align-items: center;
	margin-left: 0.5rem;
	color: var(--wp--preset--color--gray);
	transition: transform 0.2s ease;
}

.connection-item.is-expanded .expand-icon {
	transform: rotate(180deg);
}

/* Optional hover effect */
.connection-header:hover .expand-icon {
	color: var(--wp--preset--color--charcoal);
}

/* Test Type Toggle */
.test-event-type-toggle {
	margin-bottom: 1.5rem;
}

.toggle-switch-container {
	display: inline-flex;
	background: var(--wp--preset--color--light-gray);
	padding: 0.25rem;
	border-radius: 2rem;
	gap: 0.25rem;
}

.toggle-option {
	position: relative;
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 1rem;
	border-radius: 1.5rem;
	cursor: pointer;
	font-size: var(--wp--preset--font-size--small);
	transition: all 0.2s ease;
}

.toggle-option input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-option input[type="radio"]:checked + .toggle-option {
	background: var(--wp--preset--color--white);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style the label when radio is checked */
.toggle-option input[type="radio"]:checked {
	background: var(--wp--preset--color--white);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-option:has(input[type="radio"]:checked) {
	background: var(--wp--preset--color--white);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Disabled state for certified test_events */
.test-form.is-certified .toggle-option {
	opacity: 0.7;
	cursor: not-allowed;
}

.test-form.is-certified .toggle-option input[type="radio"] {
	pointer-events: none;
}

/* Certified Form States */
.test-form.is-certified input,
.test-form.is-certified select,
.test-form.is-certified textarea,
.test-form.is-certified button,
.test-form.is-certified .search-container,
.test-form.is-certified .connection-header,
.test-form.is-certified .discipline-option,
.test-form.is-certified .toggle-option {
	cursor: not-allowed !important;
}

/* Keep submit button hidden instead of showing as disabled */
.test-form.is-certified button[type="submit"] {
	display: none;
}

/* Ensure child elements inherit the not-allowed cursor */
.test-form.is-certified .connection-header *,
.test-form.is-certified .discipline-option *,
.test-form.is-certified .toggle-option * {
	cursor: not-allowed !important;
}

/* Add visual indicator that form is locked */
.test-form.is-certified::before {
	content: "This form is locked because results are certified";
	display: block;
	background: #dd4150;
	color: white;
	padding: 0.5rem 1rem;
	margin-bottom: 1rem;
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small);
}

/* Add to existing certified form states */
.test-form.is-certified .connection-header {
	pointer-events: none;
}

.test-form.is-certified .connection-header .expand-icon {
	opacity: 0.5;
}

.test-form.is-certified .connection-header:hover {
	background-color: inherit; /* Prevent hover effect */
}

/* Hide autocomplete results and inputs on certified forms */
.test-form.is-certified .search-results,
.test-form.is-certified .sponsor-search-results,
.test-form.is-certified .profile-search,
.test-form.is-certified .sponsor-search,
.test-form.is-certified .search-container {
	display: none !important;
}

/* In case any search containers are shown, prevent their open state */
.test-form.is-certified .search-container.is-open {
	border-color: inherit;
}

/* Grade Fields Styles */
.firearms-grades {
	display: none; /* Hidden by default */
	gap: 1.5rem;
	align-items: center;
	margin: 0.5rem 0;
}

/* Show grades when test type is FA */
.test-form[data-test-event-type="fa"] .firearms-grades {
	display: flex;
}

.grade-field {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.grade-field label {
	font-size: 0.9rem;
	color: #666;
	min-width: 100px;
}

/* Written Grade Range Input */
.written-grade-input {
	width: 150px;
	height: 6px;
	-webkit-appearance: none;
	appearance: none;
	background: #e0e0e0;
	border-radius: 3px;
	outline: none;
}

.written-grade-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	background: #2271b1;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s;
}

.written-grade-input::-webkit-slider-thumb:hover {
	background: #135e96;
}

.grade-value {
	min-width: 40px;
	text-align: center;
	font-weight: 500;
}

/* Overall Status Icon */
.status-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	font-size: 14px;
	font-weight: bold;
}

.status-icon.success {
	background-color: #00a32a;
	color: white;
}

.status-icon.fail {
	background-color: #d63638;
	color: white;
}

/* Practical Grade Toggle Switch (reusing existing toggle switch styles) */
.practical-grade-input + .toggle-switch {
	margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.firearms-grades {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}

	.grade-field {
		width: 100%;
	}

	.written-grade-input {
		flex: 1;
	}
}

/* Test Type Specific Visibility */
/* Hide disciplines for FA test_events */
.test-form[data-test-event-type="fa"] .disciplines-section,
.test-form[data-test-event-type="fa"] .disciplines-grid,
.test-form[data-test-event-type="fa"] .connection-details {
	display: none !important;
}

/* Show disciplines for SPT test_events (default behavior) */
.test-form[data-test-event-type="spt"] .disciplines-section {
	display: block;
}

.test-form[data-test-event-type="spt"] .connection-details {
	display: flex;
}

.test-event-type-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.test-event-type-modal-content {
	background: white;
	padding: 2rem;
	border-radius: 4px;
	max-width: 500px;
	width: 90%;
}

.test-event-type-options {
	margin: 1.5rem 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.test-event-type-options label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
}

.confirm-test-event-type {
	width: 100%;
	padding: 0.75rem;
	background: #0073aa;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.confirm-test-event-type:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.test-id-container {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
}

.test-id-section,
.test-event-type-section {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.test-id-section label,
.test-event-type-section label {
	font-size: 0.9em;
	color: #666;
}

.connected-test-event-internal-id,
.connected-test-event-type {
	font-family: monospace;
	padding: 0.25rem 0.5rem;
	background: #f5f5f5;
	border-radius: 4px;
	font-size: 0.9em;
}

.connected-test-event-type {
	background: #e0e0e0;
}

.profile-section,
.test-form-actions {
	display: none;
}

.profile-section.is-visible,
.test-form-actions.is-visible {
	display: block;
}

/* Profile Creation Modal */
.create-profile-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.create-profile-content {
	background: white;
	padding: 2rem;
	border-radius: 4px;
	max-width: 500px;
	width: 90%;
	max-height: 90vh;
	overflow-y: auto;
}

.create-profile-content h2 {
	margin-top: 0;
	margin-bottom: 1.5rem;
	font-size: var(--wp--preset--font-size--large);
}

.modal-field-group {
	margin-bottom: 1rem;
}

.modal-field-group label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
}

.modal-field-group input,
.modal-field-group textarea {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid var(--wp--preset--color--light-gray);
	border-radius: 4px;
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 1rem;
	margin-top: 2rem;
}

.cancel-profile-creation {
	background: var(--wp--preset--color--light-gray) !important;
}

.create-profile-submit {
	background: var(--wp--preset--color--purple) !important;
}

.create-profile-modal[hidden] {
	display: none;
}

/* Add to your existing toast styles */
.test-toast.error-toast {
	background-color: #d63638;
}

.test-toast.error-toast .test-toast-icon {
	color: #fff;
}
