/**
 * Frontend styles for Hosting Pricing Selector.
 *
 * @package Hosting_Pricing_Selector
 */

/* CSS Variables for theming */
.hp-pricing-table {
	--hp-primary: #379682;
	--hp-primary-dark: #2d7869;
	--hp-bg: #ffffff;
	--hp-card-bg: #ffffff;
	--hp-border: #e0e0e0;
	--hp-border-dark: #333333;
	--hp-radius: 8px;
	--hp-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	--hp-featured-bg: #e8f5f2;
	--hp-featured-border: #379682;
	--hp-text: #333333;
	--hp-text-light: #666666;
	--hp-sale-badge: #379682;
	--hp-sale-badge-text: #ffffff;
	--hp-term-badge: #8b5cf6;
	--hp-term-badge-text: #ffffff;
	--hp-spacing: 1.5rem;
	--hp-spacing-small: 1rem;
	--hp-spacing-large: 2rem;
}

/* Prevent scrollbar appearance from shifting layout when cards change */
body:has(.hp-pricing-table) {
	scrollbar-gutter: stable;
}

/* Container */
.hp-pricing-table {
	max-width: 100%;
	margin: var(--hp-spacing-large) 0;
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--hp-text);
}

/* Hosting Type Selector Wrapper */
.hp-type-selector-wrapper {
	display: flex;
	justify-content: center;
	margin-bottom: var(--hp-spacing);
	width: 100%;
}

/* Hosting Type Selector */
.hp-type-selector {
	display: inline-flex;
	gap: 0;
	flex-wrap: nowrap;
	border: 2px solid #000000;
	border-radius: 999px;
	padding: 4px;
	background: transparent;
	max-width: 800px;
	width: auto;
	min-width: 600px;
	overflow: visible;
	isolation: isolate;
}

.hp-type-tab {
	position: relative;
	flex: 1;
	min-width: 0;
	padding: 0.875rem 1.25rem;
	background: var(--hp-bg);
	border: none;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--hp-text);
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	margin: 0;
	line-height: 1.2;
	box-sizing: border-box;
}

.hp-type-tab:not(.hp-active) {
	z-index: 0;
}

.hp-type-tab:hover:not(.hp-active) {
	background: #f5f5f5;
}

.hp-type-tab:focus {
	outline: 2px solid var(--hp-primary);
	outline-offset: 2px;
}

.hp-type-tab.hp-active {
	position: relative;
	z-index: 1;
	background: #000000;
	color: #ffffff;
	border: none;
	box-shadow: inset 0 0 0 2px var(--hp-primary);
}

/* Overlap next pill so selected pill’s right edge (and teal stroke) isn’t cut off */

.hp-type-label {
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.2;
}

.hp-type-tab.hp-active .hp-type-label {
	color: #ffffff;
	font-weight: 700;
}

.hp-type-subtitle {
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.2;
}

.hp-type-tab.hp-active .hp-type-subtitle {
	color: #ffffff;
	opacity: 1;
}

.hp-type-tab:not(.hp-active) .hp-type-subtitle {
	color: #666666;
}

/* Term Selector */
.hp-term-selector {
	margin-bottom: var(--hp-spacing);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.hp-term-label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
	font-size: 1rem;
	color: var(--hp-text);
	text-align: center;
}

.hp-term-select {
	width: 100%;
	max-width: 300px;
	padding: 0.75rem 1rem;
	border: 2px solid var(--hp-border);
	border-radius: var(--hp-radius);
	font-size: 1rem;
	background: var(--hp-bg);
	color: var(--hp-text);
	cursor: pointer;
	transition: border-color 0.2s ease;
	margin: 0 auto;
}

.hp-term-select:hover,
.hp-term-select:focus {
	border-color: var(--hp-primary);
	outline: none;
}

/* Plan Cards Container */
.hp-plan-cards {
	display: grid;
	gap: var(--hp-spacing);
	margin-top: var(--hp-spacing);
	justify-content: center;
	width: 100%;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.hp-plan-card-wrapper {
	/* Wrapper for plan cards to enable show/hide functionality */
	min-width: 0;
	width: 100%;
}

/* Flexible column widths so cards don't overflow or squash in narrow containers */
.hp-plan-cards.hp-cols-2 {
	grid-template-columns: repeat(2, minmax(339px, 389px));
}

.hp-plan-cards.hp-cols-3 {
	grid-template-columns: repeat(3, minmax(339px, 389px));
}

.hp-plan-cards.hp-cols-4 {
	grid-template-columns: repeat(4, minmax(291px, 389px));
}

/* Center cards when visible count is less than columns (e.g. 3 cards in 4-col grid) */
.hp-plan-cards.hp-cols-4.hp-visible-3 {
	grid-template-columns: 1fr repeat(3, minmax(291px, 389px)) 1fr;
}

.hp-plan-cards.hp-cols-4.hp-visible-2 {
	grid-template-columns: 1fr repeat(2, minmax(339px, 389px)) 1fr;
}

.hp-plan-cards.hp-cols-4.hp-visible-1,
.hp-plan-cards.hp-cols-3.hp-visible-1 {
	grid-template-columns: 1fr minmax(339px, 389px) 1fr;
}

.hp-plan-cards.hp-cols-3.hp-visible-2 {
	grid-template-columns: 1fr repeat(2, minmax(339px, 389px)) 1fr;
}

@media (max-width: 1400px) and (min-width: 1024px) {
	.hp-plan-cards.hp-cols-3 {
		grid-template-columns: repeat(3, minmax(339px, 389px));
	}
}

/* Plan Card */
.hp-plan-card {
	position: relative;
	padding: var(--hp-spacing-large);
	background: var(--hp-card-bg);
	border: 2px solid var(--hp-border);
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	width: 100%;
	box-sizing: border-box;
}

.hp-plan-card.hp-featured {
	background: var(--hp-featured-bg);
	border-color: var(--hp-featured-border);
	border-width: 3px;
}

/* Badges */
.hp-badge {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.hp-badge-popular {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--hp-bg);
	color: var(--hp-text);
	border: 2px solid var(--hp-featured-border);
	z-index: 1;
}

.hp-badge-sale {
	background: var(--hp-sale-badge);
	color: var(--hp-sale-badge-text);
	margin-bottom: 0.35rem;
	align-self: flex-start;
}

/* Plan Name and Tagline */
.hp-plan-name {
	margin: 0 0 0.25rem 0;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--hp-text);
	line-height: 1.2;
}

.hp-plan-tagline {
	margin: 0 0 0.35rem 0;
	font-size: 0.875rem;
	color: var(--hp-text-light);
	line-height: 1.4;
}

/* Price Block */
.hp-price-block {
	margin: 0.5rem 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.hp-price-label {
	font-size: 0.875rem;
	color: var(--hp-text-light);
}

.hp-price-amount-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.hp-price-amount {
	font-size: 2rem;
	font-weight: 700;
	color: #000000;
	line-height: 1.1;
}

/* Pill: wrap contains SAVE X% text + info icon */
.hp-save-percent-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	position: relative;
	background: rgba(55, 150, 130, 0.15);
	padding: 0.2rem 0.4rem 0.2rem 0.5rem;
	border-radius: 999px;
}

.hp-save-percent {
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--hp-primary);
}

.hp-save-info-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	background: var(--hp-primary);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	font-style: italic;
	font-family: serif;
	line-height: 1;
	cursor: help;
	transition: background 0.2s, opacity 0.2s;
	flex-shrink: 0;
}

.hp-save-info-trigger:hover,
.hp-save-info-trigger:focus {
	background: var(--hp-primary-dark);
	outline: none;
}

.hp-save-info-trigger:focus {
	box-shadow: 0 0 0 2px var(--hp-primary);
}

.hp-save-info-tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-bottom: 0.4rem;
	padding: 0.5rem 0.65rem;
	max-width: 240px;
	background: #333;
	color: #fff;
	font-size: 0.75rem;
	line-height: 1.4;
	border-radius: 6px;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s;
	pointer-events: none;
	z-index: 1000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hp-save-percent-wrap:hover .hp-save-info-tooltip,
.hp-save-percent-wrap:focus-within .hp-save-info-tooltip {
	opacity: 1;
	visibility: visible;
}

/* CTA Button */
.hp-cta-button {
	display: inline-block;
	padding: 0.875rem 1.5rem;
	margin: 0.6rem 0;
	border-radius: var(--hp-radius);
	font-size: 1rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: all 0.2s ease;
	cursor: pointer;
	border: 2px solid var(--hp-primary);
}

.hp-cta-primary {
	background: var(--hp-primary);
	color: var(--hp-bg);
}

.hp-cta-primary:hover {
	background: var(--hp-primary-dark);
	border-color: var(--hp-primary-dark);
	color: var(--hp-bg);
}

.hp-cta-secondary {
	background: var(--hp-bg);
	color: var(--hp-primary);
}

.hp-cta-secondary:hover {
	background: var(--hp-primary);
	color: var(--hp-bg);
}

.hp-cta-button:focus {
	outline: 2px solid var(--hp-primary);
	outline-offset: 2px;
}

/* Renewal Text */
.hp-renewal-text {
	margin: 0.2rem 0 0.1rem 0;
	font-size: 0.75rem;
	color: var(--hp-text-light);
	text-align: center;
}

/* Features List */
.hp-features-list {
	list-style: none;
	padding: 0;
	padding-top: 0.2rem;
	margin: 0.2rem 0 var(--hp-spacing-small) 0;
	border-top: 1px solid var(--hp-border);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.hp-feature-item {
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--hp-text);
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.hp-feature-item::before {
	content: '';
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	background: var(--hp-primary);
	border-radius: 50%;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	background-color: var(--hp-primary);
}

/* View More */
.hp-view-more,
.hp-view-more-link,
.hp-more-details-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: var(--hp-spacing-small);
	padding: 0.5rem 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--hp-text-light);
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.2s ease;
}

.hp-view-more:hover,
.hp-view-more-link:hover {
	color: var(--hp-primary);
}

.hp-view-more:focus {
	outline: 2px solid var(--hp-primary);
	outline-offset: 2px;
	border-radius: 2px;
}

.hp-chevron {
	font-size: 0.75rem;
	transition: transform 0.2s ease;
}

.hp-view-more[aria-expanded="true"] .hp-chevron {
	transform: rotate(180deg);
}

.hp-features-hidden {
	display: none;
}

.hp-view-more[aria-expanded="true"] ~ .hp-features-hidden,
.hp-features-hidden.hp-expanded {
	display: block;
}

/* Responsive Design */
/* hp-cols-3 stays at 3 columns until 960px so 3-col has room in full-width Avada containers */
@media (max-width: 960px) {
	.hp-plan-cards.hp-cols-3,
	.hp-plan-cards.hp-cols-3.hp-visible-1,
	.hp-plan-cards.hp-cols-3.hp-visible-2 {
		grid-template-columns: repeat(2, minmax(339px, 389px));
		justify-content: center;
	}

	.hp-plan-cards.hp-cols-3 .hp-plan-card-wrapper {
		grid-column: auto !important;
	}
}

/* hp-cols-4 stays at 4 columns until 1000px so 4-col has room in full-width Avada containers */
@media (max-width: 1000px) {
	.hp-plan-cards.hp-cols-4,
	.hp-plan-cards.hp-cols-4.hp-visible-1,
	.hp-plan-cards.hp-cols-4.hp-visible-2,
	.hp-plan-cards.hp-cols-4.hp-visible-3 {
		grid-template-columns: repeat(2, minmax(339px, 389px));
		justify-content: center;
	}

	.hp-plan-cards.hp-cols-4 .hp-plan-card-wrapper {
		grid-column: auto !important;
	}
}

@media (max-width: 768px) {
	.hp-pricing-table {
		--hp-spacing: 1rem;
		--hp-spacing-small: 0.75rem;
		--hp-spacing-large: 1.5rem;
	}

	.hp-type-selector {
		flex-direction: column;
		min-width: auto;
		width: 100%;
		max-width: 100%;
	}

	.hp-type-tab {
		min-width: 0;
	}

	.hp-plan-cards {
		grid-template-columns: minmax(339px, 389px) !important;
		justify-content: center;
	}

	.hp-plan-card {
		padding: var(--hp-spacing);
	}

	.hp-price-amount {
		font-size: 2rem;
	}
}

/* Compact Layout */
.hp-pricing-table.hp-layout-compact {
	--hp-spacing: 1rem;
	--hp-spacing-small: 0.75rem;
	--hp-spacing-large: 1.25rem;
}

.hp-pricing-table.hp-layout-compact .hp-plan-card {
	padding: var(--hp-spacing);
}

.hp-pricing-table.hp-layout-compact .hp-price-amount {
	font-size: 2rem;
}


/* Override theme/browser focus rings (e.g. yellow) – use our primary only */
.hp-pricing-table .hp-type-tab:focus,
.hp-pricing-table .hp-type-tab:focus-visible,
.hp-pricing-table .hp-term-select:focus,
.hp-pricing-table .hp-term-select:focus-visible,
.hp-pricing-table .hp-cta-button:focus,
.hp-pricing-table .hp-cta-button:focus-visible,
.hp-pricing-table .hp-view-more:focus,
.hp-pricing-table .hp-view-more:focus-visible,
.hp-pricing-table .hp-more-details-toggle:focus,
.hp-pricing-table .hp-more-details-toggle:focus-visible,
.hp-pricing-table .hp-more-detail-item.hp-has-popup:focus,
.hp-pricing-table .hp-more-detail-item.hp-has-popup:focus-visible,
.hp-pricing-table .hp-more-details-category-title:focus,
.hp-pricing-table .hp-more-details-category-title:focus-visible,
.hp-pricing-table .hp-save-info-trigger:focus,
.hp-pricing-table .hp-save-info-trigger:focus-visible {
	outline: 2px solid var(--hp-primary);
	outline-offset: 2px;
	box-shadow: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
	.hp-plan-card,
	.hp-type-tab,
	.hp-cta-button,
	.hp-view-more,
	.hp-chevron {
		transition: none;
	}
}

/* Print Styles */
@media print {
	.hp-type-selector,
	.hp-term-selector,
	.hp-cta-button,
	.hp-view-more,
	.hp-view-more-link {
		display: none;
	}

	.hp-plan-cards {
		grid-template-columns: repeat(3, 320px);
		page-break-inside: avoid;
		justify-content: center;
	}

	.hp-plan-card {
		page-break-inside: avoid;
		border: 1px solid #000;
		box-shadow: none;
	}
}

/* More Details Section */
.hp-more-details-section {
	margin-top: 0.25rem;
	padding-top: 0.15rem;
	border-top: 1px solid var(--hp-border);
	background: transparent !important;
}

.hp-more-details-toggle {
	margin-top: 0.25rem;
	display: inline-flex;
}

.hp-more-details-content {
	background: transparent !important;
}

.hp-pricing-table .hp-more-details-section::before,
.hp-pricing-table .hp-more-details-section::after,
.hp-pricing-table .hp-more-details-content::before,
.hp-pricing-table .hp-more-details-content::after {
	display: none !important;
	content: none !important;
	background: none !important;
}

.hp-more-details-category {
	margin-bottom: var(--hp-spacing);
	background: none !important;
	background-color: transparent !important;
	border: none !important;
}

.hp-more-details-category::before,
.hp-more-details-category::after {
	display: none !important;
	content: none !important;
	background: none !important;
}

.hp-more-details-category:last-child {
	margin-bottom: 0;
}

.hp-more-details-category-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.5rem 0;
	color: var(--hp-text);
	background: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
	-webkit-tap-highlight-color: transparent;
}

.hp-more-details-category-title::before,
.hp-more-details-category-title::after {
	display: none !important;
	content: none !important;
	background: none !important;
}

/* Override theme/selection yellow in expanded "more details" */
.hp-pricing-table .hp-more-details-content .hp-more-details-category-title::selection {
	background: var(--hp-primary);
	color: #fff;
}

/* Strip Avada/theme yellow highlights from more-details (mark, [class*="highlight"]) */
.hp-pricing-table .hp-more-details-content mark,
.hp-pricing-table .hp-more-details-content [class*="highlight"] {
	background: none !important;
	background-color: transparent !important;
}

.hp-more-details-list {
	list-style: none;
	padding: 0;
	margin: 0;
	background: none !important;
	background-color: transparent !important;
	border: none !important;
}

.hp-more-details-list::before,
.hp-more-details-list::after {
	display: none !important;
	content: none !important;
	background: none !important;
}

.hp-more-detail-item {
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--hp-text);
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.375rem 0;
	position: relative;
	background: none !important;
	background-color: transparent !important;
}

.hp-more-detail-item::after {
	display: none !important;
	content: none !important;
	background: none !important;
}

.hp-more-detail-item::before {
	content: '';
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	background: var(--hp-primary);
	border-radius: 50%;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
	-webkit-mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
}

/* Detail name with extra info: dotted underline on hover */
.hp-more-detail-item.hp-has-popup {
	position: relative;
}

.hp-more-detail-item.hp-has-popup .hp-detail-name {
	cursor: default;
	text-decoration: none;
}

.hp-more-detail-item.hp-has-popup:focus {
	outline: 2px solid var(--hp-primary);
	outline-offset: 2px;
}

.hp-more-detail-item.hp-has-popup:hover .hp-detail-name,
.hp-more-detail-item.hp-has-popup:focus-within .hp-detail-name {
	text-decoration: underline;
	text-decoration-style: dotted;
}

/* Hover tooltip (neat popup box for Content Creator, etc.) */
.hp-popup.hp-detail-tooltip {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 0.5rem;
	z-index: 1000;
	display: none;
	min-width: 220px;
	max-width: 300px;
	pointer-events: auto;
}

.hp-popup.hp-detail-tooltip::before {
	content: '';
	position: absolute;
	top: -6px;
	left: 1rem;
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-bottom: 6px solid #fff;
	filter: drop-shadow(0 -1px 0 var(--hp-border));
}

.hp-popup.hp-detail-tooltip.hp-popup-visible {
	display: block;
}

.hp-popup {
	background: #fff;
	border: 1px solid var(--hp-border);
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
	padding: 0;
}

.hp-popup-content {
	padding: 1rem 1.25rem;
	position: relative;
}

.hp-popup-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.5rem 0;
	color: var(--hp-text);
	line-height: 1.3;
}

.hp-popup-description {
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--hp-text-light);
	margin: 0 0 0.5rem 0;
}

.hp-popup-description:last-child {
	margin-bottom: 0;
}

.hp-popup-learn-more {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--hp-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
	display: inline-block;
	margin-top: 0.25rem;
}

.hp-popup-learn-more:hover {
	text-decoration: none;
	color: var(--hp-primary-dark);
}

/* Responsive adjustments for hover tooltips */
@media (max-width: 768px) {
	.hp-popup.hp-detail-tooltip {
		max-width: min(320px, calc(100vw - 2rem));
	}
}
