/* ============================================================
   Race Manager — Public (Frontend) CSS
   ============================================================ */

/* Contenedor principal ------------------------------------ */
.rm-registration-wrap {
	max-width: 800px;
	margin: 0 auto;
	font-family: inherit;
}

/* Tarjetas de carrera (selector múltiple) ----------------- */
.rm-event-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}
.rm-event-card {
	border: 2px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
	transition: border-color .2s, box-shadow .2s;
}
.rm-event-card:not(.rm-event-card--closed):hover {
	border-color: #2271b1;
	box-shadow: 0 4px 16px rgba(34,113,177,.12);
}
.rm-event-card--closed { opacity: .6; }
.rm-event-card-body { padding: 20px; }
.rm-event-card-body h3 { margin: 0 0 10px; font-size: 18px; }
.rm-event-card-body p  { margin: 4px 0; font-size: 14px; color: #6b7280; }
.rm-deadline { color: #d97706 !important; font-weight: 600; }

/* Encabezado de carrera seleccionada --------------------- */
.rm-selected-event-header {
	background: #eff6ff;
	border-left: 4px solid #2271b1;
	padding: 16px 20px;
	margin-bottom: 24px;
	border-radius: 0 6px 6px 0;
}
.rm-selected-event-header h2 { margin: 0 0 6px; }
.rm-selected-event-header p  { margin: 0; color: #374151; font-size: 15px; }

/* Fieldsets ----------------------------------------------- */
.rm-fieldset {
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 20px 24px;
	margin-bottom: 24px;
	background: #fff;
}
.rm-fieldset legend {
	font-weight: 700;
	font-size: 16px;
	padding: 0 8px;
	color: #1f2937;
}

/* Grid de campos ----------------------------------------- */
.rm-field-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}
@media (max-width: 580px) {
	.rm-field-grid { grid-template-columns: 1fr; }
}

.rm-field { display: flex; flex-direction: column; gap: 4px; }
.rm-field--full { grid-column: 1 / -1; }
.rm-field label {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
}
.rm-field input,
.rm-field select,
.rm-field textarea {
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 15px;
	font-family: inherit;
	transition: border-color .15s, box-shadow .15s;
	background: #fff;
}
.rm-field input:focus,
.rm-field select:focus,
.rm-field textarea:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 3px rgba(34,113,177,.15);
	outline: none;
}
/* Solo la primera etiqueta directa del campo lleva asterisco, no las de cada opción */
.rm-field--required > label::after,
.rm-field--required > .rm-checkbox-label::after { content: ' *'; color: #d63638; }

/* Campo con error de validación */
.rm-field--error input,
.rm-field--error select,
.rm-field--error textarea {
	border-color: #d63638 !important;
	box-shadow: 0 0 0 2px rgba(214,54,56,.2) !important;
}
.rm-field--error .rm-pm-options { outline: 2px solid #d63638; border-radius: 6px; padding: 4px; }
.rm-field--error label { color: #d63638; }

/* License input ------------------------------------------ */
.rm-license-input {
	max-width: 280px;
}

/* Autocomplete -------------------------------------------- */
.rm-autocomplete-wrap { position: relative; }
.rm-autocomplete-dropdown {
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0,0,0,.12);
	z-index: 1000;
	max-height: 200px;
	overflow-y: auto;
}
.rm-ac-item {
	padding: 9px 14px;
	font-size: 14px;
	cursor: pointer;
	border-bottom: 1px solid #f3f4f6;
	transition: background .1s;
}
.rm-ac-item:last-child { border-bottom: none; }
.rm-ac-item:hover { background: #eff6ff; color: #2271b1; }

/* Opciones de distancia ---------------------------------- */
.rm-distance-option {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	margin-bottom: 10px;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}
.rm-distance-option:has(input:checked) {
	border-color: #2271b1;
	background: #eff6ff;
}
.rm-distance-option:focus-within {
	outline: 3px solid rgba(34,113,177,.28);
	outline-offset: 2px;
}
.rm-distance-option--full {
	opacity: .55;
	cursor: not-allowed;
}
.rm-distance-option input[type="radio"] { accent-color: #2271b1; width: 18px; height: 18px; flex-shrink: 0; }
.rm-distance-label { flex: 1; }
.rm-distance-label strong { display: block; font-size: 16px; }
.rm-distance-label small  { color: #6b7280; font-size: 13px; }
.rm-category { margin-left: 6px; }
.rm-distance-price { font-weight: 700; font-size: 17px; color: #2271b1; }
.rm-full-badge {
	background: #fee2e2;
	color: #991b1b;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 10px;
	text-transform: uppercase;
}
.rm-spots { color: #6b7280; font-size: 12px; }
.rm-event-full-state {
	padding: 32px 24px;
	text-align: center;
	border-top: 4px solid #d97706;
	background: #fffbeb;
	color: #2c3338;
}
.rm-event-full-state[hidden] { display: none; }
.rm-event-full-state h2 { margin: 0 0 8px; color: #78350f; }
.rm-event-full-state p { margin: 0 0 16px; }
.rm-event-full-state:focus { outline: 3px solid rgba(34,113,177,.28); outline-offset: 3px; }
.rm-event-full-state .rm-btn:focus-visible { outline: 3px solid #2271b1; outline-offset: 3px; }
#rm-event-selection-message[hidden] { display: none; }
#rm-event-selection-message:focus { outline: 3px solid rgba(34,113,177,.28); outline-offset: 3px; }

/* Métodos de pago ---------------------------------------- */
.rm-pm-options {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 6px;
}
.rm-pm-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: border-color .15s, background .15s;
}
.rm-pm-option:has(input:checked) {
	border-color: #2271b1;
	background: #eff6ff;
	color: #2271b1;
}
.rm-pm-option input[type="radio"] { accent-color: #2271b1; width: 16px; height: 16px; }

/* Discount code ------------------------------------------ */
.rm-discount-wrap {
	display: flex;
	gap: 8px;
	align-items: center;
}
.rm-discount-wrap input {
	flex: 1;
	max-width: 260px;
}

/* Price summary ------------------------------------------ */
.rm-price-summary {
	margin-top: 20px;
	border-top: 1px solid #e5e7eb;
	padding-top: 16px;
}
.rm-price-table {
	width: 100%;
	max-width: 360px;
	border-collapse: collapse;
	margin-left: auto;
	font-size: 14px;
}
.rm-price-table td {
	padding: 6px 4px;
	vertical-align: top;
}
.rm-price-table td:last-child {
	text-align: right;
	font-weight: 600;
	white-space: nowrap;
}
.rm-ps-total td {
	padding-top: 10px;
	border-top: 2px solid #1f2937;
	font-size: 16px;
}

/* Términos ----------------------------------------------- */
.rm-terms-box {
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 14px 18px;
	margin-bottom: 14px;
	font-size: 14px;
}
.rm-terms-box ul { margin: 8px 0 0 18px; padding: 0; }
.rm-terms-box li { margin-bottom: 4px; }
.rm-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
}
.rm-checkbox-label input { margin-top: 2px; accent-color: #2271b1; width: 17px; height: 17px; flex-shrink: 0; }

/* Botones ------------------------------------------------- */
.rm-btn {
	display: inline-block;
	padding: 10px 24px;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, transform .1s;
	text-decoration: none;
}
.rm-btn--primary {
	background: #2271b1;
	color: #fff;
}
.rm-btn--primary:hover { background: #135e96; color: #fff; }
.rm-btn--primary:active { transform: scale(.98); }

.rm-btn--secondary {
	background: #f0f0f1;
	color: #2c3338;
	border: 1px solid #c3c4c7;
}
.rm-btn--secondary:hover { background: #dcdcde; color: #1d2327; }

.rm-btn--sm {
	padding: 8px 16px;
	font-size: 13px;
	border-radius: 5px;
	background: #f0f0f1;
	color: #2c3338;
	border: 1px solid #c3c4c7;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s;
}
.rm-btn--sm:hover { background: #dcdcde; }

.rm-btn--large { padding: 14px 36px; font-size: 16px; }
.rm-btn:disabled { opacity: .55; cursor: not-allowed; }

.rm-redsys-return-page {
	margin: 0;
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 24px;
	box-sizing: border-box;
	background: #f6f7f7;
	color: #1d2327;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.rm-redsys-return {
	width: min(100%, 620px);
	box-sizing: border-box;
	padding: 36px;
	border: 1px solid #dcdcde;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 8px 28px rgba(0, 0, 0, .08);
}
.rm-redsys-return h1 { margin: 0 0 12px; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; }
.rm-redsys-return__eyebrow { margin: 0 0 8px; color: #50575e; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.rm-redsys-return__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.rm-redsys-return__actions .rm-btn:focus-visible { outline: 3px solid #2271b1; outline-offset: 3px; }

.rm-submit-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 8px;
}
.rm-required-note { font-size: 12px; color: #6b7280; margin: 0; }

/* Mensajes / Notices -------------------------------------- */
.rm-notice {
	padding: 12px 18px;
	border-radius: 6px;
	font-size: 14px;
	margin-bottom: 16px;
}
.rm-notice--error   { background: #fee2e2; border-left: 4px solid #d63638; color: #991b1b; }
.rm-notice--success { background: #d1fae5; border-left: 4px solid #059669; color: #065f46; }
.rm-notice--info    { background: #e0e7ff; border-left: 4px solid #4f46e5; color: #3730a3; }
.rm-notice--warning { background: #fef3c7; border-left: 4px solid #d97706; color: #92400e; }

/* Pantalla de éxito final --------------------------------- */
.rm-success-screen {
	text-align: center;
	padding: 48px 24px;
}
.rm-success-icon {
	width: 72px;
	height: 72px;
	background: #d1fae5;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 36px;
	color: #059669;
	margin: 0 auto 20px;
}
.rm-success-screen h2 { font-size: 24px; color: #065f46; margin-bottom: 12px; }
.rm-success-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 20px;
}
.rm-registration-finished {
	margin: 20px auto 0;
	max-width: 520px;
	padding: 12px 16px;
	border-left: 4px solid #059669;
	background: #d1fae5;
	color: #065f46;
	font-weight: 600;
}
.rm-registration-finished:focus { outline: 3px solid rgba(34,113,177,.28); outline-offset: 3px; }

/* Loading spinner ----------------------------------------- */
.rm-loading-distances {
	text-align: center;
	padding: 24px;
	color: #6b7280;
	font-style: italic;
}

/* Icon + Step title --------------------------------------- */
.rm-icon { margin-right: 4px; }
.rm-step-title { font-size: 22px; margin-bottom: 20px; }
.rm-public-participants,
.rm-registration-copy { margin: 1.5rem 0; }
.rm-participants-summary { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; margin-bottom: 1rem; }
.rm-participants-list { margin: 0 0 1rem; padding-left: 1.5rem; }
.rm-participants-list li { margin: .25rem 0; }
.rm-pagination { align-items: center; display: flex; gap: 1rem; justify-content: center; }
.rm-registration-copy label { display: block; font-weight: 600; margin-bottom: .25rem; }
.rm-registration-copy input { display: block; max-width: 28rem; width: 100%; }
.rm-organizer-portal { max-width: 1100px; margin: 2rem auto; padding: 1.5rem; background: #fff; border: 1px solid #dcdcde; border-radius: 8px; }
.rm-organizer-portal__header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.rm-organizer-portal__filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; align-items: end; margin: 1.5rem 0; }
.rm-organizer-portal__filters label { font-weight: 600; }
.rm-organizer-portal__filters input, .rm-organizer-portal__filters select { min-width: 0; padding: .5rem; }
.rm-organizer-portal__table-wrap { overflow-x: auto; }
.rm-organizer-portal table { width: 100%; border-collapse: collapse; }
.rm-organizer-portal th, .rm-organizer-portal td { padding: .6rem; border-bottom: 1px solid #dcdcde; text-align: left; vertical-align: top; }
.rm-organizer-portal__detail { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: .5rem 1rem; }
.rm-organizer-portal__detail dt { font-weight: 600; }
.rm-organizer-portal__detail dd { margin: 0; }
@media (max-width: 720px) { .rm-organizer-portal__filters { grid-template-columns: 1fr; } .rm-organizer-portal__header { display: block; } .rm-organizer-portal__logout { display: inline-block; margin-top: .75rem; } .rm-organizer-portal__detail { grid-template-columns: 1fr; } }
