/**
 * Premium Styles for Service Price Calculator (TSPC)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.tspc-calculator-wrapper-v2 {
	--tspc-primary: #6366f1;
	--tspc-primary-hover: #4f46e5;
	--tspc-success: #10b981;
	--tspc-success-hover: #059669;
	--tspc-danger: #ef4444;
	--tspc-bg-card: #ffffff;
	--tspc-bg-input: #f8fafc;
	--tspc-border: #e2e8f0;
	--tspc-border-hover: #cbd5e1;
	--tspc-text: #0f172a;
	--tspc-text-muted: #64748b;
	--tspc-glow: rgba(99, 102, 241, 0.08);
	--tspc-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
	--tspc-card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	--tspc-glass-bg: rgba(255, 255, 255, 0.95);
	
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--tspc-text);
	background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
	padding: 30px;
	border-radius: 16px;
	box-shadow: var(--tspc-shadow);
	max-width: 100%;
	width: 100%;
	margin: 20px auto;
	position: relative;
	overflow: hidden;
	border: 1px solid var(--tspc-border);
	box-sizing: border-box;
}

.tspc-calculator-wrapper-v2 * {
	box-sizing: border-box;
}

/* Grid Layout */
.tspc-calc-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 30px;
}

@media (min-width: 768px) {
	.tspc-calc-grid {
		grid-template-columns: 1.2fr 0.8fr;
	}
}

/* Headers */
.tspc-services-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}

.tspc-col-title {
	font-size: 22px;
	font-weight: 800;
	margin: 0;
	color: var(--tspc-text);
	letter-spacing: -0.5px;
}

.tspc-clear-btn {
	background: transparent;
	border: none;
	color: var(--tspc-danger) !important;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 12px;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.tspc-clear-btn:hover {
	background-color: rgba(239, 68, 68, 0.08);
}

.tspc-clear-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.tspc-col-subtitle {
	font-size: 14px;
	color: var(--tspc-text-muted);
	margin: 0 0 25px 0;
	line-height: 1.5;
}

/* Left Column: Services */
.tspc-services-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.tspc-service-item-card {
	display: block;
	cursor: pointer;
}

.tspc-service-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.tspc-service-card-body {
	background: var(--tspc-bg-card);
	border: 2px solid var(--tspc-border);
	border-radius: 12px;
	padding: 20px;
	display: flex;
	align-items: flex-start;
	gap: 16px;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 1px 3px rgba(0,0,0,0.01);
}

/* Checkbox indicator */
.tspc-checkbox-custom {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid var(--tspc-border);
	background: #ffffff;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 3px;
	transition: all 0.2s ease;
}

.tspc-checkbox-inner {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ffffff;
	transform: scale(0);
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Icon Box */
.tspc-service-icon-box {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	border-radius: 10px;
	background-color: var(--tspc-bg-input);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--tspc-text-muted);
	transition: all 0.25s ease;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.tspc-service-icon-box .dashicons {
	font-size: 22px;
	width: 22px;
	height: 22px;
}

/* Card details */
.tspc-service-details {
	flex-grow: 1;
}

.tspc-service-details h3 {
	margin: 0 0 4px 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--tspc-text);
}

.tspc-service-details p {
	margin: 0 0 10px 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--tspc-text-muted);
}

.tspc-service-price-tag {
	font-size: 15px;
	font-weight: 800;
	color: var(--tspc-primary);
}

/* Card Hover States */
.tspc-service-item-card:hover .tspc-service-card-body {
	border-color: var(--tspc-primary);
	transform: translateY(-4px);
	box-shadow: 0 12px 25px -5px var(--tspc-glow), 0 8px 16px -6px rgba(0,0,0,0.03);
}

.tspc-service-checkbox:checked + .tspc-service-card-body {
	border-color: var(--tspc-primary);
	box-shadow: 0 10px 15px -3px var(--tspc-glow), 0 4px 6px -2px var(--tspc-glow);
	background: linear-gradient(135deg, #ffffff 0%, var(--tspc-glow) 100%);
}

.tspc-service-checkbox:checked + .tspc-service-card-body .tspc-checkbox-custom {
	border-color: var(--tspc-primary);
	background: var(--tspc-primary);
}

.tspc-service-checkbox:checked + .tspc-service-card-body .tspc-checkbox-inner {
	transform: scale(1);
}

.tspc-service-checkbox:checked + .tspc-service-card-body .tspc-service-icon-box {
	background-color: var(--tspc-primary);
	color: #ffffff;
}

/* Right Column: Sticky Sidebar & Cart Summary */
.tspc-sticky-sidebar {
	position: sticky;
	top: 20px;
	background: #ffffff;
	border: 1px solid var(--tspc-border);
	border-radius: 18px;
	padding: 30px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 16px -6px rgba(0, 0, 0, 0.05);
	margin-bottom: 30px;
}

.tspc-selected-panel {
	margin-bottom: 20px;
}

.tspc-selected-panel h3 {
	font-size: 14px;
	font-weight: 700;
	color: var(--tspc-text);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin: 0 0 12px 0;
	border-bottom: 1px solid var(--tspc-border);
	padding-bottom: 8px;
}

.tspc-selected-items-empty {
	text-align: center;
	padding: 20px;
	border: 1px dashed var(--tspc-border);
	border-radius: 8px;
	color: var(--tspc-text-muted);
	font-size: 13px;
}

.tspc-selected-items-empty p {
	margin: 0;
}

/* Cart List */
.tspc-cart-items-list {
	list-style-type: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 180px;
	overflow-y: auto;
	overflow-x: hidden;
}

.tspc-cart-items-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
	padding: 10px 14px;
	background-color: #f8fafc;
	border-radius: 10px;
	border: 1px solid var(--tspc-border);
	border-left: 4px solid var(--tspc-primary);
	box-shadow: 0 2px 4px rgba(0,0,0,0.01);
	transition: all 0.2s ease;
}

.tspc-cart-items-list::-webkit-scrollbar {
	width: 5px;
}

.tspc-cart-items-list::-webkit-scrollbar-track {
	background: transparent;
}

.tspc-cart-items-list::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 10px;
}

.tspc-cart-items-list::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

.tspc-cart-items-list li:hover {
	transform: translateX(3px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.tspc-cart-item-title {
	font-weight: 600;
	color: var(--tspc-text);
}

.tspc-cart-item-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tspc-cart-item-price {
	font-weight: 700;
	color: var(--tspc-primary);
}

.tspc-remove-cart-item {
	background: transparent;
	border: none;
	cursor: pointer;
	color: #94a3b8;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s ease;
	width: 22px;
	height: 22px;
}

.tspc-remove-cart-item:hover {
	background: #fee2e2;
	color: #ef4444;
	transform: scale(1.1);
}

.tspc-remove-cart-item .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

/* Price Breakdown */
.tspc-pricing-breakdown {
	margin: 20px 0;
}

.tspc-price-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
	font-size: 14px;
	font-weight: 500;
	color: var(--tspc-text-muted);
}

.tspc-price-row .tspc-price-val {
	font-weight: 700;
	color: var(--tspc-text);
}

.tspc-price-row.discount-row .tspc-price-val {
	color: var(--tspc-success);
}

.tspc-break-line {
	border: none;
	border-top: 1px solid var(--tspc-border);
	margin: 12px 0;
}

.tspc-price-row.total-row {
	color: var(--tspc-text);
	font-weight: 800;
	background: var(--tspc-glow);
	padding: 16px 20px;
	border-radius: 12px;
	border: 1px dashed var(--tspc-primary);
	margin-top: 18px;
	margin-bottom: 18px;
}

.tspc-price-row.total-row .total-price {
	font-size: 26px;
	color: var(--tspc-primary);
	font-weight: 800;
	letter-spacing: -0.5px;
}

/* Quote Submission Form */
.tspc-quote-submission-form {
	border-top: 1px solid var(--tspc-border);
	padding-top: 20px;
	margin-top: 20px;
	padding-bottom: 15px; /* Added spacing at the bottom inside the form */
}

.tspc-quote-submission-form h3 {
	font-size: 14px;
	font-weight: 700;
	color: var(--tspc-text);
	margin: 0 0 15px 0;
}

.tspc-form-field {
	margin-bottom: 16px;
}

.tspc-form-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	color: #334155;
}

.tspc-form-field input[type="text"],
.tspc-form-field input[type="email"],
.tspc-form-field input[type="tel"],
.tspc-form-field textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--tspc-border);
	border-radius: 10px;
	background-color: #f8fafc;
	font-size: 14px;
	color: var(--tspc-text);
	font-family: inherit;
	transition: all 0.2s ease;
	outline: none;
}

.tspc-form-field input:focus,
.tspc-form-field textarea:focus {
	border-color: var(--tspc-primary);
	background-color: #ffffff;
	box-shadow: 0 0 0 4px var(--tspc-glow);
}

/* 2-Column Form Row (Name + Phone) */
.tspc-form-row-2col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

@media (max-width: 480px) {
	.tspc-form-row-2col {
		grid-template-columns: 1fr;
	}
}

/* Phone Input with icon */
.tspc-phone-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.tspc-phone-icon {
	position: absolute;
	left: 10px;
	display: flex;
	align-items: center;
	pointer-events: none;
	color: var(--tspc-text-muted);
}

.tspc-phone-icon .dashicons {
	font-size: 15px;
	width: 15px;
	height: 15px;
}

.tspc-phone-wrapper input[type="tel"] {
	padding-left: 32px;
}

.tspc-submit-btn-block {
	width: 100%;
	background-color: var(--tspc-primary);
	border: none;
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	padding: 14px;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.25s ease;
	box-shadow: 0 4px 12px var(--tspc-glow);
}

.tspc-submit-btn-block:hover:not(:disabled) {
	background-color: var(--tspc-primary-hover);
	color: #ffffff !important;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px var(--tspc-glow);
}

.tspc-submit-btn-block:active:not(:disabled) {
	transform: translateY(0);
}

.tspc-submit-btn-block:disabled {
	background-color: var(--tspc-border);
	color: var(--tspc-text-muted);
	cursor: not-allowed;
	box-shadow: none;
}

/* Status Overlays */
.tspc-status-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.96);
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 30px;
	backdrop-filter: blur(6px);
	animation: tspcOverlayShow 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tspcOverlayShow {
	from { opacity: 0; }
	to { opacity: 1; }
}

.tspc-overlay-content {
	max-width: 420px;
	text-align: center;
	animation: tspcScaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes tspcScaleUp {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.tspc-overlay-content h2 {
	margin: 20px 0 10px 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--tspc-text);
}

.tspc-overlay-content p {
	font-size: 14px;
	line-height: 1.5;
	color: var(--tspc-text-muted);
	margin: 0 0 25px 0;
}

/* Success Checkmark Animation */
.tspc-success-checkmark {
	width: 80px;
	height: 80px;
	margin: 0 auto;
}

.tspc-success-checkmark .check-icon {
	width: 80px;
	height: 80px;
	position: relative;
	border-radius: 50%;
	box-sizing: content-box;
	border: 4px solid var(--tspc-success);
}

.tspc-success-checkmark .check-icon::before {
	top: 3px;
	left: -2px;
	width: 30px;
	height: 80px;
	background: #ffffff;
	position: absolute;
	content: '';
	transform-origin: 100% 50%;
	transform: rotate(-45deg);
}

.tspc-success-checkmark .check-icon::after {
	top: 0;
	left: 30px;
	width: 60px;
	height: 80px;
	background: #ffffff;
	position: absolute;
	content: '';
	transform-origin: 0 50%;
	transform: rotate(-45deg);
}

.tspc-success-checkmark .check-icon .icon-line {
	height: 5px;
	background-color: var(--tspc-success);
	display: block;
	border-radius: 2px;
	position: absolute;
	z-index: 10;
}

.tspc-success-checkmark .check-icon .icon-line.line-tip {
	top: 46px;
	left: 14px;
	width: 25px;
	transform: rotate(45deg);
	animation: icon-line-tip 0.75s;
}

.tspc-success-checkmark .check-icon .icon-line.line-long {
	top: 38px;
	right: 8px;
	width: 47px;
	transform: rotate(-45deg);
	animation: icon-line-long 0.75s;
}

.tspc-success-checkmark .check-icon .icon-circle {
	top: -4px;
	left: -4px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	border: 4px solid rgba(16, 185, 129, 0.2);
	box-sizing: content-box;
	position: absolute;
	z-index: 1;
}

.tspc-success-checkmark .check-icon .icon-fix {
	top: 8px;
	left: 28px;
	width: 5px;
	height: 48px;
	background-color: #ffffff;
	position: absolute;
	z-index: 1;
	transform: rotate(-45deg);
}

@keyframes icon-line-tip {
	0% {
		width: 0;
		left: 1px;
		top: 19px;
	}
	54% {
		width: 0;
		left: 1px;
		top: 19px;
	}
	70% {
		width: 50px;
		left: -8px;
		top: 37px;
	}
	84% {
		width: 17px;
		left: 21px;
		top: 48px;
	}
	100% {
		width: 25px;
		left: 14px;
		top: 46px;
	}
}

@keyframes icon-line-long {
	0% {
		width: 0;
		right: 46px;
		top: 54px;
	}
	65% {
		width: 0;
		right: 46px;
		top: 54px;
	}
	84% {
		width: 55px;
		right: 0px;
		top: 35px;
	}
	100% {
		width: 47px;
		right: 8px;
		top: 38px;
	}
}

/* Error Cross Icon */
.tspc-error-cross {
	width: 80px;
	height: 80px;
	margin: 0 auto;
	border-radius: 50%;
	border: 4px solid var(--tspc-danger);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--tspc-danger);
	font-size: 38px;
	background: rgba(239, 68, 68, 0.05);
}

.tspc-status-overlay.error-mode {
	background-color: rgba(255, 255, 255, 0.98);
}

.tspc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 700;
	border-radius: 8px;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all 0.2s ease;
	outline: none;
	height: auto;
}

.tspc-btn-primary {
	background-color: var(--tspc-primary);
	color: #ffffff;
}

.tspc-btn-primary:hover {
	background-color: var(--tspc-primary-hover);
	color: #ffffff !important;
}

.tspc-btn-secondary {
	background-color: #ffffff;
	border-color: var(--tspc-border);
	color: var(--tspc-text);
}

.tspc-btn-secondary:hover {
	background-color: var(--tspc-bg-input);
	border-color: var(--tspc-border-hover);
}

/* Sub-services Frontend Layout & Redesign */
.tspc-sub-services-wrapper {
	padding-left: 0;
	margin-top: -12px;
	margin-bottom: 20px;
	width: 100%;
}

.tspc-sub-services-list {
	background: #f8fafc;
	border: 2px solid var(--tspc-primary);
	border-top: none;
	border-radius: 0 0 16px 16px;
	padding: 16px 20px 20px 54px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), var(--tspc-glow);
	position: relative;
}

/* Subtle separator bar at the top of the list */
.tspc-sub-services-list::before {
	content: '';
	position: absolute;
	top: 0;
	left: 20px;
	right: 20px;
	height: 1px;
	background: var(--tspc-border);
}

.tspc-sub-service-item {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--tspc-text);
	padding: 10px 14px;
	border-radius: 8px;
	background: #ffffff;
	border: 1px solid var(--tspc-border);
	transition: all 0.2s ease-in-out;
}

.tspc-sub-service-item:hover {
	border-color: var(--tspc-primary-hover);
	background: rgba(99, 102, 241, 0.02);
	transform: translateX(2px);
}

.tspc-sub-service-item.tspc-sub-checked {
	border-color: var(--tspc-primary);
	background: rgba(99, 102, 241, 0.04);
}

.tspc-sub-service-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.tspc-sub-checkbox-custom {
	width: 18px;
	height: 18px;
	border: 2px solid var(--tspc-border);
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
	background: #ffffff;
}

.tspc-sub-checkbox-inner {
	width: 8px;
	height: 8px;
	border-radius: 2px;
	background: #ffffff;
	transform: scale(0);
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tspc-sub-service-checkbox:checked + .tspc-sub-checkbox-custom {
	border-color: var(--tspc-primary) !important;
	background: var(--tspc-primary) !important;
}

.tspc-sub-service-checkbox:checked + .tspc-sub-checkbox-custom .tspc-sub-checkbox-inner {
	transform: scale(1) !important;
}

.tspc-sub-service-title {
	flex-grow: 1;
	transition: color 0.2s ease;
}

.tspc-sub-service-checkbox:checked ~ .tspc-sub-service-title {
	color: var(--tspc-primary);
}

/* Custom price badge */
.tspc-sub-service-price {
	margin-left: auto;
	font-size: 12px;
	font-weight: 700;
	color: var(--tspc-primary);
	background: rgba(99, 102, 241, 0.08);
	padding: 4px 10px;
	border-radius: 99px;
	letter-spacing: -0.2px;
	transition: all 0.2s ease;
}

.tspc-sub-service-checkbox:checked ~ .tspc-sub-service-price {
	background: var(--tspc-primary) !important;
	color: #ffffff !important;
}

/* Disabled styling */
.tspc-sub-service-checkbox:disabled ~ .tspc-sub-service-title,
.tspc-sub-service-checkbox:disabled ~ .tspc-sub-service-price,
.tspc-sub-service-checkbox:disabled ~ .tspc-sub-checkbox-custom {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Chevron indicator styling */
.tspc-chevron-indicator {
	margin-left: auto;
	align-self: center;
	color: var(--tspc-text-muted);
	opacity: 0.7;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	pointer-events: none; /* let click pass through to label/checkbox */
}

.tspc-chevron-indicator .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	display: block;
}

.tspc-service-card-container.tspc-expanded .tspc-chevron-indicator {
	transform: rotate(180deg);
	color: var(--tspc-primary);
	opacity: 1;
}

.tspc-service-card-container.tspc-expanded .tspc-service-card-body {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}
