/*
 * Todas las reglas están scopeadas bajo .apas-cal-wrapper y usan !important
 * en las propiedades visuales (fondo, color, bordes, list-style, display de
 * flex/grid) a propósito: temas como Avada/Fusion Builder traen resets
 * globales para button/a/li que de otro modo pisan estos estilos.
 */

.apas-cal-wrapper {
	--apas-cal-primario: #1c8db3;
	--apas-cal-secundario: #54a4be;
	--apas-cal-oscuro: #1f3954;
	--apas-cal-borde: #cbc8c8;
	--apas-cal-texto: #545454;
	--apas-cal-fondo: #ffffff;

	max-width: 900px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--apas-cal-texto);
	box-sizing: border-box;
}

.apas-cal-wrapper,
.apas-cal-wrapper *,
.apas-cal-wrapper *::before,
.apas-cal-wrapper *::after {
	box-sizing: border-box !important;
}

.apas-cal-wrapper button {
	font-family: inherit !important;
	font-size: inherit;
	line-height: normal;
	-webkit-appearance: none !important;
	appearance: none !important;
	box-shadow: none !important;
	text-shadow: none !important;
	margin: 0 !important;
}

.apas-cal-wrapper ul {
	list-style: none !important;
	list-style-type: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.apas-cal-wrapper li {
	list-style: none !important;
	list-style-type: none !important;
	margin: 0 !important;
}

.apas-cal-wrapper li::marker {
	content: none !important;
}

.apas-cal-wrapper .apas-cal-calendario {
	background: var(--apas-cal-fondo) !important;
	border: 1px solid var(--apas-cal-borde) !important;
	border-radius: 8px !important;
	padding: 16px;
	position: relative;
}

.apas-cal-wrapper .apas-cal-calendario.apas-cal-loading {
	opacity: 0.5;
	pointer-events: none;
}

.apas-cal-wrapper .apas-cal-header {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	margin: 0 0 16px !important;
	padding: 0 !important;
}

.apas-cal-wrapper .apas-cal-mes-titulo {
	margin: 0 !important;
	padding: 0 !important;
	color: var(--apas-cal-oscuro) !important;
	font-size: 1.3em;
	text-transform: capitalize;
	border: none !important;
	background: none !important;
}

.apas-cal-wrapper .apas-cal-nav {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: var(--apas-cal-primario) !important;
	background-image: none !important;
	color: #fff !important;
	border: none !important;
	border-radius: 50% !important;
	width: 34px !important;
	height: 34px !important;
	padding: 0 !important;
	font-size: 1.2em;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.apas-cal-wrapper .apas-cal-nav:hover,
.apas-cal-wrapper .apas-cal-nav:focus {
	background: var(--apas-cal-secundario) !important;
	color: #fff !important;
}

.apas-cal-wrapper .apas-cal-grid {
	display: grid !important;
	grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
	gap: 4px;
	width: 100%;
}

.apas-cal-wrapper .apas-cal-dia-semana {
	text-align: center;
	font-weight: 700;
	color: var(--apas-cal-oscuro) !important;
	padding: 6px 0;
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.apas-cal-wrapper .apas-cal-dia {
	min-height: 92px;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--apas-cal-borde) !important;
	border-radius: 6px !important;
	padding: 4px;
	background: var(--apas-cal-fondo) !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 3px;
}

.apas-cal-wrapper .apas-cal-dia-num {
	font-size: 0.85em;
	font-weight: 600;
	color: var(--apas-cal-texto) !important;
	padding: 2px 4px;
}

.apas-cal-wrapper .apas-cal-fuera-mes {
	background: #fafafa !important;
	opacity: 0.55;
}

.apas-cal-wrapper .apas-cal-hoy {
	border-color: var(--apas-cal-primario) !important;
	box-shadow: inset 0 0 0 1px var(--apas-cal-primario) !important;
}

.apas-cal-wrapper .apas-cal-hoy .apas-cal-dia-num {
	background: var(--apas-cal-primario) !important;
	color: #fff !important;
	border-radius: 4px !important;
	display: inline-block !important;
}

.apas-cal-wrapper .apas-cal-dia-eventos {
	display: flex !important;
	flex-direction: column !important;
	gap: 2px;
	overflow: hidden;
	min-width: 0;
	width: 100%;
}

.apas-cal-wrapper .apas-cal-evento {
	display: block !important;
	width: 100% !important;
	min-width: 0;
	max-width: 100%;
	background: var(--apas-cal-evento-color, var(--apas-cal-primario)) !important;
	background-image: none !important;
	color: #fff !important;
	border: none !important;
	text-align: left;
	font-size: 0.72em;
	line-height: 1.3;
	padding: 2px 6px !important;
	border-radius: 4px !important;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.apas-cal-wrapper .apas-cal-evento:hover,
.apas-cal-wrapper .apas-cal-evento:focus {
	filter: brightness(0.92);
	color: #fff !important;
}

.apas-cal-wrapper .apas-cal-evento-inicio {
	border-top-left-radius: 4px !important;
	border-bottom-left-radius: 4px !important;
}

.apas-cal-wrapper .apas-cal-evento-medio,
.apas-cal-wrapper .apas-cal-evento-fin {
	border-top-left-radius: 0 !important;
	border-bottom-left-radius: 0 !important;
}

.apas-cal-wrapper .apas-cal-evento-medio {
	border-top-right-radius: 0 !important;
	border-bottom-right-radius: 0 !important;
}

/* Lista de próximas actividades */

.apas-cal-wrapper .apas-cal-lista {
	margin-top: 24px;
	background: var(--apas-cal-fondo) !important;
	border: 1px solid var(--apas-cal-borde) !important;
	border-radius: 8px !important;
	padding: 16px 20px;
}

.apas-cal-wrapper .apas-cal-lista-titulo {
	margin: 0 0 12px !important;
	padding: 0 !important;
	color: var(--apas-cal-oscuro) !important;
	border: none !important;
}

.apas-cal-wrapper .apas-cal-lista-items {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.apas-cal-wrapper .apas-cal-lista-item {
	display: flex !important;
	align-items: center !important;
	gap: 8px;
	padding: 0 !important;
}

.apas-cal-wrapper .apas-cal-lista-item + .apas-cal-lista-item {
	border-top: 1px solid var(--apas-cal-borde) !important;
}

.apas-cal-wrapper .apas-cal-lista-evento {
	display: flex !important;
	align-items: center !important;
	gap: 12px;
	flex: 1 1 auto;
	min-width: 0;
	background: none !important;
	border: none !important;
	text-align: left;
	padding: 10px 4px !important;
	cursor: pointer;
	color: var(--apas-cal-texto) !important;
}

.apas-cal-wrapper .apas-cal-lista-gcal {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 5px;
	flex: 0 0 auto;
	background: var(--apas-cal-secundario) !important;
	background-image: none !important;
	color: #fff !important;
	text-decoration: none !important;
	border: none !important;
	border-bottom: none !important;
	padding: 7px 12px !important;
	border-radius: 5px !important;
	font-size: 0.8em;
	font-weight: 600;
	white-space: nowrap;
	transition: background 0.2s ease;
}

.apas-cal-wrapper .apas-cal-lista-gcal:hover,
.apas-cal-wrapper .apas-cal-lista-gcal:focus {
	background: var(--apas-cal-primario) !important;
	color: #fff !important;
	text-decoration: none !important;
}

.apas-cal-wrapper .apas-cal-lista-gcal-icono {
	font-size: 1em;
	line-height: 1;
}

.apas-cal-wrapper .apas-cal-lista-evento:hover .apas-cal-lista-nombre {
	color: var(--apas-cal-primario) !important;
}

.apas-cal-wrapper .apas-cal-lista-color {
	flex: 0 0 10px;
	width: 10px;
	height: 10px;
	border-radius: 50% !important;
	background: var(--apas-cal-evento-color, var(--apas-cal-primario)) !important;
}

.apas-cal-wrapper .apas-cal-lista-info {
	display: flex !important;
	flex-direction: column !important;
	gap: 2px;
	min-width: 0;
}

.apas-cal-wrapper .apas-cal-lista-fecha {
	font-size: 0.8em;
	color: var(--apas-cal-secundario) !important;
	font-weight: 600;
}

.apas-cal-wrapper .apas-cal-lista-nombre {
	font-weight: 600;
	color: var(--apas-cal-oscuro) !important;
}

.apas-cal-wrapper .apas-cal-lista-vacia {
	color: var(--apas-cal-texto) !important;
	font-style: italic;
}

/* Modal de detalle */

.apas-cal-wrapper .apas-cal-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.apas-cal-wrapper .apas-cal-modal.apas-cal-abierto {
	display: flex !important;
}

.apas-cal-wrapper .apas-cal-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(31, 57, 84, 0.6) !important;
}

.apas-cal-wrapper .apas-cal-modal-content {
	position: relative;
	background: var(--apas-cal-fondo) !important;
	border-radius: 8px !important;
	padding: 28px 24px 24px;
	max-width: 460px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}

.apas-cal-wrapper .apas-cal-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none !important;
	border: none !important;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	color: var(--apas-cal-texto) !important;
	padding: 4px !important;
}

.apas-cal-wrapper .apas-cal-modal-categoria {
	margin: 0 0 4px !important;
	padding: 0 !important;
	font-size: 0.78em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--apas-cal-primario) !important;
}

.apas-cal-wrapper .apas-cal-modal-title {
	margin: 0 0 8px !important;
	padding: 0 !important;
	color: var(--apas-cal-oscuro) !important;
	border: none !important;
}

.apas-cal-wrapper .apas-cal-modal-fechas {
	margin: 0 0 14px !important;
	padding: 0 !important;
	font-weight: 600;
	color: var(--apas-cal-secundario) !important;
}

.apas-cal-wrapper .apas-cal-modal-desc {
	margin: 0 0 18px !important;
	padding: 0 !important;
	white-space: pre-line;
	color: var(--apas-cal-texto) !important;
}

.apas-cal-wrapper .apas-cal-modal-actions {
	display: flex !important;
	flex-wrap: wrap;
	gap: 10px;
}

.apas-cal-wrapper .apas-cal-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	background: var(--apas-cal-primario) !important;
	background-image: none !important;
	color: #fff !important;
	text-decoration: none !important;
	border: none !important;
	border-bottom: none !important;
	padding: 10px 16px !important;
	border-radius: 5px !important;
	font-size: 0.9em;
	font-weight: 600;
	transition: background 0.2s ease;
}

.apas-cal-wrapper .apas-cal-btn:hover,
.apas-cal-wrapper .apas-cal-btn:focus {
	background: var(--apas-cal-oscuro) !important;
	color: #fff !important;
	text-decoration: none !important;
}

.apas-cal-wrapper .apas-cal-btn-web {
	background: var(--apas-cal-secundario) !important;
}

.apas-cal-wrapper .apas-cal-btn-web:hover,
.apas-cal-wrapper .apas-cal-btn-web:focus {
	background: var(--apas-cal-oscuro) !important;
}

@media (max-width: 600px) {
	.apas-cal-wrapper .apas-cal-dia {
		min-height: 62px;
	}

	.apas-cal-wrapper .apas-cal-evento {
		font-size: 0.62em;
	}

	.apas-cal-wrapper .apas-cal-dia-semana {
		font-size: 0.7em;
	}

	.apas-cal-wrapper .apas-cal-lista-item {
		flex-wrap: wrap;
	}
}
