/**
 * SISGED VI — Login institucional MINEDU (blanco / rojo)
 */
:root {
	--minedu-rojo: #c8102e;
	--minedu-rojo-oscuro: #9e0c24;
	--minedu-rojo-claro: #fde8ec;
	--minedu-gris: #4d5154;
	--minedu-gris-claro: #f4f4f5;
	--minedu-blanco: #ffffff;
	--minedu-texto: #1a1a1a;
	--minedu-texto-muted: #5c6570;
	--minedu-borde: #e2e4e8;
	--minedu-sombra: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(200, 16, 46, 0.06);
	--minedu-font: "Plus Jakarta Sans", system-ui, sans-serif;
	--sg-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body.sisged-login-page {
	margin: 0;
	min-height: 100%;
	font-family: var(--minedu-font);
	color: var(--minedu-texto);
	background: var(--minedu-blanco);
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
}

/* Fondo */
.sisged-bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background: linear-gradient(135deg, #fafafa 0%, #fff 40%, var(--minedu-rojo-claro) 100%);
}

.sisged-bg__pattern {
	position: absolute;
	inset: 0;
	opacity: 0.4;
	background-image: radial-gradient(circle at 1px 1px, rgba(200, 16, 46, 0.06) 1px, transparent 0);
	background-size: 28px 28px;
}

.sisged-bg__stripe {
	position: absolute;
	top: 0;
	left: 0;
	width: 6px;
	height: 100%;
	background: var(--minedu-rojo);
}

/* Layout */
.sisged-shell {
	position: relative;
	z-index: 1;
	min-height: 100vh;
	display: grid;
	grid-template-columns: minmax(300px, 1fr) minmax(360px, 520px);
}

/* Hero izquierdo — panel blanco moderno */
.sisged-hero {
	background:
		radial-gradient(ellipse 90% 60% at 100% 0%, rgba(200, 16, 46, 0.07) 0%, transparent 55%),
		radial-gradient(ellipse 70% 50% at 0% 100%, rgba(200, 16, 46, 0.04) 0%, transparent 50%),
		linear-gradient(180deg, #ffffff 0%, #f8f9fb 100%);
	color: var(--minedu-texto);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(2rem, 5vw, 3.5rem);
	position: relative;
	overflow: hidden;
	border-right: 1px solid var(--minedu-borde);
}

.sisged-hero::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 4px;
	height: 100%;
	background: linear-gradient(180deg, var(--minedu-rojo) 0%, var(--minedu-rojo-oscuro) 100%);
}

.sisged-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	opacity: 0.35;
	background-image: radial-gradient(circle at 1px 1px, rgba(200, 16, 46, 0.05) 1px, transparent 0);
	background-size: 32px 32px;
	pointer-events: none;
}

.sisged-hero__inner {
	max-width: 420px;
	position: relative;
	z-index: 1;
	text-align: center;
}

.sisged-hero__logo-wrap {
	display: flex;
	justify-content: center;
	margin-bottom: 1.5rem;
}

.sisged-hero__logo-minedu {
	display: block;
	width: 108px;
	height: auto;
	padding: 0.85rem;
	background: var(--minedu-blanco);
	border-radius: 20px;
	border: 1px solid var(--minedu-borde);
	box-shadow:
		0 4px 20px rgba(0, 0, 0, 0.05),
		0 1px 3px rgba(200, 16, 46, 0.06);
	animation: sgLogoIn 0.8s var(--sg-ease-out) both;
}

@keyframes sgLogoIn {
	from {
		opacity: 0;
		transform: scale(0.85) translateY(12px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.sisged-hero__badge {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--minedu-rojo);
	background: var(--minedu-rojo-claro);
	border: 1px solid rgba(200, 16, 46, 0.12);
	padding: 0.4rem 0.9rem;
	border-radius: 999px;
	margin-bottom: 1rem;
}

.sisged-hero__title {
	font-size: clamp(1.85rem, 4vw, 2.5rem);
	font-weight: 800;
	margin: 0 0 0.75rem;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--minedu-texto);
}

.sisged-hero__title-accent {
	color: var(--minedu-rojo);
}

.sisged-hero__subtitle {
	font-size: 1rem;
	line-height: 1.65;
	color: var(--minedu-texto-muted);
	margin: 0 auto 1.75rem;
	max-width: 38ch;
}

.sisged-hero__features {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.sisged-hero__features li {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--minedu-gris);
	padding: 0.85rem 1rem;
	background: var(--minedu-blanco);
	border-radius: 14px;
	border: 1px solid var(--minedu-borde);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
	transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--sg-ease-out);
}

.sisged-hero__features li:hover {
	border-color: rgba(200, 16, 46, 0.2);
	box-shadow: 0 6px 20px rgba(200, 16, 46, 0.08);
	transform: translateX(4px);
}

.sisged-hero__features li::before {
	content: "";
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--minedu-rojo-claro) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c8102e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* Panel acceso — estilo tecnológico */
.sisged-access {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: clamp(1.5rem, 4vw, 3rem);
	background:
		linear-gradient(180deg, #f8fafc 0%, #ffffff 50%, #fafbfc 100%);
	position: relative;
	overflow: hidden;
}

.sisged-access__decor {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.sisged-access__grid {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(200, 16, 46, 0.04) 1px, transparent 1px),
		linear-gradient(90deg, rgba(200, 16, 46, 0.04) 1px, transparent 1px);
	background-size: 48px 48px;
	mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
	-webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
}

.sisged-access__orb {
	position: absolute;
	border-radius: 50%;
	filter: blur(60px);
	opacity: 0.45;
}

.sisged-access__orb--1 {
	width: 280px;
	height: 280px;
	top: -60px;
	right: -40px;
	background: rgba(200, 16, 46, 0.12);
	animation: sgOrbFloat 8s ease-in-out infinite;
}

.sisged-access__orb--2 {
	width: 220px;
	height: 220px;
	bottom: 10%;
	left: -50px;
	background: rgba(200, 16, 46, 0.08);
	animation: sgOrbFloat 10s ease-in-out infinite reverse;
}

@keyframes sgOrbFloat {
	0%, 100% { transform: translate(0, 0); }
	50% { transform: translate(12px, -16px); }
}

.sisged-card {
	width: 100%;
	max-width: 440px;
	padding: clamp(1.75rem, 4vw, 2.35rem);
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(226, 228, 232, 0.9);
	border-radius: 24px;
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.07),
		0 0 0 1px rgba(255, 255, 255, 0.8) inset,
		0 8px 32px rgba(200, 16, 46, 0.06);
	position: relative;
	z-index: 1;
}

.sisged-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 1.5rem;
	right: 1.5rem;
	height: 4px;
	background: linear-gradient(90deg, var(--minedu-rojo), #e8354f, var(--minedu-rojo));
	border-radius: 0 0 4px 4px;
}

.sisged-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 24px;
	padding: 1px;
	background: linear-gradient(145deg, rgba(200, 16, 46, 0.15), transparent 40%, rgba(200, 16, 46, 0.05));
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

.sisged-card__status {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.68rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--minedu-texto-muted);
	background: var(--minedu-gris-claro);
	border: 1px solid var(--minedu-borde);
	border-radius: 999px;
	padding: 0.35rem 0.75rem;
	margin-bottom: 1.25rem;
}

.sisged-card__status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
	animation: sgPulseDot 2s ease-in-out infinite;
}

@keyframes sgPulseDot {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

.sisged-card__header {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.sisged-card__logo-sm {
	flex-shrink: 0;
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sisged-card__eyebrow {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--minedu-rojo);
	margin: 0 0 0.25rem;
}

.sisged-card__title {
	font-size: 1.5rem;
	font-weight: 800;
	margin: 0 0 0.25rem;
	color: var(--minedu-texto);
	letter-spacing: -0.02em;
}

.sisged-card__hint {
	font-size: 0.88rem;
	color: var(--minedu-texto-muted);
	margin: 0;
}

/* Campos */
.sisged-field {
	margin-bottom: 1.1rem;
}

.sisged-field__label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--minedu-gris);
	margin-bottom: 0.4rem;
}

.sisged-field__control {
	position: relative;
	display: flex;
	align-items: center;
}

.sisged-field__icon {
	position: absolute;
	left: 1rem;
	color: var(--minedu-texto-muted);
	pointer-events: none;
	display: flex;
}

.sisged-field__control:focus-within .sisged-field__icon {
	color: var(--minedu-rojo);
}

.sisged-field__input {
	width: 100%;
	padding: 0.85rem 1rem 0.85rem 2.75rem;
	font-family: var(--minedu-font);
	font-size: 1rem;
	color: var(--minedu-texto);
	background: rgba(244, 244, 245, 0.85);
	border: 1px solid var(--minedu-borde);
	border-radius: 14px;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s var(--sg-ease-out);
}

.sisged-field__control:focus-within .sisged-field__input {
	transform: translateY(-1px);
}

.sisged-field__input--plain {
	padding-left: 1rem;
}

.sisged-field__input:focus {
	outline: none;
	border-color: var(--minedu-rojo);
	background: var(--minedu-blanco);
	box-shadow: 0 0 0 4px var(--minedu-rojo-claro);
}

.sisged-field__input.is-invalid {
	border-color: #dc3545;
	box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.15);
}

.sisged-field__toggle {
	position: absolute;
	right: 0.65rem;
	background: none;
	border: none;
	color: var(--minedu-texto-muted);
	cursor: pointer;
	padding: 0.35rem;
	display: flex;
	border-radius: 8px;
}

.sisged-field__toggle:hover {
	color: var(--minedu-rojo);
	background: var(--minedu-rojo-claro);
}

/* Botones */
.sisged-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-family: var(--minedu-font);
	font-size: 0.95rem;
	font-weight: 700;
	border: none;
	border-radius: 12px;
	padding: 0.9rem 1.5rem;
	cursor: pointer;
	transition: transform 0.2s var(--sg-ease-out), box-shadow 0.2s, background 0.2s;
}

.sisged-btn--primary {
	width: 100%;
	margin-top: 0.35rem;
	color: var(--minedu-blanco);
	background: linear-gradient(135deg, var(--minedu-rojo) 0%, #a50d26 100%);
	box-shadow: 0 8px 24px rgba(200, 16, 46, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
	position: relative;
	overflow: hidden;
}

.sisged-btn--primary::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
	transform: translateX(-100%);
	transition: transform 0.6s var(--sg-ease-out);
}

.sisged-btn--primary:hover:not(:disabled)::before {
	transform: translateX(100%);
}

.sisged-btn--primary:hover:not(:disabled) {
	background: var(--minedu-rojo-oscuro);
	transform: translateY(-1px);
	box-shadow: 0 10px 28px rgba(200, 16, 46, 0.4);
}

.sisged-btn--ghost {
	background: var(--minedu-gris-claro);
	color: var(--minedu-gris);
	border: 1px solid var(--minedu-borde);
}

.sisged-btn--ghost:hover {
	background: #e8e8ea;
}

.sisged-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none !important;
}

.sisged-link {
	display: block;
	width: 100%;
	margin-top: 1.15rem;
	padding: 0;
	background: none;
	border: none;
	text-align: center;
	font-family: var(--minedu-font);
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--minedu-rojo);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sisged-link:hover {
	color: var(--minedu-rojo-oscuro);
}

.sisged-spinner {
	width: 1.1rem;
	height: 1.1rem;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sgSpin 0.65s linear infinite;
}

.sisged-spinner--light {
	border-color: rgba(200, 16, 46, 0.2);
	border-top-color: var(--minedu-rojo);
}

@keyframes sgSpin {
	to { transform: rotate(360deg); }
}

.sisged-footer {
	margin-top: 1.5rem;
	font-size: 0.68rem;
	color: var(--minedu-texto-muted);
	text-align: center;
	line-height: 1.5;
	max-width: 420px;
	position: relative;
	z-index: 1;
}

/* Animaciones entrada */
.sisged-reveal {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.65s var(--sg-ease-out), transform 0.65s var(--sg-ease-out);
}

body.sisged-ready .sisged-reveal {
	opacity: 1;
	transform: translateY(0);
}

body.sisged-ready .sisged-reveal[data-delay="1"] { transition-delay: 0.05s; }
body.sisged-ready .sisged-reveal[data-delay="2"] { transition-delay: 0.12s; }
body.sisged-ready .sisged-reveal[data-delay="3"] { transition-delay: 0.2s; }
body.sisged-ready .sisged-reveal[data-delay="4"] { transition-delay: 0.28s; }
body.sisged-ready .sisged-reveal[data-delay="5"] { transition-delay: 0.36s; }
body.sisged-ready .sisged-reveal[data-delay="6"] { transition-delay: 0.44s; }
body.sisged-ready .sisged-reveal[data-delay="7"] { transition-delay: 0.52s; }

/* ========== POPUP (overlay fijo, centrado) ========== */
.sisged-popup {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s;
}

.sisged-popup.is-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.sisged-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(26, 26, 26, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.sisged-popup__wrap {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 440px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sisged-popup__dialog {
	width: 100%;
	background: var(--minedu-blanco);
	border-radius: 20px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
	border: 1px solid var(--minedu-borde);
	overflow: hidden;
	transform: scale(0.92) translateY(16px);
	opacity: 0;
	transition: transform 0.35s var(--sg-ease-out), opacity 0.35s var(--sg-ease-out);
}

.sisged-popup.is-open .sisged-popup__dialog {
	transform: scale(1) translateY(0);
	opacity: 1;
}

.sisged-popup__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--minedu-borde);
	background: var(--minedu-gris-claro);
}

.sisged-popup__eyebrow {
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--minedu-rojo);
	margin: 0 0 0.2rem;
}

.sisged-popup__title {
	font-size: 1.2rem;
	font-weight: 800;
	margin: 0;
	color: var(--minedu-texto);
}

.sisged-popup__close {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 10px;
	background: var(--minedu-blanco);
	color: var(--minedu-gris);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: background 0.2s, color 0.2s;
}

.sisged-popup__close:hover {
	background: var(--minedu-rojo);
	color: var(--minedu-blanco);
}

.sisged-popup__body {
	padding: 1.25rem 1.5rem;
}

.sisged-popup__desc {
	font-size: 0.88rem;
	color: var(--minedu-texto-muted);
	margin: 0 0 1.15rem;
}

.sisged-popup__footer {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	padding: 1rem 1.5rem 1.25rem;
	border-top: 1px solid var(--minedu-borde);
	background: #fafafa;
}

.sisged-popup__footer .sisged-btn--primary {
	width: auto;
	margin-top: 0;
}

body.sisged-popup-open {
	overflow: hidden;
}

/* Toastr — contenedor #toastr-container (no confundir con Bootstrap #toast-container) */
body.sisged-login-page #toastr-container {
	z-index: 11000 !important;
}

body.sisged-login-page #toastr-container > div {
	border-radius: 14px !important;
	font-family: var(--minedu-font) !important;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22) !important;
	opacity: 1 !important;
	min-width: 340px;
	width: auto !important;
	max-width: 420px;
	padding: 16px 16px 16px 54px !important;
	color: #ffffff !important;
	background-color: #1f2937 !important;
	background-image: none !important;
	border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.sisged-login-page #toastr-container > .toastr-success,
body.sisged-login-page #toastr-container > div.toastr-success {
	background-color: #15803d !important;
	border-color: rgba(255, 255, 255, 0.15) !important;
}

body.sisged-login-page #toastr-container > .toastr-error,
body.sisged-login-page #toastr-container > div.toastr-error {
	background-color: #b91c1c !important;
	border-color: rgba(255, 255, 255, 0.15) !important;
}

body.sisged-login-page #toastr-container > .toastr-warning,
body.sisged-login-page #toastr-container > div.toastr-warning {
	background-color: #b45309 !important;
	border-color: rgba(255, 255, 255, 0.15) !important;
}

body.sisged-login-page #toastr-container > .toastr-info,
body.sisged-login-page #toastr-container > div.toastr-info {
	background-color: #1d4ed8 !important;
	border-color: rgba(255, 255, 255, 0.15) !important;
}

body.sisged-login-page #toastr-container .toastr-title {
	font-weight: 700 !important;
	color: #ffffff !important;
}

body.sisged-login-page #toastr-container .toastr-message {
	color: rgba(255, 255, 255, 0.96) !important;
}

body.sisged-login-page #toastr-container .toastr-close-button {
	color: #ffffff !important;
	text-shadow: none !important;
	opacity: 0.9 !important;
	font-weight: 700;
}

body.sisged-login-page #toastr-container .toastr-progress {
	background-color: rgba(255, 255, 255, 0.35) !important;
	opacity: 1 !important;
}

/* Responsive */
@media (max-width: 1024px) {
	.sisged-shell {
		grid-template-columns: 1fr;
	}

	.sisged-hero {
		padding: 2rem 1.5rem;
		border-right: none;
		border-bottom: 1px solid var(--minedu-borde);
	}

	.sisged-hero::before {
		width: 100%;
		height: 4px;
	}

	.sisged-hero__inner {
		text-align: center;
		margin: 0 auto;
	}

	.sisged-hero__subtitle {
		max-width: none;
		margin-left: auto;
		margin-right: auto;
	}

	.sisged-hero__features {
		display: none;
	}

	.sisged-bg__stripe {
		width: 100%;
		height: 5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sisged-reveal,
	.sisged-popup__dialog,
	.sisged-hero__logo-minedu {
		transition: none !important;
		animation: none !important;
	}

	.sisged-reveal {
		opacity: 1;
		transform: none;
	}

	.sisged-hero__features li:hover {
		transform: none;
	}

	.sisged-access__orb,
	.sisged-card__status-dot,
	.sisged-btn--primary::before {
		animation: none !important;
	}
}
