/**
 * OKBRAND Fence Calculator Widget - Frontend Styles
 */

/* ── Calculator Container ── */
.okbfc-calculator {
	max-width: 960px;
	margin: 30px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: #393E46;
}

/* ── Steps ── */
.okbfc-step {
	margin-bottom: 30px;
	padding: 25px;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	background: #fff;
	transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

.okbfc-step-locked {
	opacity: 0.4;
	pointer-events: none;
}

.okbfc-step-active {
	opacity: 1;
	pointer-events: auto;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.okbfc-step-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.okbfc-step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #D23232;
	color: #fff;
	border-radius: 50%;
	font-size: 16px;
	font-weight: 700;
	flex-shrink: 0;
}

.okbfc-step-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #393E46;
}

/* ── Grid Layout ── */
.okbfc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
}

.okbfc-grid-item {
	border: 2px solid #e0e0e0;
	border-radius: 10px;
	padding: 12px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
	background: #fafafa;
}

.okbfc-grid-item:hover {
	border-color: #D23232;
	box-shadow: 0 4px 12px rgba(210, 50, 50, 0.15);
	transform: translateY(-2px);
}

.okbfc-grid-item.selected {
	border-color: #D23232;
	background: #fdeaea;
	box-shadow: 0 0 0 3px rgba(210, 50, 50, 0.2);
}

.okbfc-grid-item-image {
	width: 100%;
	height: 120px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 6px;
	margin-bottom: 10px;
	background: #f0f0f0;
}

.okbfc-grid-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.okbfc-placeholder-image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #bbb;
	font-size: 40px;
}

.okbfc-grid-item-title {
	font-size: 14px;
	font-weight: 600;
	color: #393E46;
}

/* ── Product Card Meta ── */
.okbfc-product-meta {
	margin-top: 8px;
	font-size: 12px;
	color: #666;
	line-height: 1.5;
	text-align: left;
}

.okbfc-product-meta span {
	display: block;
}

.okbfc-no-items {
	grid-column: 1 / -1;
	text-align: center;
	color: #888;
	padding: 20px;
}

/* ── Buttons ── */
.okbfc-btn {
	display: inline-block;
	padding: 10px 20px;
	border: 2px solid #D23232;
	border-radius: 6px;
	background: #fff;
	color: #D23232;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.okbfc-btn:hover {
	background: #D23232;
	color: #fff;
}

.okbfc-btn-active {
	background: #D23232;
	color: #fff;
}

.okbfc-btn-secondary {
	border-color: #999;
	color: #666;
	font-size: 13px;
	padding: 6px 14px;
	margin-top: 10px;
}

.okbfc-btn-secondary:hover {
	background: #666;
	color: #fff;
	border-color: #666;
}

/* ── Dimension Toggle ── */
.okbfc-dimension-toggle {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
}

/* ── Form Fields ── */
.okbfc-field-group {
	margin-bottom: 16px;
}

.okbfc-field-group label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #393E46;
}

.okbfc-input {
	width: 100%;
	max-width: 400px;
	padding: 10px 14px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 15px;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.okbfc-input:focus {
	outline: none;
	border-color: #D23232;
	box-shadow: 0 0 0 3px rgba(210, 50, 50, 0.15);
}

#okbfc-fence-lines[readonly] {
	opacity: 0.5;
}

/* ── Google Map ── */
.okbfc-google-map {
	width: 100%;
	height: 400px;
	border-radius: 8px;
	border: 1px solid #ddd;
	margin-bottom: 12px;
}

.okbfc-map-search {
	margin-bottom: 12px;
}

.okbfc-map-search .okbfc-input {
	max-width: 100%;
}

.okbfc-map-instructions {
	font-size: 13px;
	color: #888;
	margin: 0 0 8px;
}

.okbfc-map-drawn-info {
	font-size: 14px;
	color: #393E46;
	margin: 0 0 12px;
}

.okbfc-map-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.okbfc-map-finish-line {
	background: #e8a317;
	border-color: #e8a317;
	color: #fff;
}

.okbfc-map-finish-line:hover {
	background: #c78c10;
	border-color: #c78c10;
	color: #fff;
}

.okbfc-map-results {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
}

.okbfc-map-results .okbfc-field-group {
	flex: 1;
	min-width: 180px;
}

/* ── Post Type Radio Cards ── */
.okbfc-post-types {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
}

.okbfc-radio-card {
	flex: 1;
	min-width: 160px;
	cursor: pointer;
}

.okbfc-radio-card input[type="radio"] {
	display: none;
}

.okbfc-radio-card-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 20px 16px;
	border: 2px solid #e0e0e0;
	border-radius: 10px;
	text-align: center;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.okbfc-radio-card input[type="radio"]:checked + .okbfc-radio-card-content {
	border-color: #D23232;
	background: #fdeaea;
}

.okbfc-radio-card:hover .okbfc-radio-card-content {
	border-color: #D23232;
}

.okbfc-radio-icon {
	font-size: 32px;
	margin-bottom: 8px;
	color: #393E46;
}

.okbfc-radio-label {
	font-size: 14px;
	font-weight: 600;
	color: #393E46;
}

/* ── Composition Fields ── */
.okbfc-composition-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.okbfc-composition-fields .okbfc-field-group {
	flex: 1;
	min-width: 200px;
}

/* ── Result Section ── */
.okbfc-result-wrapper {
	display: flex;
	gap: 30px;
	flex-wrap: wrap;
}

.okbfc-result-summary {
	flex: 1;
	min-width: 280px;
}

.okbfc-selected-product-name {
	background: #D23232;
	border-radius: 8px;
	padding: 14px 18px;
	margin-bottom: 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.okbfc-selected-product-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(255,255,255,0.8);
}

.okbfc-selected-product-title {
	font-size: 17px;
	font-weight: 700;
	color: #fff;
	line-height: 1.3;
}

.okbfc-result-calculation h4 {
	margin: 0 0 15px;
	font-size: 17px;
	font-weight: 600;
	color: #393E46;
}

.okbfc-product-attributes {
	margin: 16px 0 0;
}

.okbfc-attrs-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 10px;
}

.okbfc-attr-item {
	background: #f9f9f9;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.okbfc-attr-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #999;
}

.okbfc-attr-value {
	font-size: 14px;
	font-weight: 700;
	color: #393E46;
}

.okbfc-result-calculation {
	flex: 1;
	min-width: 280px;
}

.okbfc-result-card {
	margin: 10px;
	background: #fdeaea;
	border: 2px solid #D23232;
	border-radius: 12px;
	padding: 30px;
	text-align: center;
}

.okbfc-result-label {
	font-size: 15px;
	font-weight: 600;
	color: #393E46;
	margin-bottom: 10px;
}

.okbfc-result-value {
	font-size: 52px;
	font-weight: 800;
	color: #D23232;
	line-height: 1.2;
}

.okbfc-result-formula {
	margin-top: 12px;
	font-size: 13px;
	color: #777;
	font-style: italic;
}

/* ── Result Action Buttons (Print, Email & Reset) ── */
.okbfc-result-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	align-items: center;
	margin-top: 25px;
	flex-wrap: wrap;
}

.okbfc-btn-print,
.okbfc-btn-email {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 22px;
	font-size: 14px;
}

.okbfc-btn-print .dashicons,
.okbfc-btn-email .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 18px;
}

.okbfc-btn-print,
.okbfc-btn-email {
	border-color: #D23232;
	color: #D23232;
}

.okbfc-btn-print:hover,
.okbfc-btn-email:hover {
	background: #D23232;
	color: #fff;
}

/* ── Email Modal ── */
.okbfc-email-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.okbfc-email-modal-content {
	background: #fff;
	border-radius: 12px;
	padding: 30px;
	width: 90%;
	max-width: 420px;
	position: relative;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.okbfc-email-modal-content h4 {
	margin: 0 0 20px;
	font-size: 18px;
	font-weight: 600;
	color: #393E46;
}

.okbfc-email-modal-close {
	position: absolute;
	top: 12px;
	right: 16px;
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #888;
	line-height: 1;
	padding: 0;
}

.okbfc-email-modal-close:hover {
	color: #393E46;
}

.okbfc-email-modal-actions {
	display: flex;
	gap: 10px;
	margin-top: 16px;
}

.okbfc-email-status {
	margin-top: 12px;
	font-size: 13px;
	min-height: 20px;
}

.okbfc-email-success {
	color: #28a745;
}

.okbfc-email-error {
	color: #dc3545;
}

/* ── Print Styles ── */
@media print {
	/* Hide all page content visually */
	body.okbfc-print-mode * {
		visibility: hidden !important;
	}

	/* Remove spacing from all steps except Step 10 */
	body.okbfc-print-mode .okbfc-step:not(#okbfc-step-10),
	body.okbfc-print-mode .okbfc-cta-buttons {
		display: none !important;
	}

	/* Pull calculator to top of page, removing any theme header spacing */
	body.okbfc-print-mode {
		position: relative !important;
	}

	body.okbfc-print-mode .okbfc-calculator {
		visibility: visible !important;
		position: absolute !important;
		top: 0 !important;
		left: 0 !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* Show Step 10 and all its children */
	body.okbfc-print-mode #okbfc-step-10,
	body.okbfc-print-mode #okbfc-step-10 * {
		visibility: visible !important;
	}

	body.okbfc-print-mode #okbfc-step-10 {
		margin: 0 !important;
		padding: 20px !important;
		box-shadow: none !important;
		border: none !important;
		opacity: 1 !important;
	}

	/* Hide action buttons and email modal */
	body.okbfc-print-mode .okbfc-result-actions,
	body.okbfc-print-mode .okbfc-email-modal {
		display: none !important;
	}
}

/* ── Reset Button ── */
.okbfc-btn-reset {
	background: #dc3545;
	border-color: #dc3545;
	color: #fff;
	padding: 10px 22px;
	font-size: 14px;
}

.okbfc-btn-reset:hover {
	background: #b02a37;
	border-color: #b02a37;
	color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
	.okbfc-calculator {
		margin: 15px;
	}

	.okbfc-step {
		padding: 18px;
	}

	.okbfc-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 12px;
	}

	.okbfc-post-types {
		flex-direction: column;
	}

	.okbfc-result-wrapper {
		flex-direction: column;
	}

	.okbfc-dimension-toggle {
		flex-direction: column;
	}

	.okbfc-google-map {
		height: 300px;
	}

	.okbfc-map-results {
		flex-direction: column;
	}

	.okbfc-composition-fields {
		flex-direction: column;
	}

	.okbfc-cta-buttons {
		flex-direction: column;
	}
}

/* ── CTA Buttons ── */
.okbfc-cta-buttons {
	display: flex;
	gap: 15px;
	justify-content: center;
	margin: 30px auto;
	max-width: 960px;
}

.okbfc-cta-btn {
	display: inline-block;
	padding: 14px 32px;
	background-color: #D23232;
	color: #fff !important;
	text-decoration: none !important;
	border-radius: 6px;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	transition: background-color 0.2s ease;
}

.okbfc-cta-btn:hover {
	background-color: #b52929;
}

/* ── Option Cards (Steps 3, 4, 5) ── */
.okbfc-options-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.okbfc-option-card {
	padding: 16px 28px;
	border: 2px solid #e0e0e0;
	border-radius: 10px;
	background: #fafafa;
	font-size: 15px;
	font-weight: 600;
	color: #393E46;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
	text-align: center;
	min-width: 120px;
}

.okbfc-option-card:hover {
	border-color: #D23232;
	box-shadow: 0 4px 12px rgba(210, 50, 50, 0.15);
}

.okbfc-option-card.selected {
	border-color: #D23232;
	background: #fdeaea;
	box-shadow: 0 0 0 3px rgba(210, 50, 50, 0.2);
}

/* Option card with image (Steps 4, 5) */
.okbfc-option-card.has-image {
	padding: 10px;
	min-width: 140px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.okbfc-option-card-image {
	width: 100%;
	height: 80px;
	overflow: hidden;
	border-radius: 6px;
	margin-bottom: 8px;
}

.okbfc-option-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.okbfc-option-card-label {
	display: block;
}

/* Not-applicable message */
.okbfc-step-na {
	color: #888;
	font-style: italic;
	padding: 12px 0;
	margin: 0;
}

/* Tensile grid (step 3) — same look as other option cards but no image */
.okbfc-tensile-grid .okbfc-grid-item {
	min-height: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.okbfc-tensile-grid .okbfc-grid-item-image {
	display: none;
}

.okbfc-tensile-grid .okbfc-grid-item-title {
	font-size: 16px;
	font-weight: 700;
}

/* ── Step 6: Section subtitle ── */
.okbfc-section-subtitle {
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 600;
	color: #393E46;
	padding-bottom: 8px;
	border-bottom: 1px solid #eee;
}

/* ── Step 6: Attribute Filter Grid ── */
.okbfc-attr-filters {
	margin-bottom: 28px;
}

.okbfc-attr-filter-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.okbfc-attr-filter-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 160px;
}

.okbfc-attr-filter-item label {
	font-size: 13px;
	font-weight: 600;
	color: #555;
}

.okbfc-attr-select {
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 14px;
	color: #393E46;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s;
}

.okbfc-attr-select:focus {
	outline: none;
	border-color: #D23232;
	box-shadow: 0 0 0 3px rgba(210, 50, 50, 0.15);
}

/* ── Step 6: Product Slider ── */
.okbfc-products-slider-section {
	margin-top: 10px;
}

.okbfc-products-slider-wrapper {
	display: flex;
	align-items: stretch;
	gap: 0;
	overflow: hidden;
	position: relative;
}

.okbfc-products-slider {
	display: flex;
	gap: 16px;
	transition: transform 0.35s ease;
	flex: 1;
	overflow: visible;
	justify-content: center;
}

.okbfc-slider-card {
	flex: 0 0 200px;
	border: 2px solid #e0e0e0;
	border-radius: 10px;
	overflow: hidden;
	background: #fafafa;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.okbfc-slider-card:hover {
	border-color: #D23232;
	box-shadow: 0 4px 16px rgba(210, 50, 50, 0.15);
	transform: translateY(-2px);
}

.okbfc-slider-card.selected {
	border-color: #D23232;
	background: #fdeaea;
	box-shadow: 0 0 0 3px rgba(210, 50, 50, 0.2);
}

.okbfc-slider-card-image {
	width: 100%;
	height: 160px;
	overflow: hidden;
	background: #f0f0f0;
}

.okbfc-slider-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.okbfc-slider-card-image .okbfc-placeholder-image {
	height: 100%;
	font-size: 48px;
}

.okbfc-slider-card-body {
	padding: 14px;
}

.okbfc-slider-card-title {
	font-size: 14px;
	font-weight: 700;
	color: #393E46;
	margin-bottom: 10px;
	line-height: 1.4;
}

.okbfc-slider-btn {
	flex-shrink: 0;
	width: 40px;
	background: #fff;
	border: 2px solid #D23232;
	border-radius: 6px;
	color: #D23232;
	font-size: 28px;
	font-weight: 700;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
	padding: 0;
	line-height: 1;
	align-self: center;
}

.okbfc-slider-btn:hover {
	background: #D23232;
	color: #fff;
}

.okbfc-slider-btn-disabled {
	opacity: 0.35;
	cursor: default;
}

button#okbfc-slider-prev,
#okbfc-slider-next {
	z-index: 999999999999;
	position: absolute;
	border-radius: 50px;
	padding: 10px 15px;
	color: #fff;
}

button#okbfc-slider-prev {
	left: 0px;
}

#okbfc-slider-next {
	right: 0px;
}

.okbfc-slider-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
}

.okbfc-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #ddd;
	cursor: pointer;
	transition: background 0.2s;
}

.okbfc-dot.active {
	background: #D23232;
}

/* ── Responsive: slider ── */
@media (max-width: 899px) {
	.okbfc-slider-card {
		flex: 0 0 calc(50% - 8px);
	}
}

@media (max-width: 599px) {
	.okbfc-slider-card {
		flex: 0 0 100%;
	}

	.okbfc-options-grid {
		flex-direction: column;
	}

	.okbfc-option-card {
		width: 100%;
	}

	.okbfc-attr-filter-grid {
		flex-direction: column;
	}

	.okbfc-attr-filter-item {
		min-width: 100%;
	}
}
