/* ==========================================================================
   MI VIAJE — favoritos + planificador (corazón, badge, drawer, planner)
   Rediseño S8 a calidad de sistema de diseño. Todos los colores/espaciados
   con los tokens de tokens.css. z-index por debajo de la admin bar (99999).
   Respeta prefers-reduced-motion (al final).
   ========================================================================== */

:root {
	--os-mv-z: 99990;
	--os-mv-shadow: 0 8px 32px rgba(26, 26, 26, 0.24);
	--os-mv-accion-hover: #a53f08; /* naranja acción, estado hover */
}

/* --------------------------------------------------------------- corazón --- */

.os-favorito {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 6px;
	border: 0;
	background: transparent;
	cursor: pointer;
	color: var(--color-gris-calido);
	line-height: 0;
	-webkit-tap-highlight-color: transparent;
}
.os-favorito__icon {
	width: 26px;
	height: 26px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	transition: transform 0.18s ease, fill 0.18s ease, stroke 0.18s ease;
}
.os-favorito:hover .os-favorito__icon,
.os-favorito:focus-visible .os-favorito__icon {
	stroke: var(--color-naranja-accion);
	transform: scale(1.08);
}
.os-favorito:focus-visible {
	outline: 3px solid var(--color-naranja-accion);
	outline-offset: 2px;
	border-radius: 8px;
}
/* Guardado: relleno naranja acción. */
.os-favorito.is-saved { color: var(--color-naranja-accion); }
.os-favorito.is-saved .os-favorito__icon {
	fill: var(--color-naranja-accion);
	stroke: var(--color-naranja-accion);
}
/* Pop de 300 ms al guardar. */
@keyframes os-mv-pop {
	0%   { transform: scale(1); }
	35%  { transform: scale(1.35); }
	70%  { transform: scale(0.9); }
	100% { transform: scale(1); }
}
.os-favorito--pop .os-favorito__icon { animation: os-mv-pop 0.3s ease; }

/* Corazón sobre la imagen de una tarjeta de listado. */
.os-favorito--card {
	position: absolute;
	top: 6px;
	right: 6px;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 999px;
	box-shadow: 0 1px 6px rgba(26, 26, 26, 0.18);
}
.os-card { position: relative; }

/* --- Badge contador flotante: círculo blanco, corazón verde, burbuja naranja - */

.os-mv-badge {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: var(--os-mv-z);
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--color-blanco);
	box-shadow: var(--os-mv-shadow);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
}
.os-mv-badge[hidden] { display: none; }
.os-mv-badge:hover { transform: translateY(-2px); }
.os-mv-badge:focus-visible { outline: 3px solid var(--color-verde-bosque); outline-offset: 3px; }
.os-mv-badge__heart { width: 27px; height: 27px; fill: var(--color-verde-bosque); }
.os-mv-badge__count {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--color-naranja-accion);
	color: var(--color-blanco);
	font: 700 0.75rem/22px 'Bricolage Grotesque', system-ui, sans-serif;
	text-align: center;
	box-shadow: 0 0 0 2px var(--color-blanco);
}

/* --------------------------------------------------------------- overlay --- */

.os-mv-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--os-mv-z) - 1);
	background: rgba(26, 26, 26, 0.45);
}
.os-mv-overlay[hidden] { display: none; }

/* ----------------------------------------------------------------- panel --- */

.os-mi-viaje-panel {
	position: fixed;
	top: 0;
	right: 0;
	z-index: var(--os-mv-z);
	display: flex;
	flex-direction: column;
	width: 420px;
	max-width: 92vw;
	height: 100%;
	background: var(--color-crema);
	box-shadow: -8px 0 32px rgba(26, 26, 26, 0.24);
	transform: translateX(100%);
	transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
	font-family: 'Source Serif 4', Georgia, serif;
	color: var(--color-antracita);
}
.os-mi-viaje-panel.is-open { transform: translateX(0); }
.os-mi-viaje-panel[hidden] { display: none; }
body.admin-bar .os-mi-viaje-panel { top: 32px; height: calc(100% - 32px); }
@media screen and (max-width: 782px) {
	body.admin-bar .os-mi-viaje-panel { top: 46px; height: calc(100% - 46px); }
}

/* --- Cabecera: branding compacto (nada de slab verde a todo lo ancho) --- */

.os-mv-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px 10px;
	border-bottom: 1px solid var(--color-arena);
}
.os-mv-brand { display: inline-flex; align-items: center; gap: 10px; }
.os-mv-logo {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var(--color-negro);
}
.os-mv-logo svg {
	display: block;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}
.os-mv-brand__name {
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1.15rem;
	color: var(--color-negro);
}
.os-mv-close {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--color-antracita);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.os-mv-close svg { width: 20px; height: 20px; }
.os-mv-close:hover { background: var(--color-arena); }

/* --- Nombre del plan: edición en línea (sin borde hasta el foco) + lápiz --- */

.os-mv-nameedit {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 14px 14px;
}
.os-mv-name {
	flex: 1 1 auto;
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid transparent;
	border-radius: 7px;
	background: transparent;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1rem;
	color: var(--color-negro);
}
.os-mv-name:hover { background: var(--color-blanco); }
.os-mv-name:focus { outline: 0; border-color: var(--color-naranja-accion); background: var(--color-blanco); }
.os-mv-name-edit {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--color-gris-calido);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.os-mv-name-edit svg { width: 17px; height: 17px; }
.os-mv-name-edit:hover { background: var(--color-arena); color: var(--color-naranja-accion); }

/* --- Pestañas de día como pills, con scroll horizontal --- */

.os-mv-tabs {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 12px 18px;
	overflow-x: auto;
	scrollbar-width: thin;
	border-bottom: 1px solid var(--color-arena);
}
.os-mv-tab,
.os-mv-tab-edit {
	flex: 0 0 auto;
	min-height: 38px;
	padding: 7px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--color-arena);
	color: var(--color-antracita);
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 0.875rem;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.os-mv-tab.is-active { background: var(--color-naranja-accion); color: var(--color-blanco); }
.os-mv-tab.is-drop { background: var(--color-verde-bosque); color: var(--color-blanco); box-shadow: 0 0 0 3px rgba(46, 107, 58, 0.3); }
.os-mv-tab--add {
	padding: 7px 14px;
	font-size: 1.1rem;
	background: transparent;
	border: 1px dashed var(--color-ocre);
	color: var(--color-gris-calido);
}
.os-mv-tab:focus-visible,
.os-mv-tab--add:focus-visible { outline: 3px solid var(--color-naranja-accion); outline-offset: 2px; }
.os-mv-tab-edit { background: var(--color-blanco); box-shadow: inset 0 0 0 2px var(--color-naranja-accion); }

/* --- Cuerpo desplazable con los grupos por CPT --- */

.os-mv-day {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 18px;
	background: var(--color-blanco);
}
.os-mv-group { margin-bottom: 18px; }

/* Cabeceras de grupo estilo os-tag (11px, mayúsculas, gris cálido). */
.os-mv-group__title {
	margin: 0 0 10px;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--color-gris-calido);
}

/* --- Tarjeta de elemento en el panel --- */

.os-mv-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	margin-bottom: 8px;
	border: 1px solid var(--color-arena);
	border-radius: 10px;
	background: var(--color-blanco);
	cursor: grab;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.os-mv-item:hover { box-shadow: 0 3px 12px rgba(26, 26, 26, 0.1); }
.os-mv-item.is-dragging {
	opacity: 0.92;
	transform: rotate(2deg) scale(1.02);
	box-shadow: 0 12px 28px rgba(26, 26, 26, 0.28);
	cursor: grabbing;
}
.os-mv-item__handle {
	flex: 0 0 auto;
	width: 20px;
	color: var(--color-ocre);
	display: inline-flex;
	align-items: center;
}
.os-mv-item__handle svg { width: 20px; height: 20px; }
.os-mv-item__thumb {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	background: var(--color-arena) center / cover no-repeat;
}
.os-mv-item__thumb--ph { background-size: 26px; }
.os-mv-item__thumb--lugares { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E6B3A' stroke-width='1.7'%3E%3Cpath d='M12 21s-6-5.5-6-10a6 6 0 1 1 12 0c0 4.5-6 10-6 10z'/%3E%3Ccircle cx='12' cy='11' r='2.2'/%3E%3C/svg%3E"); }
.os-mv-item__thumb--rutas { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E6B3A' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 19l5-9 3.5 5.5L15 11l6 8z'/%3E%3C/svg%3E"); }
.os-mv-item__thumb--negocios { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8651A' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M4 10v9h16v-9'/%3E%3Cpath d='M3 5h18l1 4a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0z'/%3E%3C/svg%3E"); }
.os-mv-item__thumb--eventos { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8651A' stroke-width='1.7'%3E%3Crect x='4' y='5' width='16' height='15' rx='1'/%3E%3Cpath d='M4 9h16M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.os-mv-item__thumb--territorios { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A1A1A' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 19l5-9 3.5 5.5L15 11l6 8z'/%3E%3C/svg%3E"); }
.os-mv-item__thumb--itinerarios { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C4AD82' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M6 21V4M6 4h11l-2 4 2 4H6'/%3E%3C/svg%3E"); }
.os-mv-item__body { flex: 1 1 auto; min-width: 0; }
.os-mv-item__title {
	display: block;
	font-family: 'Source Serif 4', Georgia, serif;
	font-weight: 600;
	font-size: 0.9375rem;
	color: var(--color-negro);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.os-mv-item__title:hover { color: var(--color-naranja-accion); text-decoration: underline; }
.os-mv-item__remove {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--color-gris-calido);
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease;
}
.os-mv-item:hover .os-mv-item__remove,
.os-mv-item__remove:focus-visible { opacity: 1; }
.os-mv-item__remove:hover { background: var(--color-arena); color: var(--color-naranja-accion); }
/* En pantallas táctiles (sin hover) el × siempre visible. */
@media (hover: none) {
	.os-mv-item__remove { opacity: 1; }
}

/* --- Estado vacío global --- */

.os-mv-emptystate {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 48px 24px;
}
.os-mv-emptystate__ill { color: var(--color-ocre); margin-bottom: 8px; }
.os-mv-emptystate__ill svg { width: 96px; height: 96px; }
.os-mv-emptystate__title {
	margin: 0;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1.1rem;
	color: var(--color-negro);
}
.os-mv-emptystate__hint {
	margin: 0;
	font-size: 0.9rem;
	color: var(--color-gris-calido);
	max-width: 32ch;
}
.os-mv-emptystate__explore-title {
	margin: 16px 0 0;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--color-negro);
}
.os-mv-emptystate__links {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	width: 100%;
	max-width: 330px;
	margin-top: 4px;
}
.os-mv-emptystate__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px 10px;
	border: 1px solid var(--color-naranja-accion);
	border-radius: 8px;
	background: transparent;
	color: var(--color-naranja-accion);
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.1;
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
.os-mv-emptystate__link:active { transform: scale(0.97); }
.os-mv-emptystate__link:focus-visible { outline: 3px solid var(--color-negro); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
	.os-mv-emptystate__link:hover { background: var(--color-naranja-accion); color: var(--color-blanco); }
}
.os-mv-day-empty {
	color: var(--color-gris-calido);
	font-size: 0.9rem;
	text-align: center;
	padding: 28px 12px;
}

/* --- Zona inferior pinada: aviso + acciones --- */

.os-mv-bottom {
	flex: 0 0 auto;
	background: var(--color-crema);
	border-top: 1px solid var(--color-arena);
}
.os-mv-hint {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	padding: 10px 18px 2px;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--color-gris-calido);
}
.os-mv-hint__icon { flex: 0 0 auto; display: inline-flex; }
.os-mv-hint__icon svg { width: 15px; height: 15px; }

.os-mv-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px 16px;
}
.os-mv-footer[hidden] { display: none; }
.os-mv-footer button {
	min-height: 44px;
	border-radius: 8px;
	cursor: pointer;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 0.875rem;
}
.os-mv-footer button:focus-visible { outline: 3px solid var(--color-negro); outline-offset: 2px; }
/* Primaria: Descargar PDF. */
.os-mv-pdf { flex: 1 1 auto; border: 0; background: var(--color-naranja-accion); color: var(--color-blanco); }
.os-mv-pdf:hover { background: var(--os-mv-accion-hover); }
.os-mv-pdf.is-loading { opacity: 0.7; cursor: progress; }
/* Secundaria: Compartir (outline verde bosque). */
.os-mv-share { flex: 1 1 auto; border: 2px solid var(--color-verde-bosque); background: transparent; color: var(--color-verde-bosque); }
.os-mv-share:hover { background: var(--color-verde-bosque); color: var(--color-blanco); }
/* Terciaria: Vaciar (solo texto). */
.os-mv-clear { flex: 0 0 auto; border: 0; background: transparent; color: var(--color-gris-calido); padding: 0 10px; text-decoration: underline; }
.os-mv-clear:hover { color: var(--color-naranja-accion); }

/* --- Diálogo de confirmación de marca (sustituye a confirm()) --- */

.os-mv-confirm-back {
	position: fixed;
	inset: 0;
	/* Por encima del resto de capas de Mi Viaje pero POR DEBAJO de la admin bar
	   de WordPress (99999): su backdrop inset:0 la tapaba con z-index 100000. */
	z-index: calc(var(--os-mv-z) + 8);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(26, 26, 26, 0.5);
	opacity: 0;
	transition: opacity 0.18s ease;
}
.os-mv-confirm-back.is-open { opacity: 1; }
.os-mv-confirm {
	width: 100%;
	max-width: 360px;
	padding: 24px;
	border-radius: 14px;
	background: var(--color-blanco);
	box-shadow: 0 20px 50px rgba(26, 26, 26, 0.35);
	font-family: 'Source Serif 4', Georgia, serif;
	color: var(--color-antracita);
}
.os-mv-confirm__title {
	margin: 0 0 8px;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1.2rem;
	color: var(--color-negro);
}
.os-mv-confirm__msg { margin: 0 0 20px; font-size: 0.95rem; }
.os-mv-confirm__actions { display: flex; justify-content: flex-end; gap: 10px; }
.os-mv-confirm__actions button {
	min-height: 44px;
	padding: 0 18px;
	border-radius: 8px;
	cursor: pointer;
	font-family: 'Bricolage Grotesque', system-ui, sans-serif;
	font-weight: 600;
}
.os-mv-confirm__actions button:focus-visible { outline: 3px solid var(--color-negro); outline-offset: 2px; }
.os-mv-confirm__no { border: 2px solid var(--color-arena); background: transparent; color: var(--color-antracita); }
.os-mv-confirm__no:hover { background: var(--color-arena); }
.os-mv-confirm__yes { border: 0; background: var(--color-naranja-accion); color: var(--color-blanco); }
.os-mv-confirm__yes:hover { background: var(--os-mv-accion-hover); }

/* ----------------------------------------------------------------- toast --- */

.os-mv-toast {
	position: fixed;
	left: 50%;
	bottom: 88px;
	z-index: calc(var(--os-mv-z) + 1);
	transform: translate(-50%, 12px);
	max-width: 90vw;
	padding: 12px 18px;
	border-radius: 8px;
	background: var(--color-antracita);
	color: var(--color-blanco);
	font-family: 'Source Serif 4', Georgia, serif;
	font-size: 0.9rem;
	box-shadow: var(--os-mv-shadow);
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}
.os-mv-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- responsive --- */

@media (max-width: 767px) {
	/* Panel a pantalla completa con animación de subida. */
	.os-mi-viaje-panel {
		width: 100%;
		max-width: 100%;
		transform: translateY(100%);
	}
	.os-mi-viaje-panel.is-open { transform: translateY(0); }
	.os-mv-badge { right: 16px; bottom: 16px; }
}

/* ---------------------------------------------------- movimiento reducido --- */

@media (prefers-reduced-motion: reduce) {
	.os-mi-viaje-panel,
	.os-mv-badge,
	.os-mv-item,
	.os-mv-tab,
	.os-mv-item__remove,
	.os-mv-confirm-back,
	.os-mv-toast,
	.os-favorito__icon {
		transition: none !important;
	}
	.os-favorito--pop .os-favorito__icon,
	.os-mv-item.is-dragging { animation: none !important; }
}

/* ------------------------------- botón "Descargar PDF" de Itinerarios ------- */

.os-itin-pdf-boton {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 22px;
	border-radius: 8px;
	background: var(--color-naranja-accion);
	color: var(--color-blanco);
	font-weight: 600;
	text-decoration: none;
}
.os-itin-pdf-boton::before {
	content: "";
	display: inline-block;
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10m0 0l-4-4m4 4l4-4M5 19h14' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10m0 0l-4-4m4 4l4-4M5 19h14' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.os-itin-pdf-boton:hover { filter: brightness(0.94); color: var(--color-blanco); }
.os-itin-pdf-boton:focus-visible { outline: 3px solid var(--color-antracita); outline-offset: 2px; }
