/*
 * Calendario de Eventos v2 — Estilos Frontend
 * Autor: Yerson Novoa | https://codein-jnc.com
 */

/* ── Reset de scope ─────────────────────────────────────────────────────────── */
.ce-wrapper *,
.ce-wrapper *::before,
.ce-wrapper *::after {
	box-sizing: border-box;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────────── */
.ce-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
		Ubuntu, "Helvetica Neue", Arial, sans-serif;
	max-width: 100%;
	margin: 0 auto;
}

/* ── Encabezado de sección ───────────────────────────────────────────────────── */
.ce-section-header {
	text-align: center;
	margin-bottom: 48px;
}

.ce-section-title {
	display: inline-block;
	font-size: clamp(1.4rem, 3vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.25;
	margin: 0 0 12px;
	padding: 12px 36px;
	border: 2px solid currentColor;
	border-radius: 60px;
}

.ce-section-subtitle {
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin: 0;
}

/* ── Grid ─────────────────────────────────────────────────────────────────────── */
.ce-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(3, 1fr);
}

/* ── Tarjeta ─────────────────────────────────────────────────────────────────── */
.ce-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ce-card:hover {
	transform: translateY(-4px);
}

/* ── Banner de Entidad ───────────────────────────────────────────────────────── */
.ce-entidad-banner {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 8px 18px;
	position: relative;
	overflow: hidden;
}

.ce-entidad-banner::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(0,0,0,.06));
	pointer-events: none;
}

.ce-entidad-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	color: rgba(255,255,255,.85);
	position: relative;
	z-index: 1;
}

.ce-entidad-name {
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #fff;
	position: relative;
	z-index: 1;
}

/* ── Imagen destacada ────────────────────────────────────────────────────────── */
.ce-card-thumb {
	overflow: hidden;
	max-height: 150px;
}

.ce-thumb-img {
	width: 100%;
	height: 150px;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.ce-card:hover .ce-thumb-img {
	transform: scale(1.04);
}

/* ── Badge de fecha ──────────────────────────────────────────────────────────── */
.ce-date-badge {
	display: inline-flex;
	align-items: stretch;
	margin: 18px 18px 14px;
	user-select: none;
	line-height: 1;
}

.ce-day {
	background: #c0392b;
	color: #fff;
	font-size: 1.95rem;
	font-weight: 800;
	padding: 5px 10px;
	min-width: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ce-month {
	background: #1a1a1a;
	color: #fff;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 5px 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	min-width: 38px;
}

/* ── Cuerpo de tarjeta ───────────────────────────────────────────────────────── */
.ce-card-body {
	padding: 0 18px 0;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.ce-card-title {
	font-size: 0.93rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	margin: 0 0 12px;
	line-height: 1.35;
	color: #1a1a1a;
}

.ce-card-time,
.ce-card-place,
.ce-card-modality,
.ce-card-dirigido,
.ce-card-invitado {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.855rem;
	margin: 0 0 6px;
	color: #555;
	line-height: 1.5;
}

.ce-card-modality {
	font-size: 0.855rem;
}

.ce-card-modality strong,
.ce-card-dirigido strong,
.ce-card-invitado strong {
	font-weight: 600;
	color: #333;
}

.ce-card-desc {
	font-size: 0.82rem;
	color: #888;
	margin: 4px 0 0;
	line-height: 1.55;
	font-style: italic;
}

/* Iconos SVG inline */
.ce-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	opacity: 0.55;
	display: inline-block;
	vertical-align: middle;
}

/* ── Espacio de Compartición ─────────────────────────────────────────────────── */
.ce-sharing {
	margin: 14px 0 0;
	padding-top: 12px;
	border-top: 1px solid #f0f0f0;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.ce-sharing-label {
	font-size: 11px;
	font-weight: 600;
	color: #aaa;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	flex-shrink: 0;
}

.ce-sharing-btns {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.ce-share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	text-decoration: none;
	transition: transform 0.18s ease, opacity 0.18s ease;
	border: none;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
	position: relative;
}

.ce-share-btn svg {
	width: 14px;
	height: 14px;
}

.ce-share-btn:hover {
	transform: translateY(-2px);
	opacity: 0.88;
}

/* Colores de red */
.ce-share-wa   { background: #25d366; color: #fff; }
.ce-share-fb   { background: #1877f2; color: #fff; }
.ce-share-tw   { background: #000;    color: #fff; }
.ce-share-li   { background: #0a66c2; color: #fff; }
.ce-share-copy { background: #6c757d; color: #fff; }

.ce-share-copy--done { background: #28a745; }

/* Tooltip de copiado */
.ce-copy-tooltip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: #333;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .2s, transform .2s;
	z-index: 100;
}

.ce-copy-tooltip--show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ── Footer de tarjeta ───────────────────────────────────────────────────────── */
.ce-card-footer {
	margin-top: auto;
	padding: 14px 0 20px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

/* Botón Leer más */
.ce-btn {
	display: inline-block;
	font-size: 0.855rem;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.2s ease, transform 0.15s ease;
	cursor: pointer;
	line-height: 1;
}

.ce-btn--link {
	background: none;
	padding: 0;
	border: none;
	color: #17a2b8;
}

.ce-btn--link:hover {
	text-decoration: underline;
}

.ce-btn--button {
	padding: 8px 18px;
	border-radius: 6px;
	background: #17a2b8;
	color: #fff !important;
	border: none;
}

.ce-btn--button:hover {
	opacity: 0.86;
	transform: translateY(-1px);
	text-decoration: none;
}

/* Botón Unirse */
.ce-btn-join {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, #17a2b8, #138496);
	padding: 7px 14px;
	border-radius: 6px;
	text-decoration: none;
	transition: opacity 0.2s ease, transform 0.15s ease;
	border: none;
}

.ce-btn-join .ce-icon { opacity: 0.9; }

.ce-btn-join:hover {
	opacity: 0.88;
	transform: translateY(-1px);
	text-decoration: none;
	color: #fff;
}

/* Botón Inscribirse */
.ce-btn-inscripcion {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.855rem;
	font-weight: 700;
	color: #fff;
	background: #28a745;
	padding: 8px 16px;
	border-radius: 6px;
	border: none;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	position: relative;
}

.ce-btn-inscripcion:hover:not([disabled]) {
	opacity: 0.88;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(40,167,69,.35);
}

.ce-btn-inscripcion[disabled],
.ce-btn-inscripcion--agotado {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none !important;
}

.ce-btn-inscripcion--done {
	background: #6c757d !important;
}

.ce-btn-inscripcion .ce-icon { opacity: 1; }

/* Badge de cupos */
.ce-cupo-badge {
	font-size: 10px;
	font-weight: 600;
	background: rgba(255,255,255,.22);
	border-radius: 10px;
	padding: 2px 7px;
	margin-left: 2px;
	white-space: nowrap;
}

/* ── Evento finalizado ───────────────────────────────────────────────────────── */
.ce-card--pasado {
	opacity: 0.72;
}

.ce-card--pasado:hover {
	opacity: 1;
}

.ce-card-pasado-badge {
	position: absolute;
	top: 52px;
	right: 12px;
	background: rgba(0,0,0,.55);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 3px 10px;
	border-radius: 12px;
	z-index: 2;
	pointer-events: none;
}

.ce-card {
	position: relative;
}

/* ── Sin eventos ─────────────────────────────────────────────────────────────── */
.ce-no-events {
	text-align: center;
	padding: 60px 20px;
	color: #aaa;
	font-size: 1rem;
	background: #fafafa;
	border: 1px dashed #ddd;
	border-radius: 8px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MODAL DE INSCRIPCIÓN
══════════════════════════════════════════════════════════════════════════════ */

.ce-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ce-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .62);
	backdrop-filter: blur(3px);
}

.ce-modal-container {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 16px;
	width: 100%;
	max-width: 560px;
	max-height: 92vh;
	overflow-y: auto;
	box-shadow: 0 24px 64px rgba(0,0,0,.28);
	transform: translateY(24px) scale(.97);
	opacity: 0;
	transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
	scrollbar-width: thin;
}

.ce-modal-in {
	transform: translateY(0) scale(1);
	opacity: 1;
}

/* Botón cerrar */
.ce-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(0,0,0,.07);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #555;
	transition: background 0.2s ease;
	z-index: 5;
}

.ce-modal-close:hover {
	background: rgba(0,0,0,.15);
	color: #111;
}

.ce-modal-close svg { width: 14px; height: 14px; }

/* Cabecera del modal */
.ce-modal-header {
	background: linear-gradient(135deg, #c0392b 0%, #922b21 100%);
	padding: 28px 28px 24px;
	border-radius: 16px 16px 0 0;
}

.ce-modal-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: rgba(255,255,255,.75);
	background: rgba(255,255,255,.15);
	padding: 3px 10px;
	border-radius: 20px;
	margin-bottom: 10px;
}

.ce-modal-event-title {
	font-size: 1.2rem;
	font-weight: 700;
	color: #fff;
	margin: 0 0 8px;
	line-height: 1.3;
}

.ce-modal-event-meta {
	font-size: 0.82rem;
	color: rgba(255,255,255,.8);
	margin: 0;
	line-height: 1.6;
}

/* Cuerpo del modal */
.ce-modal-body {
	padding: 24px 28px 28px;
}

/* Formulario */
.ce-form-row {
	margin-bottom: 0;
}

.ce-form-2col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin-bottom: 14px;
}

.ce-form-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-bottom: 14px;
}

.ce-form-group label {
	font-size: 12px;
	font-weight: 600;
	color: #444;
	letter-spacing: 0.02em;
}

.ce-req { color: #c0392b; }

.ce-form-group input,
.ce-form-group textarea {
	border: 1.5px solid #e0e0e0;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
	color: #333;
	background: #fff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	width: 100%;
	outline: none;
}

.ce-form-group input:focus,
.ce-form-group textarea:focus {
	border-color: #c0392b;
	box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}

.ce-form-group textarea {
	resize: vertical;
	min-height: 80px;
}

/* Error */
.ce-form-error {
	background: #fff3f3;
	border: 1px solid #f5c6cb;
	border-radius: 8px;
	color: #c0392b;
	font-size: 13px;
	font-weight: 500;
	padding: 10px 14px;
	margin-bottom: 14px;
}

/* Botón submit */
.ce-btn-submit-reg {
	width: 100%;
	padding: 13px;
	border: none;
	border-radius: 10px;
	background: #28a745;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: opacity 0.2s ease, transform 0.15s ease;
	font-family: inherit;
}

.ce-btn-submit-reg:hover:not([disabled]) {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ce-btn-submit-reg[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Spinner */
.ce-spinner {
	width: 18px;
	height: 18px;
	animation: ce-spin 0.85s linear infinite;
}

@keyframes ce-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* ── Éxito del modal ─────────────────────────────────────────────────────────── */
.ce-modal-success {
	text-align: center;
	padding: 16px 0 8px;
}

.ce-success-icon {
	margin: 0 auto 20px;
	width: 72px;
	height: 72px;
}

.ce-success-icon svg {
	width: 100%;
	height: 100%;
}

.ce-check-circle {
	stroke: #28a745;
	stroke-width: 2;
	stroke-dasharray: 166;
	stroke-dashoffset: 166;
	animation: ce-circle .6s cubic-bezier(.65,0,.45,1) forwards;
}

.ce-check-path {
	stroke: #28a745;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
	animation: ce-check .4s .55s cubic-bezier(.65,0,.45,1) forwards;
}

@keyframes ce-circle {
	to { stroke-dashoffset: 0; }
}

@keyframes ce-check {
	to { stroke-dashoffset: 0; }
}

.ce-modal-success h3 {
	font-size: 1.25rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 10px;
}

.ce-modal-success p {
	font-size: 0.9rem;
	color: #666;
	margin: 0 0 24px;
	line-height: 1.6;
}

.ce-btn-close-success {
	display: inline-block;
	padding: 10px 32px;
	border-radius: 8px;
	background: #28a745;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	border: none;
	cursor: pointer;
	transition: opacity 0.2s;
	font-family: inherit;
}

.ce-btn-close-success:hover { opacity: 0.88; }

/* ── Body locked cuando modal abierto ───────────────────────────────────────── */
.ce-body-modal-open {
	overflow: hidden;
}

/* ── Accesibilidad ───────────────────────────────────────────────────────────── */
.ce-btn:focus-visible,
.ce-btn-inscripcion:focus-visible,
.ce-share-btn:focus-visible {
	outline: 3px solid #17a2b8;
	outline-offset: 3px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.ce-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
	.ce-grid { gap: 16px; }
	.ce-section-title { font-size: 1.35rem; padding: 10px 24px; }
	.ce-form-2col { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 520px) {
	.ce-grid { grid-template-columns: 1fr; }
	.ce-section-title { font-size: 1.18rem; padding: 9px 18px; }
	.ce-modal-container { border-radius: 12px; }
	.ce-modal-header { border-radius: 12px 12px 0 0; padding: 22px 20px 18px; }
	.ce-modal-body { padding: 18px 20px 22px; }
}

/* ── Print ────────────────────────────────────────────────────────────────────── */
@media print {
	.ce-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
	.ce-card { break-inside: avoid; box-shadow: none !important; }
	.ce-card-footer, .ce-sharing, .ce-modal { display: none !important; }
}
