/*
 * Hubro Concrete Calculator — V2 styles.
 * Lives alongside (not instead of) assets/css/calculator.css so v1 sites are
 * unaffected. Enqueued only when uiVersion=v2. See V2-COMPATIBILITY.md.
 *
 * Colors/spacing/typography are ported 1:1 from the design's React/Tailwind
 * mockup (mockup/src/app/App.tsx) — see hex values below for the source of
 * each token. All rules are scoped under .hubro-cc-v2-container with their
 * own custom properties (--hccv2-*) so this stylesheet can never bleed into
 * v1 markup.
 */

.hubro-cc-v2-container {
	/* from App.tsx: text-[#7AB855] / bg-[#7AB855] / hover:bg-[#6BA845] */
	--hccv2-green: #7AB855;
	--hccv2-green-hover: #6BA845;
	--hccv2-green-selected-bg: #E8F5E0;
	--hccv2-green-selected-text: #4A7C2F;
	--hccv2-green-option-hover-bg: #F5FAF2;

	/* Tailwind gray scale used throughout App.tsx */
	--hccv2-gray-50: #F9FAFB;
	--hccv2-gray-200: #E5E7EB;
	--hccv2-gray-300: #D1D5DB;
	--hccv2-gray-400: #9CA3AF;
	--hccv2-gray-500: #6B7280;
	--hccv2-gray-600: #4B5563;
	--hccv2-gray-700: #374151;
	--hccv2-gray-900: #111827;

	/* shadcn --radius from mockup/src/styles/globals.css, used by Tailwind's rounded-lg */
	--hccv2-radius: 0.625rem;

	max-width: 42rem; /* max-w-2xl */
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--hccv2-gray-900);
	box-sizing: border-box;
}

.hubro-cc-v2-container *,
.hubro-cc-v2-container *::before,
.hubro-cc-v2-container *::after {
	box-sizing: border-box;
}

.hubro-cc-v2-title {
	font-size: 2.25rem; /* text-4xl */
	font-weight: 700;
	line-height: 1.2;
	color: var(--hccv2-green);
	margin: 0 0 0.5rem;
}

.hubro-cc-v2-subtitle {
	margin: 0 0 2rem; /* mb-8 */
	color: var(--hccv2-gray-600);
	font-size: 1rem;
}

.hubro-cc-v2-card {
	position: relative; /* positioning context for .hubro-cc-v2-lead-popup, which must cover the whole card like v1's step4-contact-form does */
	background: #fff;
	border-radius: var(--hccv2-radius);
	padding: 1.5rem; /* p-6 */
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
}

.hubro-cc-v2-section {
	padding-top: 2rem; /* pt-8 */
	border-top: 1px solid var(--hccv2-gray-200);
	margin-top: 2rem;
}

.hubro-cc-v2-card > .hubro-cc-v2-section:first-child {
	padding-top: 0;
	border-top: none;
	margin-top: 0;
}

.hubro-cc-v2-field-group + .hubro-cc-v2-field-group {
	margin-top: 1.5rem; /* space-y-6 */
}

.hubro-cc-v2-field-group > label,
.hubro-cc-v2-field > label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--hccv2-gray-700);
	margin: 0 0 0.5rem;
}

.hubro-cc-v2-section-title {
	font-size: 1.25rem; /* text-xl */
	font-weight: 600;
	color: var(--hccv2-gray-900);
	margin: 0 0 1.5rem;
}

.hubro-cc-v2-subsection-title {
	font-size: 1.125rem; /* text-lg */
	font-weight: 500;
	color: var(--hccv2-gray-900);
	margin: 0 0 1rem;
}

/* Inputs */

.hubro-cc-v2-container input[type="text"],
.hubro-cc-v2-container input[type="number"],
.hubro-cc-v2-container input[type="email"],
.hubro-cc-v2-container input[type="tel"],
.hubro-cc-v2-container input[type="date"],
.hubro-cc-v2-container textarea {
	width: 100%;
	padding: 0.75rem 1rem; /* py-3 px-4 */
	border: 1px solid var(--hccv2-gray-300);
	border-radius: var(--hccv2-radius);
	font-size: 1rem;
	font-family: inherit;
	color: var(--hccv2-gray-900);
	background: #fff;
	appearance: none;
}

.hubro-cc-v2-container textarea {
	resize: vertical;
	line-height: 1.5;
}

.hubro-cc-v2-container input::placeholder,
.hubro-cc-v2-container textarea::placeholder {
	color: var(--hccv2-gray-400);
	font-family: inherit;
}

.hubro-cc-v2-container input:focus,
.hubro-cc-v2-container textarea:focus {
	outline: none;
	border-color: transparent;
	box-shadow: 0 0 0 2px var(--hccv2-green);
}

.hubro-cc-v2-container .hubro-cc-v2-cta:focus-visible,
.hubro-cc-v2-container .hccv2-dropdown-trigger:focus-visible,
.hubro-cc-v2-container .hubro-cc-v2-toggle-option:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--hccv2-green);
}

.hccv2-uppercase {
	text-transform: uppercase;
}

/* Custom dropdowns (concrete type / delivery method) */

.hccv2-dropdown {
	position: relative;
}

.hccv2-dropdown-trigger {
	width: 100%;
	background: #fff;
	border: 1px solid var(--hccv2-gray-300);
	border-radius: var(--hccv2-radius);
	padding: 0.75rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 1rem;
	font-family: inherit;
	color: var(--hccv2-gray-900);
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.hccv2-dropdown-trigger:hover {
	border-color: var(--hccv2-gray-400);
}

.hccv2-dropdown-trigger[aria-expanded="true"] {
	border-color: var(--hccv2-green);
}

.hccv2-dropdown-trigger-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hccv2-chevron {
	flex-shrink: 0;
	color: var(--hccv2-gray-400);
	transition: transform 0.15s ease;
}

.hccv2-dropdown-trigger[aria-expanded="true"] .hccv2-chevron {
	transform: rotate(180deg);
}

.hccv2-dropdown-panel {
	position: absolute;
	z-index: 10;
	top: calc(100% + 0.5rem);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--hccv2-gray-200);
	border-radius: var(--hccv2-radius);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	max-height: 280px;
	overflow-y: auto;
}

.hccv2-dropdown-option {
	display: block;
	width: 100%;
	padding: 0.75rem 1rem;
	text-align: left;
	background: none;
	border: none;
	font-size: 1rem;
	font-family: inherit;
	color: var(--hccv2-gray-900);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.hccv2-dropdown-option:hover {
	background: var(--hccv2-green-option-hover-bg);
}

.hccv2-dropdown-option.selected {
	background: var(--hccv2-green-selected-bg);
	color: var(--hccv2-green-selected-text);
}

/* Volume mode toggle */

.hubro-cc-v2-toggle {
	display: flex;
	gap: 0.5rem; /* gap-2 */
	margin-bottom: 1rem; /* mb-4 */
}

.hubro-cc-v2-toggle-option {
	flex: 1;
	padding: 0.625rem 1rem; /* py-2.5 px-4 */
	border: 2px solid var(--hccv2-gray-300);
	border-radius: var(--hccv2-radius);
	background: #fff;
	color: var(--hccv2-gray-700);
	font-size: 1rem;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hubro-cc-v2-toggle-option:hover {
	border-color: var(--hccv2-gray-400);
}

.hubro-cc-v2-toggle-option.active {
	border-color: var(--hccv2-green);
	background: var(--hccv2-green);
	color: #fff;
}

.hubro-cc-v2-toggle-option.active:hover {
	border-color: var(--hccv2-green);
}

.hubro-cc-v2-mode-section {
	display: none;
}

.hubro-cc-v2-mode-section.active {
	display: block;
}

.hubro-cc-v2-input-suffix {
	position: relative;
}

.hubro-cc-v2-input-suffix input {
	padding-right: 3rem; /* pr-12 */
}

.hubro-cc-v2-measurement-grid .hubro-cc-v2-input-suffix input {
	padding-right: 2.5rem; /* pr-10 */
}

.hubro-cc-v2-suffix {
	position: absolute;
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--hccv2-gray-500);
	font-size: 1rem;
	pointer-events: none;
}

.hubro-cc-v2-measurement-grid .hubro-cc-v2-suffix {
	right: 0.75rem;
}

.hubro-cc-v2-measurement-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem; /* gap-3 */
}

.hubro-cc-v2-caption {
	font-size: 0.75rem; /* text-xs */
	color: var(--hccv2-gray-500);
	margin: 0.25rem 0 0;
}

/* Leveringssted */

.hubro-cc-v2-address-field {
	margin-bottom: 1.5rem; /* space-y-6 before Leveringsmetode field-group */
}

.hubro-cc-v2-address-field > * + * {
	margin-top: 1rem; /* space-y-4 */
}

.hubro-cc-v2-grid-address {
	display: grid;
	grid-template-columns: 1fr 8rem; /* md:grid-cols-[1fr_auto], Nr ~ md:w-32 */
	gap: 0.75rem;
}

.hubro-cc-v2-grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
}

.hubro-cc-v2-field {
	margin: 0;
	min-width: 0;
}

.hubro-cc-v2-field-nr {
	align-self: start;
}

/* Gatenavn checkmark — shown once the input has a value, pure CSS via :placeholder-shown */
.hubro-cc-v2-address-field .hubro-cc-v2-input-suffix input {
	padding-right: 2.5rem;
}

.hubro-cc-v2-address-field .hubro-cc-v2-input-suffix svg {
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: #16A34A;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.1s ease;
}

.hubro-cc-v2-address-field .hubro-cc-v2-input-suffix input:not(:placeholder-shown) ~ svg {
	opacity: 1;
}

.hubro-cc-v2-hint {
	margin: 0.5rem 0 0;
	font-size: 0.75rem;
	color: var(--hccv2-gray-500);
}

.hubro-cc-v2-grid-2 + .hubro-cc-v2-hint {
	font-size: 0.875rem; /* "Prisen gjelder..." uses text-sm, not text-xs */
	margin-top: 0.75rem;
}

.hubro-cc-v2-hint-italic {
	font-style: italic;
}

.hubro-cc-v2-hint-accent {
	font-size: 0.875rem;
	color: var(--hccv2-green);
	margin-top: 0.5rem;
}

.hubro-cc-v2-hint a,
.hubro-cc-v2-hint-accent a {
	color: inherit;
	text-decoration: underline;
}

/* Ferdigarmert checkbox */

.hubro-cc-v2-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	cursor: pointer;
}

.hubro-cc-v2-checkbox-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 0.125rem;
	width: 1.25rem;
	height: 1.25rem;
	flex-shrink: 0;
}

.hccv2-checkbox {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	border: 2px solid var(--hccv2-gray-300);
	border-radius: 4px;
	appearance: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hccv2-checkbox:checked {
	background: var(--hccv2-green);
	border-color: var(--hccv2-green);
}

.hubro-cc-v2-checkbox-icon {
	position: absolute;
	color: #fff;
	opacity: 0;
	pointer-events: none;
}

.hccv2-checkbox:checked ~ .hubro-cc-v2-checkbox-icon {
	opacity: 1;
}

.hubro-cc-v2-checkbox-label span:last-child {
	color: var(--hccv2-gray-700);
	transition: color 0.15s ease;
}

.hubro-cc-v2-checkbox-label:hover span:last-child {
	color: var(--hccv2-gray-900);
}

/* Results / oppsummering */

.hubro-cc-v2-results-wrap {
	position: relative;
}

.hubro-cc-v2-results {
	background: var(--hccv2-gray-50);
	border-radius: var(--hccv2-radius);
	padding: 1.5rem; /* p-6 */
	overflow: hidden;
}

.hubro-cc-v2-results-content {
	transition: filter 0.2s ease;
}

.hubro-cc-v2-results-content:not(.revealed) {
	filter: blur(8px);
	pointer-events: none;
	user-select: none;
}

/* "Vis pris" overlay — sits on top of the blurred results until the lead form is submitted */
.hubro-cc-v2-reveal-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
}

.hubro-cc-v2-results-wrap.revealed .hubro-cc-v2-reveal-overlay {
	display: none;
}

.hubro-cc-v2-reveal-btn {
	width: auto;
	margin-top: 0;
	padding: 0.875rem 2rem;
	box-shadow: 0 4px 12px rgba(122, 184, 85, 0.35);
}

/* Lead popup ("Vis pris" gate) — covers the results box, matches v1's step4-contact-form */
.hubro-cc-v2-lead-popup {
	position: absolute;
	inset: 0;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.hubro-cc-v2-lead-popup-card {
	position: relative;
	background: #fff;
	width: 100%;
	max-width: 28rem;
	padding: 1.5rem;
	border-radius: var(--hccv2-radius);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.hubro-cc-v2-lead-popup-card .hubro-cc-v2-subsection-title {
	margin-bottom: 0.5rem;
	padding-right: 1.5rem;
}

.hubro-cc-v2-lead-popup-card .hubro-cc-v2-hint {
	margin-bottom: 1rem;
}

.hubro-cc-v2-popup-close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 2rem;
	height: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: none;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--hccv2-gray-500);
	cursor: pointer;
	border-radius: 999px;
}

.hubro-cc-v2-popup-close:hover {
	background: var(--hccv2-gray-50);
	color: var(--hccv2-gray-900);
}

.hubro-cc-v2-result-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.375rem 0; /* approximates space-y-3 (12px gap) */
	font-size: 1rem;
}

.hubro-cc-v2-result-label {
	color: var(--hccv2-gray-600);
}

.hubro-cc-v2-result-value {
	font-weight: 500;
	color: var(--hccv2-gray-900);
}

.hubro-cc-v2-result-total {
	border-top: 1px solid var(--hccv2-gray-200);
	margin-top: 0.375rem;
	padding-top: 0.75rem;
}

.hubro-cc-v2-result-total .hubro-cc-v2-result-label {
	font-size: 1.125rem;
	font-weight: 500;
	color: var(--hccv2-gray-900);
}

.hubro-cc-v2-result-total .hubro-cc-v2-result-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--hccv2-green);
}

.hubro-cc-v2-notice {
	text-align: center;
	font-size: 0.875rem;
	color: var(--hccv2-green);
	margin: 1rem 0 0;
}

.hubro-cc-v2-notice a {
	color: inherit;
	text-decoration: underline;
}

.hubro-cc-v2-cta {
	display: block;
	width: 100%;
	margin-top: 1.5rem; /* mt-6 */
	padding: 1rem 1.5rem; /* py-4 px-6 */
	border: none;
	border-radius: var(--hccv2-radius);
	background: var(--hccv2-green);
	color: #fff;
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	transition: background-color 0.15s ease;
}

.hubro-cc-v2-cta:hover:not(:disabled) {
	background: var(--hccv2-green-hover);
}

.hubro-cc-v2-cta:disabled {
	background: var(--hccv2-gray-300);
	cursor: not-allowed;
}

@media (max-width: 768px) {
	.hubro-cc-v2-grid-address {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 520px) {
	.hubro-cc-v2-measurement-grid {
		grid-template-columns: 1fr;
	}
	.hubro-cc-v2-grid-2 {
		grid-template-columns: 1fr;
	}
}

/* Best-effort styling for an embedded Gravity Forms order form (#hccv2-orderSection),
 * so it doesn't look jarringly out of place next to the rest of v2. GF's own CSS
 * still loads and wins on anything not covered here. */
.hubro-cc-v2-container .gform_wrapper input[type="text"],
.hubro-cc-v2-container .gform_wrapper input[type="email"],
.hubro-cc-v2-container .gform_wrapper input[type="tel"],
.hubro-cc-v2-container .gform_wrapper input[type="number"],
.hubro-cc-v2-container .gform_wrapper input[type="date"],
.hubro-cc-v2-container .gform_wrapper textarea,
.hubro-cc-v2-container .gform_wrapper select {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid var(--hccv2-gray-300);
	border-radius: var(--hccv2-radius);
	font-family: inherit;
}

.hubro-cc-v2-container .gform_wrapper .gform_button {
	background: var(--hccv2-green);
	border: none;
	border-radius: var(--hccv2-radius);
	color: #fff;
	padding: 1rem 1.5rem;
	font-weight: 500;
	cursor: pointer;
}

.hubro-cc-v2-container .gform_wrapper .gform_button:hover {
	background: var(--hccv2-green-hover);
}
