/* ================================
   CONTRATAR PAGE
   ================================ */
.contratar-page {
	min-height: 100vh;
	padding: 8rem 2rem 4rem;

	@media (max-width: 768px) {
		padding: 6rem 1.5rem 3rem;
	}
}

.contratar-container {
	max-width: 1100px;
	margin: 0 auto;
}

/* ================================
   HEADER
   ================================ */
.contratar-header {
	text-align: center;
	margin-bottom: 4rem;

	@media (max-width: 768px) {
		margin-bottom: 3rem;
	}
}

.contratar-label {
	display: inline-block;
	font-size: 0.85rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: var(--color-white);
	background: rgba(255, 255, 255, 0.15);
	padding: 0.5rem 1rem;
	border-radius: var(--radius-full);
	margin-bottom: 1.5rem;
}

.contratar-header h1 {
	font-size: clamp(2.5rem, 6vw, 4rem);
	font-weight: 800;
	line-height: 1.1;
	color: var(--color-white);
	margin-bottom: 1rem;

	.highlight {
		text-decoration: underline;
		text-decoration-color: rgba(255, 255, 255, 0.4);
		text-underline-offset: 6px;
	}
}

.contratar-subtitle {
	font-size: 1.15rem;
	color: rgba(255, 255, 255, 0.85);
	line-height: 1.7;
	max-width: 600px;
	margin: 0 auto;
}

/* ================================
   CARDS GRID
   ================================ */
.contratar-cards {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: 2rem;
	margin-bottom: 4rem;
	align-items: start;

	@media (max-width: 900px) {
		grid-template-columns: 1fr;
		max-width: 500px;
		margin-left: auto;
		margin-right: auto;
	}
}

/* ================================
   CARD BASE
   ================================ */
.contratar-card {
	background: var(--color-white);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	position: relative;
	box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);

	@media (max-width: 768px) {
		padding: 2rem 1.5rem;
	}
}

.contratar-card__badge {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-primary);
	color: var(--color-white);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	padding: 0.5rem 1.25rem;
	border-radius: var(--radius-full);
}

.contratar-card__header {
	text-align: center;
	margin-bottom: 2rem;

	h2 {
		font-size: 1.5rem;
		font-weight: 700;
		color: var(--color-text);
		margin-bottom: 0.75rem;
	}
}

.contratar-card__desc {
	font-size: 0.95rem;
	color: var(--color-text-light);
	line-height: 1.6;
}

/* Price */
.contratar-card__price {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: 0.25rem;
	margin-bottom: 0.5rem;
}

.price-amount {
	font-size: 4rem;
	font-weight: 800;
	color: var(--color-text);
	line-height: 1;
}

.price-currency {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--color-text);
	margin-top: 0.5rem;
}

.contratar-card__price-note {
	font-size: 0.85rem;
	color: var(--color-text-light);
}

/* Features */
.contratar-card__features {
	list-style: none;
	padding: 0;
	margin: 0 0 2rem 0;

	li {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.75rem 0;
		border-bottom: 1px solid rgba(0, 0, 0, 0.06);
		font-size: 0.95rem;
		color: var(--color-text);

		&:last-child {
			border-bottom: none;
		}
	}

	.material-symbols-outlined {
		font-size: 20px;
		color: var(--color-primary);
	}
}

.contratar-card__features--simple {
	li {
		padding: 0.6rem 0;
	}

	.material-symbols-outlined {
		color: var(--color-text-light);
	}
}

/* Buttons */
.contratar-card__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 1rem 2rem;
	border: none;
	border-radius: var(--radius-md);
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 1rem;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);

	.material-symbols-outlined {
		font-size: 20px;
	}
}

.contratar-card__btn--primary {
	background: var(--color-primary);
	color: var(--color-white);

	&:hover {
		transform: translateY(-2px);
		box-shadow: 0 10px 30px rgba(166, 93, 87, 0.3);
	}
}

.contratar-card__btn--secondary {
	background: var(--color-background);
	color: var(--color-text);
	border: 1px solid rgba(0, 0, 0, 0.1);

	&:hover {
		background: var(--color-text);
		color: var(--color-white);
		border-color: var(--color-text);
	}
}

.contratar-card__secure {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1rem;
	font-size: 0.8rem;
	color: var(--color-text-light);

	.material-symbols-outlined {
		font-size: 16px;
	}
}

/* ================================
   PRIMARY CARD STYLES
   ================================ */
.contratar-card--primary {
	border: 2px solid var(--color-primary);
}

/* ================================
   SECONDARY CARD STYLES
   ================================ */
.contratar-card--secondary {
	display: flex;
	flex-direction: column;

	.contratar-card__header {
		margin-bottom: 1.5rem;
	}
}

/* Form inside card */
.contratar-card__form {
	textarea {
		field-sizing: content;
		min-height: 50px;
		resize: vertical;
	}
}

/* ================================
   INFO / STEPS
   ================================ */
.contratar-info {
	text-align: center;

	h3 {
		font-size: 1.25rem;
		font-weight: 700;
		color: var(--color-white);
		margin-bottom: 2rem;
	}
}

.contratar-steps {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem;

	@media (max-width: 768px) {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}

.contratar-step {
	text-align: center;
}

.contratar-step__number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	background: rgba(255, 255, 255, 0.15);
	color: var(--color-white);
	font-size: 1.25rem;
	font-weight: 700;
	border-radius: 50%;
	margin-bottom: 1rem;
}

.contratar-step h4 {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--color-white);
	margin-bottom: 0.5rem;
}

.contratar-step p {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.75);
	line-height: 1.5;
}

/* ================================
   TEMPLATE MODAL
   ================================ */
.template-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.template-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.template-modal.is-open .template-modal__overlay {
	opacity: 1;
}

.template-modal__content {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--color-white);
	border-radius: var(--radius-lg);
	width: 100%;
	max-width: 900px;
	max-height: 90vh;
	overflow: hidden;
	transform: scale(0.95);
	opacity: 0;
	transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

.template-modal.is-open .template-modal__content {
	transform: scale(1);
	opacity: 1;
}

.template-modal__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.05);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 1;

	&:hover {
		background: rgba(0, 0, 0, 0.1);
	}

	.material-symbols-outlined {
		font-size: 24px;
		color: var(--color-text);
	}
}

.template-modal__header {
	text-align: center;
	padding: 2rem 2rem 0;

	h2 {
		font-size: 1.5rem;
		font-weight: 700;
		color: var(--color-text);
		margin-bottom: 0.5rem;
	}

	p {
		font-size: 0.95rem;
		color: var(--color-text-light);
	}
}

.template-modal__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 2rem;
}

.template-modal__footer {
	flex-shrink: 0;
	padding: 1.5rem 2rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	background: var(--color-white);
}

.template-modal__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 1rem 2rem;
	background: var(--color-primary);
	color: var(--color-white);
	border-radius: var(--radius-md);
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 1rem;
	text-decoration: none;
	transition: all 0.3s ease;

	&:hover {
		transform: translateY(-2px);
		box-shadow: 0 10px 30px rgba(166, 93, 87, 0.3);
	}

	.material-symbols-outlined {
		font-size: 20px;
	}
}

/* Template Grid */
.template-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
	margin-bottom: 2rem;

	@media (max-width: 900px) {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Mobile: horizontal scroll carousel */
	@media (max-width: 600px) {
		display: flex;
		overflow-x: auto;
		overflow-y: visible;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: 0.75rem;
		padding-top: 1rem;
		padding-bottom: 1rem;
		margin-left: -1rem;
		margin-right: -1rem;
		padding-left: 1rem;
		padding-right: 1rem;

		/* Scrollbar visible */
		scrollbar-width: thin;
		scrollbar-color: var(--color-primary) rgba(0, 0, 0, 0.1);

		&::-webkit-scrollbar {
			height: 6px;
		}

		&::-webkit-scrollbar-track {
			background: rgba(0, 0, 0, 0.1);
			border-radius: 3px;
		}

		&::-webkit-scrollbar-thumb {
			background: var(--color-primary);
			border-radius: 3px;
		}

		/* Cada wrapper: 45% del ancho para mostrar ~2 + un trozo */
		.template-card-wrapper {
			flex: 0 0 45%;
			min-width: 45%;
			scroll-snap-align: start;
		}

		/* La opción "No lo tengo claro" un poco más pequeña */
		.template-card--undecided {
			flex: 0 0 40%;
			min-width: 40%;
			scroll-snap-align: start;
		}
	}
}

/* Template Card Wrapper */
.template-card-wrapper {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Template Card */
.template-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--color-background);
	border: 2px solid transparent;
	border-radius: var(--radius-md);
	overflow: hidden;
	cursor: pointer;
	transition: all 0.3s ease;

	&:hover {
		border-color: var(--color-primary);
		transform: translateY(-2px);
	}

	input[type="radio"] {
		position: absolute;
		opacity: 0;
		pointer-events: none;
	}

	input[type="radio"]:checked + .template-card__preview,
	input[type="radio"]:checked + .template-card__icon {
		& ~ .template-card__check {
			opacity: 1;
		}
	}

	input[type="radio"]:checked ~ * {
		border-color: var(--color-primary);
	}

	&:has(input:checked) {
		border-color: var(--color-primary);
		box-shadow: 0 4px 20px rgba(166, 93, 87, 0.2);
	}
}

.template-card__preview {
	aspect-ratio: 4 / 3;
	overflow: hidden;

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		transition: transform 0.3s ease;
	}

	.template-card:hover & img {
		transform: scale(1.05);
	}
}

.template-card__icon {
	aspect-ratio: 4 / 3;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.03);

	.material-symbols-outlined {
		font-size: 48px;
		color: var(--color-text-light);
	}
}

.template-card__info {
	padding: 1rem;
	text-align: center;

	h3 {
		font-size: 1rem;
		font-weight: 700;
		color: var(--color-text);
		margin-bottom: 0.25rem;
	}

	span {
		font-size: 0.8rem;
		color: var(--color-text-light);
	}
}

.template-card__check {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-primary);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;

	.material-symbols-outlined {
		font-size: 16px;
		color: var(--color-white);
	}
}

.template-card__demo {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--color-primary);
	text-decoration: none;
	padding: 0.5rem 1rem;
	background: rgba(166, 93, 87, 0.08);
	border-radius: var(--radius-sm);
	transition: all 0.2s ease;

	&:hover {
		background: rgba(166, 93, 87, 0.15);
		color: var(--color-primary-dark);
	}

	.material-symbols-outlined {
		font-size: 16px;
	}
}

/* Undecided variant */
.template-card--undecided {
	.template-card__icon {
		background: rgba(0, 0, 0, 0.02);
	}
}

/* ================================
   PALETTE SELECTOR
   ================================ */
.palette-selector {
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	padding-top: 1.5rem;

	h3 {
		font-size: 1rem;
		font-weight: 600;
		color: var(--color-text);
		margin-bottom: 1rem;
		text-align: center;
	}
}

.palette-grid {
	display: flex;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.palette-swatch {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all 0.2s ease;

	&:hover {
		background: rgba(0, 0, 0, 0.03);
	}

	&:has(input:checked) {
		background: rgba(0, 0, 0, 0.05);
	}

	input[type="radio"] {
		position: absolute;
		opacity: 0;
		pointer-events: none;
	}
}

.palette-swatch__color {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background-color: var(--swatch-bg, #F9FAF7);
	border: 3px solid var(--swatch-border, #A65D57);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	transition: transform 0.2s ease, box-shadow 0.2s ease;

	.palette-swatch:hover & {
		transform: scale(1.1);
	}

	.palette-swatch:has(input:checked) & {
		transform: scale(1.1);
		box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
	}
}

.palette-swatch__name {
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--color-text);
}

.palette-swatch__check {
	position: absolute;
	top: 0.75rem;
	right: 0.5rem;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-primary);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;

	.material-symbols-outlined {
		font-size: 14px;
		color: var(--color-white);
	}

	.palette-swatch:has(input:checked) & {
		opacity: 1;
	}
}

/* ===========================================
   TYPOGRAPHY SELECTOR
   =========================================== */

.typography-selector {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);

	h3 {
		font-size: 1rem;
		font-weight: 600;
		margin-bottom: 1rem;
		text-align: center;
		color: var(--color-text);
	}
}

.typography-grid {
	display: flex;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.typography-option {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem 1.25rem;
	border-radius: var(--radius-md);
	border: 2px solid transparent;
	cursor: pointer;
	transition: all 0.2s ease;
	background: rgba(0, 0, 0, 0.02);
	min-width: 100px;

	&:hover {
		background: rgba(0, 0, 0, 0.05);
		border-color: rgba(0, 0, 0, 0.1);
	}

	&:has(input:checked) {
		background: rgba(var(--color-primary-rgb, 166, 93, 87), 0.08);
		border-color: var(--color-primary);
	}

	input[type="radio"] {
		position: absolute;
		opacity: 0;
		pointer-events: none;
	}
}

.typography-option__preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
}

.typography-option__heading {
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1;
	color: var(--color-text);
}

.typography-option__body {
	font-size: 0.85rem;
	color: var(--color-text-light);
}

.typography-option__name {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--color-text-light);
	text-align: center;
}

.typography-option__check {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-primary);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;

	.material-symbols-outlined {
		font-size: 12px;
		color: var(--color-white);
	}

	.typography-option:has(input:checked) & {
		opacity: 1;
	}
}

/* ===========================================
   PRESELECTED ANIMATION (URL params)
   =========================================== */
@keyframes preselect-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(166, 93, 87, 0.5);
	}
	100% {
		box-shadow: 0 0 0 16px rgba(166, 93, 87, 0);
	}
}

/* Preparar GPU antes de animar */
.will-animate {
	will-change: box-shadow;
	transform: translateZ(0);
}

.is-preselected {
	animation: preselect-pulse 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Palette swatch preselected */
.palette-swatch.is-preselected .palette-swatch__color {
	animation: preselect-pulse 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.15s forwards;
}

/* Typography preselected */
.typography-option.is-preselected {
	animation: preselect-pulse 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.25s forwards;
}
