/**
 * BAS Pricing Table + Registration Modal — Frontend Styles
 *
 * Covers:
 *   - Pricing table layout: toggle, card grid, plan cards, feature lists, CTA buttons
 *   - Modal overlay + dialog + plan banner
 *   - Responsive breakpoints
 *
 * CSS class prefix: .bas-pt__ (table) and .bas-pt-modal__ (modal)
 *
 * @package BAS_Vendor_Map
 * @since   3.23.0
 */

/* ─── Custom Properties ──────────────────────────────────────────────────── */

.bas_pricing_table {
	--bas-sage:        #70ac43;
	--bas-lime:        #c2e86b;
	--bas-forest:      #1d741b;
	--bas-teal:        #30b2b4;
	--bas-orange:      #ff4c25;
	--bas-coral:       #ff7660;
	--bas-cream:       #fffbef;
	--bas-charcoal:    #313131;
	--bas-border:      #d8e8c8;
	--bas-radius-pill: 100px;
	--bas-radius-card: 14px;
	font-family: 'Lato', sans-serif;
	color: var(--bas-charcoal);
}

/* ─── Toggle Row ─────────────────────────────────────────────────────────── */

.bas-pt__toggle-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-bottom: 44px;
	flex-wrap: wrap;
}

.bas-pt__toggle-label {
	font-family: 'Lato', sans-serif;
	font-size: 16px;
	font-weight: 600;
	color: #aaa;
	transition: color 0.2s;
	display: flex;
	align-items: center;
	gap: 8px;
}

.bas-pt__toggle-label--active {
	color: var(--bas-charcoal);
}

/* Toggle switch */
.bas-pt__switch {
	position: relative;
	width: 52px;
	height: 28px;
	background: #ddd;
	border: none;
	border-radius: var(--bas-radius-pill);
	cursor: pointer;
	padding: 0;
	transition: background 0.2s;
	flex-shrink: 0;
}

.bas-pt__switch[aria-checked="true"] {
	background: var(--bas-sage);
}

.bas-pt__thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2);
	transition: left 0.2s;
}

.bas-pt__switch[aria-checked="true"] .bas-pt__thumb {
	left: 27px;
}

/* Save chip */
.bas-pt__save-chip {
	display: inline-block;
	background: linear-gradient(135deg, var(--bas-lime), var(--bas-sage));
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: var(--bas-radius-pill);
	white-space: nowrap;
}

/* ─── Card Grid ──────────────────────────────────────────────────────────── */

.bas-pt__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	align-items: start;
}

/* ─── Plan Card ──────────────────────────────────────────────────────────── */

.bas-pt__card {
	position: relative;
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: var(--bas-radius-card);
	overflow: hidden;
	box-shadow: 0 2px 16px rgba(0,0,0,0.06);
	transition: box-shadow 0.2s, transform 0.2s;
	display: flex;
	flex-direction: column;
}

.bas-pt__card:hover {
	box-shadow: 0 6px 28px rgba(0,0,0,0.11);
	transform: translateY(-2px);
}

/* Featured (Maker) card */
.bas-pt__card--featured {
	border-color: var(--bas-orange);
	box-shadow: 0 4px 24px rgba(255,76,37,0.15);
	transform: translateY(-6px);
}

.bas-pt__card--featured:hover {
	transform: translateY(-9px);
}

/* Coming Soon (Bloom) card */
.bas-pt__card--soon {
	opacity: 0.85;
}

/* Top colour stripe */
.bas-pt__stripe {
	height: 5px;
	width: 100%;
}

.bas-pt__inner {
	padding: 28px 26px 32px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* Badges */
.bas-pt__popular,
.bas-pt__soon-banner {
	position: absolute;
	top: 14px;
	right: 14px;
	font-family: 'Lato', sans-serif;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	padding: 4px 12px;
	border-radius: var(--bas-radius-pill);
}

.bas-pt__popular {
	background: var(--bas-orange);
	color: #fff;
}

.bas-pt__soon-banner {
	background: var(--bas-teal);
	color: #fff;
}

/* Plan name */
.bas-pt__name {
	font-family: 'Playfair Display', Georgia, serif !important;
	font-size: 26px !important;
	font-weight: 700 !important;
	color: var(--bas-charcoal) !important;
	margin: 0 0 16px !important;
	padding: 0 !important;
}

/* Price */
.bas-pt__price-wrap {
	display: flex;
	align-items: flex-start;
	gap: 2px;
	margin-bottom: 4px;
	line-height: 1;
}

.bas-pt__sup {
	font-size: 20px;
	font-weight: 700;
	color: var(--bas-charcoal);
	margin-top: 6px;
}

.bas-pt__dollar {
	font-family: 'Playfair Display', Georgia, serif;
	font-size: 52px;
	font-weight: 700;
	color: var(--bas-charcoal);
	line-height: 1;
}

.bas-pt__per {
	font-size: 16px;
	color: #888;
	align-self: flex-end;
	padding-bottom: 8px;
}

.bas-pt__billing {
	font-size: 13px;
	color: #999;
	margin: 0 0 4px !important;
}

.bas-pt__annual-hint {
	font-size: 13px;
	color: #888;
	margin: 0 0 16px !important;
	min-height: 20px;
}

.bas-pt__hint-save {
	display: inline-block;
	background: #f0f8ea;
	color: var(--bas-forest);
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: var(--bas-radius-pill);
}

/* Commission badge */
.bas-pt__commission {
	display: inline-block;
	font-size: 13px;
	font-weight: 700;
	color: var(--bas-forest);
	background: #f0f8ea;
	border: 1px solid #c2e8a0;
	border-radius: var(--bas-radius-pill);
	padding: 4px 14px;
	margin-bottom: 20px;
}

.bas-pt__commission--neutral {
	color: #666;
	background: #f5f5f5;
	border-color: #ddd;
}

/* ─── Feature List ───────────────────────────────────────────────────────── */

.bas-pt__features {
	list-style: none !important;
	padding: 0 !important;
	margin: 0 0 24px !important;
	flex: 1;
}

.bas-pt__features li {
	position: relative;
	padding: 5px 0 5px 22px !important;
	font-size: 14px;
	line-height: 1.5;
	color: var(--bas-charcoal);
	border-bottom: 1px solid #f0f0f0;
	margin: 0 !important;
}

.bas-pt__features li::before {
	content: '✓';
	position: absolute;
	left: 0;
	color: var(--bas-sage);
	font-weight: 700;
	font-size: 13px;
}

.bas-pt__features li.bas-pt__feat--inherit {
	font-weight: 700;
	color: var(--bas-charcoal);
}

.bas-pt__features li.bas-pt__feat--inherit::before {
	content: '★';
	color: var(--bas-orange);
}

.bas-pt__feat-soon {
	display: inline-block;
	background: var(--bas-cream);
	border: 1px solid var(--bas-border);
	color: var(--bas-teal);
	font-size: 10px;
	font-weight: 700;
	padding: 1px 7px;
	border-radius: var(--bas-radius-pill);
	margin-left: 4px;
	vertical-align: middle;
}

/* ─── CTA Buttons ────────────────────────────────────────────────────────── */

.bas-pt__btn {
	display: block;
	width: 100%;
	padding: 13px 28px;
	font-family: 'Lato', sans-serif;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	border-radius: var(--bas-radius-pill);
	cursor: pointer;
	border: none;
	transition: filter 0.2s, transform 0.1s;
	text-decoration: none;
}

.bas-pt__btn:active {
	transform: scale(0.97);
}

/* Starter — sage green outline */
.bas-pt__btn--starter {
	background: transparent;
	color: var(--bas-sage);
	border: 2px solid var(--bas-sage);
}

.bas-pt__btn--starter:hover {
	background: var(--bas-sage);
	color: #fff;
}

/* Maker — gradient CTA */
.bas-pt__btn--maker {
	background: linear-gradient(180deg, var(--bas-lime) 0%, var(--bas-sage) 100%);
	color: #fff;
	border: 1px solid var(--bas-sage);
}

.bas-pt__btn--maker:hover {
	filter: brightness(1.06);
}

/* Bloom — teal, disabled */
.bas-pt__btn--bloom {
	background: var(--bas-teal);
	color: #fff;
	opacity: 0.7;
	cursor: default;
}

.bas-pt__btn--bloom:disabled {
	cursor: not-allowed;
}

/* ─── Footnote ───────────────────────────────────────────────────────────── */

.bas-pt__footnote {
	text-align: center;
	font-size: 13px;
	color: #999;
	margin-top: 32px !important;
	line-height: 1.7;
}

/* ─── Modal Overlay ──────────────────────────────────────────────────────── */

/*
 * The modal is rendered via wp_footer (directly on <body>) and then JS
 * guarantees document.body.appendChild() as a belt-and-suspenders measure.
 * This means it is OUTSIDE any Divi section/row that might carry a CSS
 * transform property — so position:fixed works relative to the viewport.
 *
 * z-index: 1000000 beats Divi's sticky header (99999) and any Divi modal.
 * CSS custom properties are re-declared here because the modal is no longer
 * a descendant of .bas_pricing_table (where they were originally defined).
 */
.bas-pt-modal {
	/* BAS palette — duplicated here so the modal works outside .bas_pricing_table */
	--bas-sage:        #70ac43;
	--bas-lime:        #c2e86b;
	--bas-forest:      #1d741b;
	--bas-teal:        #30b2b4;
	--bas-orange:      #ff4c25;
	--bas-coral:       #ff7660;
	--bas-cream:       #fffbef;
	--bas-charcoal:    #313131;
	--bas-border:      #d8e8c8;
	--bas-radius-pill: 100px;
	--bas-radius-card: 14px;

	display: none;
	position: fixed;
	inset: 0;
	z-index: 1000000;
	align-items: center;
	justify-content: center;
}

.bas-pt-modal[aria-hidden="false"] {
	display: flex;
}

.bas-pt-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(3px);
}

/* Modal dialog */
.bas-pt-modal__dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: var(--bas-radius-card);
	width: min(680px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 32px 36px 36px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.25);
	animation: bas-pt-modal-in 0.22s ease;
}

@keyframes bas-pt-modal-in {
	from { opacity: 0; transform: translateY(16px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Close button */
.bas-pt-modal__close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	color: #aaa;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
}

.bas-pt-modal__close:hover {
	color: var(--bas-charcoal);
	background: #f0f0f0;
}

/* Plan banner inside modal */
.bas-pt-modal__banner {
	display: flex;
	align-items: center;
	gap: 14px;
	background: var(--bas-cream);
	border: 1px solid var(--bas-border);
	border-radius: 10px;
	padding: 14px 18px;
	margin-bottom: 24px;
}

.bas-pt-modal__banner:empty {
	display: none;
}

.bas-pt-modal__plan-icon {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bas-pt-modal__plan-icon svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.bas-pt-modal__plan-text strong {
	display: block;
	font-family: 'Playfair Display', Georgia, serif;
	font-size: 16px;
	color: var(--bas-charcoal);
	line-height: 1.3;
}

.bas-pt-modal__plan-text span {
	font-size: 12px;
	color: #777;
}

/* ─── Modal form wrapper — scoped Dokan overrides ────────────────────────── */

.bas-pt-modal__form .dokan-registration-container,
.bas-pt-modal__form .dokan-seller-registration {
	border: none !important;
	padding: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
}

/*
 * Hide the Dokan subscription package selector inside the modal.
 * The vendor already chose their plan from the pricing table; the correct
 * product ID is pre-selected silently by bas-pt.js before form submit.
 * Showing the selector would expose the Admin Package and confuse vendors.
 *
 * Dokan uses several class names for this section across versions — target all.
 */
.bas-pt-modal__form .dokan-subscription-content,
.bas-pt-modal__form #dokan-subscription-pack,
.bas-pt-modal__form .dokan-subscription-pack,
.bas-pt-modal__form .dokan-subscription-packs,
.bas-pt-modal__form .dokan-subscription-packages-wrapper,
.bas-pt-modal__form .dokan-subscription-packages,
.bas-pt-modal__form [class*="subscription-pack"],
.bas-pt-modal__form [id*="subscription"] {
	display: none !important;
}

/* ─── Loading / error states inside modal ────────────────────────────────── */

.bas-pt-modal__loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 48px 0;
	gap: 16px;
	color: #888;
	font-family: Lato, sans-serif;
	font-size: 14px;
}

.bas-pt-modal__spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e8e8e8;
	border-top-color: var(--bas-sage);
	border-radius: 50%;
	animation: bas-pt-spin 0.7s linear infinite;
}

@keyframes bas-pt-spin {
	to { transform: rotate(360deg); }
}

.bas-pt-modal__error {
	text-align: center;
	padding: 32px 16px;
	color: #8b1a00;
	font-family: Lato, sans-serif;
	font-size: 14px;
}

/* ─── Country / State selects inside the modal ──────────────────────────── */
/*
 * Dokan's registration form uses native <select> elements for country and
 * state, which WC/Dokan JS may wrap with selectWoo / select2 styled widgets.
 * This block ensures:
 *   1. Native <select> elements are full-width and don't clip their text.
 *   2. selectWoo / select2 trigger buttons (.select2-selection) render text
 *      without hard-width truncation.
 *   3. The selectWoo dropdown list (.select2-dropdown) renders above the
 *      modal's overflow-y:auto scroll container (handled via dropdownParent
 *      in JS, but a z-index guard is useful here too).
 */
.bas-pt-modal__form select {
	width: 100% !important;
	box-sizing: border-box !important;
	max-width: 100% !important;
	min-width: 0 !important;
}

/* select2 / selectWoo outer span (replaces <select>) */
.bas-pt-modal__form .select2-container,
.bas-pt-modal__form .selectWoo-container {
	width: 100% !important;
	box-sizing: border-box !important;
}

/* The visible "button" that shows selected text */
.bas-pt-modal__form .select2-selection--single,
.bas-pt-modal__form .select2-selection {
	width: 100% !important;
	box-sizing: border-box !important;
	height: auto !important;
	min-height: 34px !important;
	padding-right: 32px !important; /* room for the arrow */
}

/* Rendered text inside the button — prevent truncation */
.bas-pt-modal__form .select2-selection__rendered {
	overflow: visible !important;
	text-overflow: unset !important;
	white-space: normal !important;
	padding-right: 0 !important;
	line-height: 1.4 !important;
}

/* Arrow chevron */
.bas-pt-modal__form .select2-selection__arrow {
	right: 6px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	height: auto !important;
}

/* Dropdown list — render above the modal's scroll context */
.select2-dropdown {
	z-index: 1000010 !important;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
	.bas-pt__grid {
		grid-template-columns: 1fr;
		max-width: 480px;
		margin: 0 auto;
	}

	.bas-pt__card--featured {
		transform: none;
	}
}

@media (max-width: 600px) {
	.bas-pt-modal__dialog {
		padding: 20px 18px 24px;
	}
}
