/**
 * PI Quote System - Frontend Styles (JS State Rules Only)
 *
 * Visual styling is handled by Tailwind utilities in the template.
 * This file only contains: JS-toggled state classes, animations,
 * pseudo-elements, and mobile table stacking.
 *
 * @package PIQuoteSystem
 * @since 1.5.0
 * @copyright 2026 iVega Information Technology L.L.C. All rights reserved.
 */

/* ============================================
   Override page template constraints
   ============================================ */

.page-id-12 .pi-page { padding: 0; }
.page-id-12 .pi-page .pi-container { max-width: none; padding: 0; }
.page-id-12 .pi-page .pi-page__inner { max-width: none; }
.page-id-12 .pi-content { max-width: none; line-height: normal; }
.page-id-12 .pi-content p { margin: 0; }

/* ============================================
   Wizard Panel Visibility (JS-toggled)
   ============================================ */

.pi-wizard__panel { display: none; }
.pi-wizard__panel--active { display: block; animation: piWizardFadeIn 0.3s ease; }

@keyframes piWizardFadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Step Progress - Active State (JS-toggled)
   ============================================ */

.pi-wizard__step--active .pi-wizard__step-circle {
	border-color: #226696 !important;
	background: #226696 !important;
	box-shadow: 0 0 0 4px rgba(0,64,128,0.1);
}

.pi-wizard__step--active .pi-wizard__step-number { color: #fff !important; }
.pi-wizard__step--active .pi-wizard__step-label { color: #226696 !important; font-weight: 700; }

/* ============================================
   Step Progress - Done State (JS-toggled)
   ============================================ */

.pi-wizard__step--done .pi-wizard__step-circle {
	border-color: #10b981 !important;
	background: #10b981 !important;
}

.pi-wizard__step--done .pi-wizard__step-number { display: none; }
.pi-wizard__step--done .pi-wizard__step-check { display: block !important; }
.pi-wizard__step--done .pi-wizard__step-label { color: #10b981 !important; }

/* ============================================
   Step Connector Lines (::after transition)
   ============================================ */

.pi-wizard__step-line::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0;
	background: #226696;
	transition: width 0.4s ease;
}

.pi-wizard__step-line--done::after { width: 100%; }

/* ============================================
   Form Validation States (JS-toggled)
   ============================================ */

.pi-quote-form__field--error input,
.pi-quote-form__field--error textarea {
	border-color: #f87171 !important;
	box-shadow: 0 0 0 2px rgba(248,113,113,0.12) !important;
}

.pi-quote-form__field-error {
	color: #dc2626;
	font-size: 0.76rem;
	margin-top: 4px;
}

.pi-dq-field-error {
	color: #dc2626;
	font-size: 0.76rem;
	margin-top: 4px;
}

.pi-quote-form__field--phone .iti,
.pi-dq-field--phone .iti {
	display: block;
	width: 100%;
}

.pi-quote-form__field--phone .iti__tel-input,
.pi-dq-field--phone .iti__tel-input {
	width: 100%;
	padding-left: 56px !important;
}

.pi-quote-form__field--phone .iti__country-container,
.pi-dq-field--phone .iti__country-container {
	left: 0;
}

.pi-quote-form__field--phone .iti__selected-country,
.pi-dq-field--phone .iti__selected-country {
	border-right: 1px solid #d1d3d4;
	border-radius: 0.5rem 0 0 0.5rem;
	background: #f8fafc;
	height: 100%;
	padding: 0 12px;
}

.pi-quote-form__field--error .iti__tel-input,
.pi-dq-field--error .iti__tel-input {
	border-color: #f87171 !important;
	box-shadow: 0 0 0 2px rgba(248,113,113,0.12) !important;
}

/* ============================================
   Form Message States (JS-toggled)
   ============================================ */

.pi-quote-form-message {
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 0.86rem;
	margin-top: 14px;
}

.pi-quote-form-message--error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #dc2626;
}

.pi-quote-form-message--success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #16a34a;
}

/* ============================================
   Dark Mode - JS State Overrides
   ============================================ */

@media (prefers-color-scheme: dark) {
	.pi-wizard__step--active .pi-wizard__step-circle {
		box-shadow: 0 0 0 4px rgba(34,102,150,0.25);
	}

	.pi-wizard__step--active .pi-wizard__step-label { color: #e8f1f7 !important; }

	.pi-wizard__step--done .pi-wizard__step-label { color: #34d399 !important; }

	.pi-wizard__step-line { background: #334155 !important; }

	.pi-quote-form-message--error {
		background: #1c0a0a;
		border-color: #7f1d1d;
		color: #fca5a5;
	}

	.pi-quote-form-message--success {
		background: #052e16;
		border-color: #14532d;
		color: #4ade80;
	}

	.pi-direct-form-message.pi-quote-form-message--error {
		background: #1c0a0a;
		border-color: #7f1d1d;
		color: #fca5a5;
	}

	.pi-direct-form-message.pi-quote-form-message--success {
		background: #052e16;
		border-color: #14532d;
		color: #4ade80;
	}
}

/* Tailwind dark: class variant (used by our Tailwind CDN config) */
.dark .pi-wizard__step--active .pi-wizard__step-circle {
	box-shadow: 0 0 0 4px rgba(34,102,150,0.25);
}
.dark .pi-wizard__step--active .pi-wizard__step-label { color: #e8f1f7 !important; }
.dark .pi-wizard__step--done .pi-wizard__step-label { color: #34d399 !important; }
.dark .pi-wizard__step-line { background: #334155 !important; }
.dark .pi-dq-line { background: #334155 !important; }

.dark .pi-quote-form-message--error {
	background: #1c0a0a;
	border-color: #7f1d1d;
	color: #fca5a5;
}
.dark .pi-quote-form-message--success {
	background: #052e16;
	border-color: #14532d;
	color: #4ade80;
}

.dark .pi-quote-form__field--phone .iti__selected-country,
.dark .pi-dq-field--phone .iti__selected-country {
	border-right-color: #475569;
	background: #0f172a;
}

/* ============================================
   Contact Confirmation Modal
   ============================================ */

body.pi-quote-confirm-open {
	overflow: hidden;
}

.pi-quote-confirm {
	position: fixed;
	inset: 0;
	z-index: 10000;
}

.pi-quote-confirm__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.66);
	backdrop-filter: blur(4px);
}

.pi-quote-confirm__dialog {
	position: relative;
	width: min(92vw, 520px);
	margin: min(10vh, 80px) auto 0;
	background: #ffffff;
	border: 1px solid #d1d3d4;
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
	padding: 24px;
}

.pi-quote-confirm__title {
	margin: 0 0 8px;
	color: #0f172a;
	font-size: 1.1rem;
	font-weight: 800;
}

.pi-quote-confirm__text {
	margin: 0;
	color: #475569;
	font-size: 0.92rem;
	line-height: 1.55;
}

.pi-quote-confirm__body {
	margin-top: 18px;
	padding: 16px;
	border-radius: 14px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
}

.pi-quote-confirm__row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 8px 0;
	border-bottom: 1px solid #e2e8f0;
}

.pi-quote-confirm__row:last-child {
	border-bottom: 0;
}

.pi-quote-confirm__label {
	color: #64748b;
	font-size: 0.82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.pi-quote-confirm__value {
	color: #0f172a;
	font-size: 0.94rem;
	font-weight: 700;
	text-align: right;
	word-break: break-word;
}

.pi-quote-confirm__actions {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	margin-top: 20px;
}

.pi-quote-confirm__btn {
	border: 0;
	border-radius: 12px;
	padding: 12px 18px;
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pi-quote-confirm__btn--secondary {
	background: #ffffff;
	color: #334155;
	border: 1px solid #cbd5e1;
}

.pi-quote-confirm__btn--secondary:hover {
	background: #f8fafc;
}

.pi-quote-confirm__btn--primary {
	background: #226696;
	color: #ffffff;
}

.pi-quote-confirm__btn--primary:hover {
	background: #1a4f73;
}

.dark .pi-quote-confirm__dialog {
	background: #0f172a;
	border-color: #334155;
	box-shadow: 0 24px 60px rgba(2, 6, 23, 0.5);
}

.dark .pi-quote-confirm__title,
.dark .pi-quote-confirm__value {
	color: #e2e8f0;
}

.dark .pi-quote-confirm__text,
.dark .pi-quote-confirm__label {
	color: #94a3b8;
}

.dark .pi-quote-confirm__body {
	background: #111827;
	border-color: #334155;
}

.dark .pi-quote-confirm__row {
	border-bottom-color: #334155;
}

.dark .pi-quote-confirm__btn--secondary {
	background: #111827;
	color: #e2e8f0;
	border-color: #475569;
}

.dark .pi-quote-confirm__btn--secondary:hover {
	background: #1e293b;
}

@media (max-width: 640px) {
	.pi-quote-confirm__dialog {
		width: calc(100vw - 24px);
		margin-top: 24px;
		padding: 18px;
		border-radius: 16px;
	}

	.pi-quote-confirm__row,
	.pi-quote-confirm__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.pi-quote-confirm__value {
		text-align: left;
	}
}
.dark .pi-direct-form-message.pi-quote-form-message--error {
	background: #1c0a0a;
	border-color: #7f1d1d;
	color: #fca5a5;
}
.dark .pi-direct-form-message.pi-quote-form-message--success {
	background: #052e16;
	border-color: #14532d;
	color: #4ade80;
}

/* ============================================
   Mobile Table Stacking
   ============================================ */

@media (max-width: 767px) {
	.pi-quote-page__hero { min-height: 110px; }

	/* Trust badges stack vertically */
	.pi-quote-trust {
		flex-direction: column;
		gap: 12px;
	}

	/* Wizard padding */
	.pi-wizard { padding-left: 12px !important; padding-right: 12px !important; padding-bottom: 36px !important; }
	.pi-wizard__progress { padding: 14px 16px !important; }

	/* Step sizes */
	.pi-wizard__step-circle { width: 34px !important; height: 34px !important; }
	.pi-wizard__step-label { font-size: 0.68rem !important; }
	.pi-wizard__step-line { min-width: 24px !important; margin-left: 8px !important; margin-right: 8px !important; margin-bottom: 20px !important; }

	/* Card padding */
	.pi-wizard__card { padding: 24px 16px !important; border-radius: 12px !important; }

	/* Table: stack rows */
	.pi-quote-table thead { display: none; }
	.pi-quote-table,
	.pi-quote-table tbody,
	.pi-quote-table tr,
	.pi-quote-table td { display: block; }

	.pi-quote-table tr {
		padding: 12px;
		border-bottom: 1px solid #f1f5f9;
		position: relative;
		background: #fff;
	}
	.dark .pi-quote-table tr {
		border-bottom-color: #334155;
		background: #1e293b;
	}

	.pi-quote-table td { padding: 3px 0 !important; border-bottom: none !important; background: transparent !important; }
	.pi-quote-table__col-img { width: auto !important; float: left; margin-right: 12px; }
	.pi-quote-table__col-product { min-width: auto !important; }

	.pi-quote-table__col-remove {
		position: absolute;
		top: 12px;
		right: 4px;
		width: auto !important;
	}

	.pi-quote-table__col-sku::before { content: 'SKU: '; color: #94a3b8; font-family: inherit; }

	.pi-quote-table__col-qty {
		width: auto !important;
		display: inline-block;
		margin-top: 6px;
	}

	.pi-quote-table__col-qty::before { content: 'Qty: '; color: #64748b; font-size: 0.8rem; }

	/* Form fields stack */
	.pi-quote-form__row { grid-template-columns: 1fr !important; gap: 12px !important; }
	.pi-wizard__panel-title { font-size: 1.05rem !important; }

	/* Nav buttons */
	.pi-wizard__btn-back { padding: 9px 16px !important; font-size: 0.84rem !important; }
	.pi-wizard__btn-next { padding: 9px 20px !important; font-size: 0.86rem !important; }
	.pi-quote-submit-btn { padding: 9px 20px !important; font-size: 0.86rem !important; }

	/* Success */
	.pi-quote-success { padding: 0 12px 36px !important; }
	.pi-quote-success > div { padding: 36px 20px !important; }
	.pi-quote-ref-number { font-size: 1rem !important; padding: 8px 20px !important; }
}

/* ============================================
   Direct Quote Wizard (pi-dq- prefix)
   ============================================ */

.pi-dq-panel { animation: piWizardFadeIn 0.3s ease; }
.pi-dq-step-circle { cursor: pointer; }

.pi-dq-field--error input,
.pi-dq-field--error textarea {
	border-color: #f87171 !important;
	box-shadow: 0 0 0 2px rgba(248,113,113,0.12) !important;
}

.pi-direct-form-message {
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 0.86rem;
	margin-bottom: 14px;
}

@media (max-width: 767px) {
	.pi-direct-quote { padding-left: 12px !important; padding-right: 12px !important; }
	.pi-dq-card { padding: 24px 16px !important; border-radius: 12px !important; }
	.pi-dq-step-circle { width: 34px !important; height: 34px !important; }
	.pi-dq-step-label { font-size: 0.68rem !important; }
	.pi-dq-line { min-width: 24px !important; margin-left: 8px !important; margin-right: 8px !important; }
}

@media (max-width: 480px) {
	.pi-wizard__step-label { font-size: 0.64rem !important; }
	.pi-wizard__step-circle { width: 30px !important; height: 30px !important; }
	.pi-wizard__step-number { font-size: 0.8rem !important; }
	.pi-dq-step-label { font-size: 0.64rem !important; }
	.pi-dq-step-circle { width: 30px !important; height: 30px !important; }
}
