/* ── Design system — Portal ILC (handoff docs/design_handoff_portal_ilc) ──
   Marca:      navy #14234D · navy-deep #0E1A3A · navy-mid #1E3566
   Secundario: periwinkle #4A63AE · texto #33478A/#3A4E96 · tint #ECEFF8
   Acento:     naranja #F2984B/#F9A65A · eyebrows sobre blanco #C46A16
   Semánticos: éxito #15875A/#E7F4EE · advertencia #B5740E/#FBF1DD · error #C5403C/#FBE9E8 */
:root {
	--ilc-navy: #14234D;
	--ilc-navy-deep: #0E1A3A;
	--ilc-navy-mid: #1E3566;
	--ilc-periwinkle: #4A63AE;
	--ilc-periwinkle-text: #33478A;
	--ilc-periwinkle-tint: #ECEFF8;
	--ilc-orange: #F2984B;
	--ilc-orange-dark: #C46A16;
	--ilc-orange-tint: #FDF0E2;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Public Sans', system-ui, sans-serif; color: #1A2436; background: #F5F6F8; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D2D7DF; border-radius: 8px; border: 2px solid #F5F6F8; }
::-webkit-scrollbar-track { background: transparent; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
.mono { font-family: 'IBM Plex Mono', monospace; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.skel { background: linear-gradient(90deg,#EEF0F3 25%,#E2E5EA 37%,#EEF0F3 63%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; border-radius: 6px; }
.navlink:hover { background: #E7EAF6 !important; }
.navlink.active { background: #4A63AE !important; color: #fff !important; }
.navlink.active:hover { background: #3A4E96 !important; }
/* Ítem activo: engrosar el glifo del ícono (aproxima la variante fill de Phosphor) */
.navlink.active svg path { stroke: currentColor; stroke-width: 10; }
/* Dropzone resaltada al arrastrar un archivo encima (toggle vía atributos ondrag* nativos) */
.dz-over { border-color: #4A63AE !important; background: #ECEFF8 !important; }
.row-hover:hover { background: #FAFBFC !important; }
.lift { transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.lift:hover { box-shadow: 0 8px 24px rgba(16,24,40,.10) !important; transform: translateY(-2px); border-color: #C9D2E0 !important; }
.btn { transition: filter .12s ease, background .12s ease, border-color .12s ease; cursor: pointer; }
.btn:hover { filter: brightness(.96); }
.ghost:hover { background: #EEF2F8 !important; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* ── Shell layout ────────────────────────────────────────────────────────── */
.sp-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sp-sidebar { background: #F4F6FC; border-right: 1px solid #E6EAF2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sp-main { display: flex; flex-direction: column; min-width: 0; }
.sp-topbar { position: sticky; top: 0; z-index: 20; height: 60px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid #E9ECF1; display: flex; align-items: center; gap: 18px; padding: 0 26px; flex-shrink: 0; }
.sp-content { flex: 1; padding: 26px 30px 60px; }
.sp-content-inner { max-width: 1180px; margin: 0 auto; animation: fadeUp .25s ease; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid #E4E7EC; border-radius: 16px; padding: 22px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.sp-table { width: 100%; border-collapse: collapse; }
.sp-table th { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8A93A3; padding: 10px 14px; text-align: left; border-bottom: 1px solid #EEF0F3; background: #F8F9FB; }
.sp-table td { font-size: 13.5px; color: #1A2436; padding: 12px 14px; border-bottom: 1px solid #F2F4F7; vertical-align: middle; }
.sp-table tr:last-child td { border-bottom: none; }
.sp-table tbody tr { cursor: pointer; }
.sp-table tbody tr:hover td { background: #FAFBFC; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.sp-input { width: 100%; border: 1px solid #D2D7DF; border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit; color: #1A2436; background: #fff; }
.sp-input:focus { outline: none; border-color: #14234D; box-shadow: 0 0 0 3px rgba(20,35,77,.12); }
.sp-select { width: 100%; border: 1px solid #D2D7DF; border-radius: 9px; padding: 0 12px; font-size: 14px; font-family: inherit; color: #1A2436; background: #fff; }
/* Altura uniforme para controles de una línea; los textarea con .sp-input conservan su alto. */
input.sp-input, select.sp-input, .sp-select { height: 40px; box-sizing: border-box; }
select.sp-input { padding-top: 0; padding-bottom: 0; }
.sp-label { display: block; font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 6px; }
.sp-textarea { width: 100%; border: 1px solid #D2D7DF; border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit; color: #1A2436; background: #fff; resize: vertical; }
.sp-textarea:focus { outline: none; border-color: #14234D; box-shadow: 0 0 0 3px rgba(20,35,77,.12); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.sp-tabs { display: flex; gap: 2px; border-bottom: 1px solid #E4E7EC; margin-bottom: 22px; }
.sp-tab { background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 600; color: #5A6473; padding: 12px 18px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sp-tab.active { color: #14234D; border-bottom-color: #14234D; }
.sp-tab:hover:not(.active) { color: #1A2436; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.sp-pag { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 0; }
.sp-pag-btn { background: #fff; border: 1px solid #E4E7EC; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: #1A2436; cursor: pointer; font-family: inherit; }
.sp-pag-btn:disabled { opacity: .4; cursor: not-allowed; }
.sp-pag-btn:not(:disabled):hover { background: #F8F9FB; }

/* ── Spinner / loading ───────────────────────────────────────────────────── */
.sp-spinner { width: 36px; height: 36px; border: 3px solid #E4E7EC; border-top-color: #14234D; border-radius: 50%; animation: spin 0.8s linear infinite; }
.sp-loading { display: flex; align-items: center; justify-content: center; padding: 72px; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.sp-alert-error { background: #FBE9E8; border: 1px solid #F2CBC9; border-radius: 10px; padding: 12px 16px; color: #C5403C; font-size: 13.5px; margin-bottom: 16px; }
.sp-alert-success { background: #E7F4EE; border: 1px solid #BFDECF; border-radius: 10px; padding: 12px 16px; color: #15875A; font-size: 13.5px; margin-bottom: 16px; }

/* ── Student layout ──────────────────────────────────────────────────────── */
.sp-student-sidebar { background: #F7F8FC; }
.sp-student-content { max-width: 1180px; }

/* ── Responsive / móvil ─────────────────────────────────────────────────────
   El diseño usa estilos inline extensivamente, así que esta capa adapta el
   layout en pantallas pequeñas con selectores de atributo ([style*=…]) e
   !important, sin tocar el markup de las páginas ni su funcionamiento.
   Los toggles de navegación móvil son checkboxes CSS-only (.sp-nav-toggle)
   activados vía :has(); App.razor los des-marca al navegar. */

img { max-width: 100%; }

/* Toggle accesible: oculto visualmente pero enfocable (espacio lo activa) */
.sp-nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.sp-nav-burger, .sp-nav-backdrop, .pub-nav-burger { display: none; }

@media (max-width: 900px) {
	body { overflow-x: clip; }

	/* Shell: el sidebar pasa a ser un drawer deslizante */
	.sp-shell { display: block; }
	.sp-sidebar {
		position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
		width: min(300px, 84vw); z-index: 60;
		transform: translateX(-102%); visibility: hidden;
		transition: transform .22s ease, visibility .22s;
		box-shadow: 0 16px 48px rgba(14,26,58,.28);
	}
	.sp-shell:has(.sp-nav-toggle:checked) .sp-sidebar { transform: translateX(0); visibility: visible; }
	.sp-nav-backdrop {
		display: block; position: fixed; inset: 0; z-index: 50;
		background: rgba(14,26,58,.45); opacity: 0; pointer-events: none; transition: opacity .2s ease;
	}
	.sp-shell:has(.sp-nav-toggle:checked) .sp-nav-backdrop { opacity: 1; pointer-events: auto; }
	.sp-nav-burger {
		display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
		background: #fff; border: 1px solid #E4E7EC; border-radius: 10px; color: #14234D; cursor: pointer;
	}
	.sp-shell:has(.sp-nav-toggle:focus-visible) .sp-nav-burger { outline: 2px solid #14234D; outline-offset: 2px; }

	.sp-topbar { padding: 0 14px; gap: 10px; }
	.sp-topbar-search, .sp-topbar-user, .sp-topbar-sub { display: none !important; }
	.sp-topbar-right { margin-left: auto; }
	.sp-content { padding: 18px 14px 44px; }

	/* Tablas: scroll horizontal en su contenedor (las columnas no se rompen) */
	:is(div, section):has(> .sp-table) { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
	.sp-table th { white-space: nowrap; }

	/* Calendario semanal de entrevistas: scroll horizontal */
	:is(div, section):has(> [style*="grid-template-columns:54px repeat(5,1fr)"]) { overflow-x: auto !important; }
	[style*="grid-template-columns:54px repeat(5,1fr)"] { min-width: 660px; }

	/* Grids con panel lateral fijo → una columna */
	[style*="grid-template-columns:minmax(0,1fr) 320px"],
	[style*="grid-template-columns:minmax(0,1fr) 300px"],
	[style*="grid-template-columns:1fr 300px"],
	[style*="grid-template-columns:1fr 360px"],
	[style*="grid-template-columns:1fr 380px"],
	[style*="grid-template-columns:360px 1fr"],
	[style*="grid-template-columns:260px 1fr 310px"],
	[style*="grid-template-columns:2fr 1fr"],
	[style*="grid-template-columns:3fr 2fr"],
	[style*="grid-template-columns:42% 58%"],
	[style*="grid-template-columns:1.25fr 1fr"],
	[style*="grid-template-columns:1.15fr .85fr"],
	[style*="grid-template-columns:1.08fr .92fr"] { grid-template-columns: minmax(0,1fr) !important; }

	/* Sub-nav lateral fija del perfil → bloque de ancho completo */
	[style*="width:220px"][style*="position:sticky"] { position: static !important; width: 100% !important; }
	div:has(> [style*="width:220px"][style*="position:sticky"]) { flex-direction: column; }
}

@media (max-width: 720px) {
	/* Grids de 3 y 4 columnas → 2 columnas */
	[style*="grid-template-columns:repeat(4,1fr)"],
	[style*="grid-template-columns:repeat(3,1fr)"],
	[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

	/* Foto + biografía (columna auto con imagen fija) → apilar */
	[style*="grid-template-columns:auto 1fr"] { grid-template-columns: minmax(0,1fr) !important; }

	/* Encabezados de página con título + acciones: permitir salto de línea */
	[style*="justify-content:space-between"] { flex-wrap: wrap; }

	/* Tipografía display de héroes y cifras grandes */
	[style*="font-size:52px"] { font-size: 34px !important; }
	[style*="font-size:44px"] { font-size: 30px !important; }
	[style*="font-size:38px"] { font-size: 28px !important; }
	[style*="font-size:36px"] { font-size: 27px !important; }
	[style*="font-size:34px"] { font-size: 26px !important; }
	[style*="font-size:32px"] { font-size: 25px !important; }
	[style*="font-size:31px"] { font-size: 24px !important; }
	[style*="font-size:30px"] { font-size: 24px !important; }

	.sp-tabs { overflow-x: auto; }
	.sp-tab { padding: 10px 12px; font-size: 13.5px; white-space: nowrap; }
}

@media (max-width: 640px) {
	/* Pares de campos y grids 2-col → una columna (cubre también "1fr 1fr 1fr") */
	[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: minmax(0,1fr) !important; }

	/* Tarjetas de convocatoria del landing (texto denso; gap:20px las distingue
	   de los KPI de 3 columnas, que sí caben a dos) → una columna */
	[style*="grid-template-columns:repeat(3,1fr)"][style*="gap:20px"] { grid-template-columns: minmax(0,1fr) !important; }

	/* Filtros con anchos mínimos fijos */
	select[style*="width:200px"] { width: 100% !important; }
	select[style*="min-width:280px"] { min-width: 0 !important; }
	select[style*="min-width:160px"] { min-width: 120px !important; }
	[style*="min-width:220px"] { min-width: 150px !important; }
	div:has(> [style*="min-width:220px"]) { flex-wrap: wrap; }

	/* Dropdown de notificaciones: no exceder el viewport */
	[style*="width:340px"] { width: min(340px, calc(100vw - 28px)) !important; }

	.card { padding: 16px; }
}

/* ── Header público (PublicLayout) en móvil ─────────────────────────────── */
@media (max-width: 860px) {
	.pub-header-inner { padding: 0 16px !important; gap: 12px !important; height: 60px !important; }
	.pub-nav { display: none !important; }
	.pub-nav-burger {
		display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
		background: #fff; border: 1px solid #E4E7EC; border-radius: 9px; color: #14234D; cursor: pointer; margin-left: auto;
	}
	header:has(.pub-nav-toggle:focus-visible) .pub-nav-burger { outline: 2px solid #14234D; outline-offset: 2px; }
	.pub-right { margin-left: 0 !important; }
	header:has(.pub-nav-toggle:checked) .pub-nav {
		display: flex !important; position: absolute; top: 100%; left: 0; right: 0;
		flex-direction: column; gap: 2px !important; margin: 0 !important; padding: 8px 16px 14px;
		background: #fff; border-bottom: 1px solid #E9ECF1; box-shadow: 0 16px 32px rgba(14,26,58,.10);
	}
	header:has(.pub-nav-toggle:checked) .pub-nav a { padding: 10px 4px; }
	.pub-right a { white-space: nowrap; }
}

@media (max-width: 560px) {
	/* Sin logo en el header público, la marca en texto es el único identificador:
	   se mantiene la línea principal (flexible, con elipsis) y se oculta el subtítulo */
	.pub-header-inner { gap: 8px !important; }
	.pub-header-inner > a { flex: 1 1 auto; min-width: 0; }
	.pub-brand-text { min-width: 0; }
	.pub-brand-text > div:first-child { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.pub-brand-text > div:last-child { display: none; }
	.pub-right { gap: 8px !important; }
	.pub-right a { font-size: 13px !important; padding: 8px 10px !important; }
}

/* ── Blazor error ────────────────────────────────────────────────────────── */
.blazor-error-boundary { background: #FBE9E8; border: 1px solid #F2CBC9; border-radius: 10px; padding: 16px; color: #C5403C; }
.blazor-error-boundary::after { content: "Se produjo un error inesperado."; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; background: #FBE9E8; border-top: 1px solid #F2CBC9; padding: 12px 24px; color: #C5403C; font-size: 13.5px; z-index: 9999; }
