/* CPT Certificaciones — listado AJAX.
 * Variables sobreescribibles desde el tema, p. ej.:
 *   .cptc-lst { --cptc-accent: #0f766e; --cptc-heading: "Fraunces", serif; }
 */
.cptc-lst {
	--cptc-bg: #f6f3ee;
	--cptc-card: #fffcf8;
	--cptc-line: #dfe3e6;
	--cptc-ink: #1b2a3a;
	--cptc-muted: #5f6b76;
	--cptc-accent: #0f766e;
	--cptc-accent-ink: #0b5a54;
	--cptc-tint: #d7edea;
	--cptc-tint-soft: #eaf5f3;
	--cptc-radius: 14px;
	--cptc-heading: inherit;

	color: var(--cptc-ink);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	text-align: left;
}
.cptc-lst *,
.cptc-lst *::before,
.cptc-lst *::after { box-sizing: border-box; }
.cptc-lst [hidden] { display: none !important; }
.cptc-lst .screen-reader-text {
	position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.cptc-lst button { font-family: inherit; }

.cptc-title {
	font-family: var(--cptc-heading);
	margin: 0 0 18px;
	color: var(--cptc-ink);
}

/* ───── Barra de búsqueda ───── */
.cptc-toolbar {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}
.cptc-search {
	position: relative;
	flex: 1 1 320px;
	min-width: 0;
}
.cptc-search-ico {
	position: absolute;
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--cptc-muted);
	pointer-events: none;
}
.cptc-lst .cptc-q {
	width: 100%;
	height: 52px;
	margin: 0;
	padding: 0 44px 0 46px;
	border: 1px solid var(--cptc-line);
	border-radius: 12px;
	background: var(--cptc-card);
	color: var(--cptc-ink);
	font: inherit;
	font-size: 1rem;
	box-shadow: 0 1px 2px rgba(27, 42, 58, .04);
	transition: border-color .15s, box-shadow .15s;
	-webkit-appearance: none;
	appearance: none;
}
.cptc-lst .cptc-q::placeholder { color: #8a949d; opacity: 1; }
.cptc-lst .cptc-q::-webkit-search-cancel-button { display: none; }
.cptc-lst .cptc-q:focus {
	outline: none;
	border-color: var(--cptc-accent);
	box-shadow: 0 0 0 4px rgba(15, 118, 110, .15);
}
.cptc-lst .cptc-clear {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: #eceae5;
	color: var(--cptc-muted);
	cursor: pointer;
	padding: 0;
}
.cptc-lst .cptc-clear:hover { background: #e0ddd6; color: var(--cptc-ink); }
.cptc-lst .cptc-clear:focus-visible { outline: 2px solid var(--cptc-accent); outline-offset: 2px; }

.cptc-year-wrap { flex: 0 0 auto; }
.cptc-lst .cptc-year {
	height: 52px;
	margin: 0;
	min-width: 160px;
	padding: 0 40px 0 16px;
	border: 1px solid var(--cptc-line);
	border-radius: 12px;
	background: var(--cptc-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6b76' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
	color: var(--cptc-ink);
	font: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}
.cptc-lst .cptc-year:focus {
	outline: none;
	border-color: var(--cptc-accent);
	box-shadow: 0 0 0 4px rgba(15, 118, 110, .15);
}

.cptc-status {
	min-height: 1.5em;
	margin: 0 0 14px !important;
	color: var(--cptc-muted);
	font-size: .9rem;
}

/* ───── Lista ───── */
.cptc-list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: grid;
	gap: 10px;
}
.cptc-item { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.cptc-item::before, .cptc-item::marker { content: none; }

.cptc-lst .cptc-row {
	width: 100%;
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) auto;
	align-items: center;
	gap: 16px;
	padding: 14px 16px;
	margin: 0;
	text-align: left;
	background: var(--cptc-card);
	border: 1px solid var(--cptc-line);
	border-radius: var(--cptc-radius);
	color: var(--cptc-ink);
	font: inherit;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(27, 42, 58, .03);
	transition: transform .15s, box-shadow .15s, border-color .15s;
	animation: cptc-in .25s ease both;
}
.cptc-lst .cptc-row:hover {
	transform: translateY(-1px);
	border-color: #b9d6d2;
	box-shadow: 0 8px 22px rgba(27, 42, 58, .08);
}
.cptc-lst .cptc-row:focus-visible {
	outline: 3px solid rgba(15, 118, 110, .35);
	outline-offset: 2px;
}

.cptc-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--cptc-tint);
	color: var(--cptc-accent-ink);
	font-weight: 700;
	font-size: .95rem;
	letter-spacing: .02em;
}
.cptc-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cptc-name {
	font-weight: 600;
	font-size: 1.05rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}
.cptc-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; color: var(--cptc-muted); }
.cptc-course {
	font-size: .85rem;
	color: var(--cptc-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.cptc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: .82rem; color: var(--cptc-muted); position: relative; padding-right: 22px; }
.cptc-chev { position: absolute; right: 0; top: 50%; margin-top: -8px; color: #9aa4ac; transition: transform .15s, color .15s; }
.cptc-row:hover .cptc-chev { transform: translateX(3px); color: var(--cptc-accent); }

.cptc-chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: .78rem;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}
.cptc-chip--num { background: var(--cptc-tint); color: var(--cptc-accent-ink); font-variant-numeric: tabular-nums; }
.cptc-chip--hrs { border: 1px solid var(--cptc-line); background: #fff; color: var(--cptc-ink); }

.cptc-lst mark {
	background: #bfe3de;
	color: inherit;
	border-radius: 3px;
	padding: 0 1px;
}

/* ───── Cargando / vacío / error ───── */
.cptc-skel {
	height: 82px;
	border-radius: var(--cptc-radius);
	border: 1px solid var(--cptc-line);
	background: linear-gradient(100deg, #f1eee8 30%, #faf8f4 50%, #f1eee8 70%) var(--cptc-card);
	background-size: 300% 100%;
	animation: cptc-shimmer 1.3s linear infinite;
}
.cptc-empty, .cptc-error {
	text-align: center;
	padding: 48px 20px;
	background: var(--cptc-card);
	border: 1px dashed #cfd6da;
	border-radius: var(--cptc-radius);
}
.cptc-empty svg, .cptc-error svg { color: #9aa4ac; margin-bottom: 8px; }
.cptc-empty h3, .cptc-error h3 { margin: 0 0 6px; font-family: var(--cptc-heading); font-size: 1.2rem; color: var(--cptc-ink); }
.cptc-empty p, .cptc-error p { margin: 0 auto 16px; max-width: 420px; color: var(--cptc-muted); }

.cptc-more-wrap { text-align: center; margin-top: 18px; }
.cptc-lst .cptc-btn,
.cptc-lst .cptc-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 0 24px;
	border-radius: 12px;
	border: 1px solid var(--cptc-line);
	background: var(--cptc-card);
	color: var(--cptc-ink);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s, border-color .15s, box-shadow .15s;
}
.cptc-lst .cptc-btn:hover,
.cptc-lst .cptc-more:hover { border-color: var(--cptc-accent); box-shadow: 0 4px 14px rgba(15, 118, 110, .12); }
.cptc-lst .cptc-btn:focus-visible,
.cptc-lst .cptc-more:focus-visible { outline: 3px solid rgba(15, 118, 110, .35); outline-offset: 2px; }
.cptc-lst .cptc-more[disabled] { opacity: .7; cursor: progress; }
.cptc-lst .cptc-btn--primary {
	background: var(--cptc-accent);
	border-color: var(--cptc-accent);
	color: #fff;
}
.cptc-lst .cptc-btn--primary:hover { background: var(--cptc-accent-ink); border-color: var(--cptc-accent-ink); color: #fff; }
.cptc-spin {
	width: 16px; height: 16px; border-radius: 50%;
	border: 2px solid currentColor; border-right-color: transparent;
	animation: cptc-rot .7s linear infinite;
}

/* ───── Vista previa (modal) ───── */
.cptc-lst.cptc-modal[hidden] { display: none !important; }
.cptc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(27, 42, 58, .5);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	animation: cptc-fade .18s ease both;
}
.cptc-panel {
	width: 100%;
	max-width: 680px;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	background: var(--cptc-card);
	border-radius: 22px;
	box-shadow: 0 30px 80px rgba(10, 20, 30, .35);
	overflow: hidden;
	animation: cptc-pop .22s cubic-bezier(.2, .8, .2, 1) both;
}
.cptc-panel:focus { outline: none; }
.cptc-panel-head {
	position: relative;
	display: flex;
	gap: 16px;
	align-items: center;
	padding: 26px 64px 22px 26px;
	background: linear-gradient(135deg, var(--cptc-tint-soft), var(--cptc-tint));
	border-bottom: 1px solid #c9e3df;
}
.cptc-panel-head .cptc-avatar {
	width: 64px; height: 64px; font-size: 1.3rem;
	background: var(--cptc-accent); color: #fff;
	flex: none;
}
.cptc-panel-ok {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
	color: var(--cptc-accent-ink);
	margin-bottom: 4px;
}
.cptc-lst .cptc-panel-name {
	margin: 0;
	font-family: var(--cptc-heading);
	font-size: 1.5rem;
	line-height: 1.2;
	color: var(--cptc-ink);
	overflow-wrap: anywhere;
}
.cptc-lst .cptc-x {
	position: absolute;
	top: 14px; right: 14px;
	width: 38px; height: 38px;
	display: grid; place-items: center;
	border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .7);
	color: var(--cptc-ink);
	cursor: pointer; padding: 0;
}
.cptc-lst .cptc-x:hover { background: #fff; }
.cptc-lst .cptc-x:focus-visible { outline: 3px solid rgba(15, 118, 110, .45); outline-offset: 2px; }

.cptc-panel-body { padding: 22px 26px; overflow-y: auto; display: grid; gap: 18px; }
.cptc-program {
	padding: 16px 18px;
	border-radius: 12px;
	background: #fff;
	border: 1px solid var(--cptc-line);
	border-left: 4px solid var(--cptc-accent);
}
.cptc-lbl { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cptc-muted); margin-bottom: 3px; }
.cptc-val { font-size: 1.02rem; font-weight: 500; overflow-wrap: anywhere; }
.cptc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.cptc-grid > div { padding-bottom: 12px; border-bottom: 1px solid #ece8e1; }
.cptc-grid dt { margin: 0; }
.cptc-grid dd { margin: 0; }
.cptc-nofile { margin: 0; padding: 12px 14px; border-radius: 10px; background: #f3efe7; color: var(--cptc-muted); font-size: .9rem; }

.cptc-panel-foot {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	padding: 16px 26px;
	border-top: 1px solid var(--cptc-line);
	background: #fbf8f2;
}
.cptc-nav { display: flex; align-items: center; gap: 6px; margin-right: auto; color: var(--cptc-muted); font-size: .85rem; }
.cptc-lst .cptc-nav button {
	width: 40px; height: 40px;
	display: grid; place-items: center;
	border: 1px solid var(--cptc-line); border-radius: 10px;
	background: var(--cptc-card); color: var(--cptc-ink);
	cursor: pointer; padding: 0;
}
.cptc-lst .cptc-nav button:hover:not([disabled]) { border-color: var(--cptc-accent); }
.cptc-lst .cptc-nav button[disabled] { opacity: .35; cursor: default; }
.cptc-lst .cptc-nav button:focus-visible { outline: 3px solid rgba(15, 118, 110, .35); outline-offset: 2px; }

body.cptc-lock { overflow: hidden; }

@keyframes cptc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cptc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cptc-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cptc-shimmer { to { background-position: -300% 0; } }
@keyframes cptc-rot { to { transform: rotate(360deg); } }

/* ───── Móvil ───── */
@media (max-width: 640px) {
	.cptc-lst .cptc-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
	.cptc-avatar { width: 40px; height: 40px; font-size: .85rem; }
	.cptc-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; text-align: left; padding-right: 0; }
	.cptc-chev { display: none; }
	.cptc-lst .cptc-year { width: 100%; }
	.cptc-year-wrap { flex: 1 1 100%; }

	.cptc-modal { align-items: flex-end; padding: 0; }
	.cptc-panel { max-width: none; max-height: 92vh; border-radius: 22px 22px 0 0; animation-name: cptc-sheet; }
	.cptc-panel-head { padding: 22px 56px 18px 18px; gap: 12px; }
	.cptc-panel-head .cptc-avatar { width: 52px; height: 52px; font-size: 1.1rem; }
	.cptc-lst .cptc-panel-name { font-size: 1.25rem; }
	.cptc-panel-body { padding: 18px; }
	.cptc-grid { grid-template-columns: 1fr 1fr; gap: 14px 16px; }
	.cptc-panel-foot { padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); }
	.cptc-nav { width: 100%; margin: 0 0 4px; justify-content: space-between; }
	.cptc-panel-foot .cptc-btn { flex: 1 1 0; padding: 0 12px; white-space: nowrap; }
}
@keyframes cptc-sheet { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
	.cptc-lst *, .cptc-lst *::before, .cptc-lst *::after,
	.cptc-modal, .cptc-panel { animation: none !important; transition: none !important; }
}
