/**
 * Estilos del modal de Autenticación de Tucdia.
 * Utiliza variables del sistema de diseño (tokens) del theme.
 */

[x-cloak] {
	display: none !important;
}

/* Contenedor wrapper */
.td-auth-wrapper {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--td-s4);
}

/* Overlay de fondo */
.td-auth-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(4px);
}

/* Contenedor del Modal */
.td-auth-modal {
	position: relative;
	width: 100%;
	max-width: 440px;
	background: var(--td-bg);
	border: 1px solid var(--td-border);
	border-radius: var(--td-radius);
	box-shadow: var(--td-shadow);
	z-index: 10000;
	overflow: hidden;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Botón Cerrar */
.td-auth-close {
	position: absolute;
	top: var(--td-s4);
	right: var(--td-s4);
	background: none;
	border: none;
	color: var(--td-text-soft);
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color 0.2s, color 0.2s;
	padding: 0;
}

.td-auth-close:hover {
	background: var(--td-bg-alt);
	color: var(--td-text);
}

/* Contenido */
.td-auth-content {
	padding: var(--td-s8) var(--td-s6) var(--td-s6);
}

.td-auth-header {
	text-align: center;
	margin-bottom: var(--td-s6);
}

/* Alternancia de logotipos en modal (sincronizada con el dark mode del theme) */
.td-auth-logo {
	max-height: 48px;
	width: auto;
	margin-bottom: var(--td-s4);
	display: block;
	margin-inline: auto;
}

.td-logo-dark {
	display: none;
}

[data-theme="dark"] .td-logo-light,
html[data-td-auto="dark"] body[data-theme="auto"] .td-logo-light {
	display: none;
}

[data-theme="dark"] .td-logo-dark,
html[data-td-auto="dark"] body[data-theme="auto"] .td-logo-dark {
	display: block;
}

.td-auth-title {
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--td-text);
	margin: 0 0 var(--td-s2);
}

.td-auth-subtitle {
	font-size: 0.9rem;
	color: var(--td-text-soft);
	margin: 0;
}

/* Alerta de éxito */
.td-auth-success {
	background: #f0fdf4;
	border: 1px solid #86efac;
	color: #166534;
	font-size: 0.85rem;
	padding: var(--td-s3);
	border-radius: var(--td-radius);
	margin-bottom: var(--td-s4);
}

[data-theme="dark"] .td-auth-success {
	background: #14532d;
	border-color: #166534;
	color: #86efac;
}

/* Alertas de error */
.td-auth-alert {
	background: #fdf2f2;
	border: 1px solid #f8b4b4;
	color: #9b1c1c;
	font-size: 0.85rem;
	padding: var(--td-s3);
	border-radius: var(--td-radius);
	margin-bottom: var(--td-s4);
}

[data-theme="dark"] .td-auth-alert {
	background: #2b1a1a;
	border: 1px solid #771d1d;
	color: #f8b4b4;
}

/* Formulario */
.td-auth-step {
	display: flex;
	flex-direction: column;
	gap: var(--td-s4);
}

.td-auth-field {
	display: flex;
	flex-direction: column;
	gap: var(--td-s2);
}

.td-auth-label {
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--td-text);
}

.td-auth-input {
	font-family: inherit;
	font-size: 1rem;
	padding: var(--td-s3);
	border: 1px solid var(--td-border);
	background: var(--td-bg);
	color: var(--td-text);
	border-radius: var(--td-radius);
	transition: border-color 0.2s, box-shadow 0.2s;
	width: 100%;
	box-sizing: border-box;
}

.td-auth-input:focus {
	outline: none;
	border-color: var(--td-primary);
	box-shadow: 0 0 0 3px var(--td-primary-soft);
}

.td-auth-input:disabled {
	background: var(--td-bg-alt);
	color: var(--td-text-soft);
	cursor: not-allowed;
}

/* Botón submit */
.td-auth-submit {
	background: var(--td-primary);
	color: #fff;
	border: none;
	font-size: 1rem;
	font-weight: 700;
	padding: var(--td-s3);
	border-radius: var(--td-radius);
	cursor: pointer;
	transition: background-color 0.2s;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	width: 100%;
}

.td-auth-submit:hover:not(:disabled) {
	background: var(--td-primary-dark);
}

.td-auth-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Badge de usuario en pasos avanzados */
.td-auth-user-badge {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--td-s2) var(--td-s3);
	background: var(--td-bg-alt);
	border-radius: var(--td-radius);
	font-size: 0.85rem;
}

.td-auth-user-email {
	font-weight: 500;
	color: var(--td-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 250px;
}

.td-auth-change-user {
	background: none;
	border: none;
	color: var(--td-primary-fg);
	font-weight: 700;
	cursor: pointer;
	padding: 0;
	font-size: 0.85rem;
}

.td-auth-change-user:hover {
	text-decoration: underline;
}

.td-auth-register-info {
	font-size: 0.85rem;
	color: var(--td-text-soft);
	line-height: 1.4;
	margin: 0 0 var(--td-s2);
}

/* Animaciones y Transiciones */
.td-fade-enter {
	transition: opacity 0.2s ease-out;
}
.td-fade-leave {
	transition: opacity 0.2s ease-in;
}

.td-slide-enter {
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease-out;
}
.td-slide-leave {
	transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

.td-slide-start {
	transform: scale(0.95) translateY(10px);
	opacity: 0;
}
.td-slide-end {
	transform: scale(1) translateY(0);
	opacity: 1;
}

/* Spinner de carga */
.td-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: td-spin 1s ease-in-out infinite;
}

@keyframes td-spin {
	to { transform: rotate(360deg); }
}

/* Widget Cloudflare Turnstile (solo visible en producción con sitekey) */
.td-auth-turnstile {
	margin: 0 0 16px;
	display: flex;
	justify-content: center;
}

/* Link de recupero / volver — igual a .td-auth-change-user pero centrado */
.td-auth-forgot {
	display: block;
	width: 100%;
	text-align: center;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--td-primary-fg);
	margin-top: var(--td-s2);
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	text-decoration: none;
}

.td-auth-forgot:hover {
	text-decoration: underline;
}

/* =========================================================
   PÁGINA DE LOGIN STANDALONE (page-login.php)
   ========================================================= */

.td-login-page-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	padding: var(--td-s8) var(--td-s4);
}

.td-login-page {
	width: 100%;
	max-width: 440px;
	background: var(--td-bg);
	border: 1px solid var(--td-border);
	border-radius: var(--td-radius);
	box-shadow: var(--td-shadow);
	padding: var(--td-s8) var(--td-s6) var(--td-s6);
}
