/* Transfer CADIC: hoja de estilos */

:root {
	--brand: #2c4a6e;
	--brand-strong: #1f3654;
	--brand-soft: #e8eef6;
	--accent: #3a76c4;
	--success: #1f8a5b;
	--success-soft: #e4f4ec;
	--danger: #c23b2e;
	--danger-soft: #fbe9e7;
	--warning: #a36a00;

	--text: #1c2733;
	--text-muted: #5f6b7a;
	--text-faint: #8a96a5;
	--border: #e2e7ee;
	--surface: #ffffff;
	--surface-alt: #f5f7fa;

	--radius: 16px;
	--radius-sm: 10px;
	--shadow: 0 24px 60px rgba(15, 28, 45, .28), 0 4px 14px rgba(15, 28, 45, .12);
	--font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.45;
	color: var(--text);
	background: #1d2c3f;
	display: flex;
	align-items: center;
	padding: 32px clamp(16px, 5vw, 80px);
}

/* ---------- Fondo con imágenes que se alternan ---------- */
.bg {
	position: fixed;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	background: #1d2c3f;
}
.bg__layer {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0;
	transition: opacity 1.6s ease;
	will-change: opacity;
}
.bg__layer.is-visible { opacity: 1; }
.bg::after {
	/* degradado suave detrás de la tarjeta para dar contraste sin tapar el fondo */
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(10, 20, 35, .45) 0%, rgba(10, 20, 35, .15) 45%, rgba(10, 20, 35, 0) 70%);
}

/* ---------- Tarjeta ---------- */
.card {
	width: min(440px, 100%);
	max-height: calc(100dvh - 64px);
	display: flex;
	flex-direction: column;
	background: rgba(255, 255, 255, .97);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}
@supports (backdrop-filter: blur(1px)) {
	.card { background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px) saturate(1.2); }
}
.card--wide { width: min(560px, 100%); }

.card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 24px;
	border-bottom: 1px solid var(--border);
	flex: none;
}
.brand {
	display: flex;
	align-items: baseline;
	gap: 10px;
	color: var(--brand);
	text-decoration: none;
}
.brand__name {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -.02em;
}
.brand__product {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.card__body {
	padding: 20px 24px 24px;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
	overscroll-behavior: contain;
}
.card__footer {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 24px;
	border-top: 1px solid var(--border);
	background: var(--surface-alt);
	font-size: 12px;
	color: var(--text-faint);
}
.card__footer img { height: 26px; width: auto; display: block; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
.title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.section + .section { margin-top: 20px; }
.muted { color: var(--text-muted); }
.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Iconos ---------- */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }

/* ---------- Botones ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
	-webkit-tap-highlight-color: transparent;
}
.btn:focus-visible, .icon-btn:focus-visible, .field__input:focus-visible, .dropzone:focus-within {
	outline: 3px solid rgba(58, 118, 196, .45);
	outline-offset: 2px;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-strong); }
.btn--primary:disabled { background: #b8c3d1; cursor: not-allowed; }
.btn--secondary { background: var(--surface); color: var(--brand); border-color: #cbd5e1; }
.btn--secondary:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn--ghost { background: transparent; color: var(--brand); padding-inline: 10px; }
.btn--ghost:hover { background: var(--brand-soft); }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 0;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	flex: none;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--brand); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Zona para soltar archivos ---------- */
.dropzone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 24px 16px 18px;
	border: 2px dashed #c3cedb;
	border-radius: 14px;
	background: var(--surface-alt);
	transition: border-color .15s, background-color .15s;
}
.dropzone.is-over, body.is-dragging .dropzone {
	border-color: var(--accent);
	background: #eaf2fc;
}
.dropzone__icon {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--brand);
	color: #fff;
	margin-bottom: 4px;
}
.dropzone__title { font-weight: 650; font-size: 16px; }
.dropzone__hint { font-size: 13px; color: var(--text-muted); }
.dropzone__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.dropzone input[type=file] { display: none; }

/* Con archivos ya añadidos la zona se compacta para dejar sitio a la lista */
.dropzone--compact {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: space-between;
	text-align: left;
	padding: 10px 12px 10px 16px;
	gap: 8px 12px;
}
.dropzone--compact .dropzone__icon,
.dropzone--compact .dropzone__hint { display: none; }
.dropzone--compact .dropzone__title { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.dropzone--compact .dropzone__actions { margin-top: 0; }

/* Capa al arrastrar sobre toda la ventana */
.drop-overlay {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: none;
	place-items: center;
	background: rgba(20, 40, 70, .55);
	backdrop-filter: blur(2px);
	color: #fff;
	pointer-events: none;
}
body.is-dragging .drop-overlay { display: grid; }
.drop-overlay__box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 36px 48px;
	border: 2px dashed rgba(255, 255, 255, .8);
	border-radius: 20px;
	font-size: 20px;
	font-weight: 600;
	text-align: center;
}

/* ---------- Resumen y barra de progreso ---------- */
.summary { margin-top: 16px; }
.summary__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	font-size: 13px;
	color: var(--text-muted);
	margin-bottom: 6px;
}
.summary__row strong { color: var(--text); font-weight: 650; }
.progress {
	height: 6px;
	border-radius: 999px;
	background: #e3e8ef;
	overflow: hidden;
}
.progress__bar {
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: var(--accent);
	transition: width .25s ease;
}
.progress--done .progress__bar { background: var(--success); }
.progress--thin { height: 3px; }

/* ---------- Lista de archivos ---------- */
.file-list {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	max-height: min(38vh, 340px);
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
}
.file-list:empty { display: none; }
.file-list--tall { max-height: min(52vh, 520px); }

.file {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 8px 10px 14px;
	border-bottom: 1px solid var(--border);
	min-width: 0;
}
.file:last-child { border-bottom: 0; }
.file__icon {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 9px;
	background: var(--brand-soft);
	color: var(--brand);
	flex: none;
}
.file--done .file__icon { background: var(--success-soft); color: var(--success); }
.file--error .file__icon { background: var(--danger-soft); color: var(--danger); }
.file__main { flex: 1 1 auto; min-width: 0; }
.file__dir {
	display: block;
	font-size: 12px;
	color: var(--text-faint);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.file__name {
	display: block;
	font-weight: 550;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text);
}
.file__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	font-size: 12px;
	color: var(--text-muted);
	margin-top: 2px;
}
.file__status--error { color: var(--danger); }
.file__status--done { color: var(--success); }
.file .progress { margin-top: 6px; }
.file__actions { display: flex; align-items: center; flex: none; }

a.file { color: inherit; text-decoration: none; transition: background-color .12s; }
a.file:hover { background: var(--surface-alt); }
a.file:hover .file__name { color: var(--brand); }
.file__download {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	color: var(--brand);
	flex: none;
}
a.file:hover .file__download { background: var(--brand-soft); }

/* ---------- Formulario ---------- */
.form { margin-top: 20px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field__input {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	font: inherit;
	font-size: 16px; /* evita el zoom automático en iOS */
	color: var(--text);
	background: var(--surface);
	border: 1px solid #cfd8e3;
	border-radius: var(--radius-sm);
	transition: border-color .15s, box-shadow .15s;
}
.field__input:hover { border-color: #aebccc; }
.field__input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(58, 118, 196, .2); }
textarea.field__input { min-height: 84px; resize: vertical; }

.select { position: relative; }
.select select {
	appearance: none;
	-webkit-appearance: none;
	padding-left: 38px;
	padding-right: 38px;
	cursor: pointer;
}
.select__icon, .select__chevron {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	pointer-events: none;
}
.select__icon { left: 12px; }
.select__chevron { right: 12px; }

.expiry {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand);
	font-size: 13px;
	font-weight: 600;
}
.expiry--soon { background: #fff4e0; color: var(--warning); }
.field__hint { font-size: 12px; color: var(--text-faint); }

.link-box {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 4px 4px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface-alt);
}
.link-box input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: var(--text-muted);
	outline: none;
	text-overflow: ellipsis;
}

/* ---------- Avisos ---------- */
.notice {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	margin-bottom: 18px;
	font-size: 14px;
	word-break: break-word;
}
.notice--ok { background: var(--success-soft); color: #125a3b; }
.notice--error { background: var(--danger-soft); color: #8a1c13; }
.notice .icon { margin-top: 1px; }

/* ---------- Página de descarga ---------- */
.download-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}
.toolbar { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.search {
	flex: 1 1 200px;
	position: relative;
}
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search input { padding-left: 38px; }
.empty {
	padding: 28px 16px;
	text-align: center;
	color: var(--text-muted);
	border: 1px dashed var(--border);
	border-radius: 12px;
	margin-top: 12px;
}

.history {
	margin-top: 20px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
}
.history > summary {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
	color: var(--text);
	user-select: none;
}
.history > summary::-webkit-details-marker { display: none; }
.history > summary .chevron { margin-left: auto; transition: transform .2s; color: var(--text-faint); }
.history[open] > summary .chevron { transform: rotate(180deg); }
.history .badge { margin-left: 2px; }
.history__list {
	list-style: none;
	margin: 0;
	padding: 0 14px 6px;
	max-height: 260px;
	overflow-y: auto;
	border-top: 1px solid var(--border);
}
.history__item {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 14px;
	padding: 9px 0;
	border-bottom: 1px solid var(--border);
	font-size: 13px;
}
.history__item:last-child { border-bottom: 0; }
.history__date { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.history__file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history__note { font-size: 12px; color: var(--text-faint); padding: 8px 14px 12px; margin: 0; }

.badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand);
	font-size: 12px;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 20px);
	background: #1c2733;
	color: #fff;
	padding: 10px 16px;
	border-radius: 10px;
	font-size: 14px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
	z-index: 60;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
	body {
		align-items: flex-start;
		padding: 16px 12px 24px;
		font-size: 15px;
	}
	.bg::after { background: rgba(10, 20, 35, .25); }
	.card, .card--wide { width: 100%; max-height: none; }
	.card__header, .card__body, .card__footer { padding-left: 16px; padding-right: 16px; }
	.card__body { overflow: visible; }
	.file-list { max-height: 50vh; }
	.file-list--tall { max-height: none; }
	.dropzone { padding: 20px 12px 16px; }
	.download-head .btn { width: 100%; }
}

@media (pointer: coarse) {
	.only-fine { display: none !important; }
	.icon-btn { width: 40px; height: 40px; }
}
@media (pointer: fine) {
	.only-coarse { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Página de error ---------- */
.error-page { text-align: center; padding-top: 32px; padding-bottom: 32px; }
.error-page__icon {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: var(--brand-soft);
	color: var(--brand);
}
.error-page__icon--error { background: var(--danger-soft); color: var(--danger); }
.error-page__code {
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--text-faint);
}
.error-page .subtitle { max-width: 34ch; margin-left: auto; margin-right: auto; }
.error-page__tips {
	text-align: left;
	margin: 20px 0 0;
	padding: 14px 16px 14px 34px;
	background: var(--surface-alt);
	border-radius: var(--radius-sm);
	font-size: 14px;
	color: var(--text-muted);
}
.error-page__tips li + li { margin-top: 6px; }
.error-page__actions { display: grid; gap: 10px; margin-top: 24px; }
