/* =========================================================
   THBP CALCULATOR
   Investor-grade polished UI
========================================================= */

.thbp-calc-page {
	background: #f4f6f8;
	padding: 34px 16px 60px;
}

.thbp-calc-container {
	max-width: 1240px;
	margin: 0 auto;
}

.thbp-calc-header {
	text-align: center;
	margin-bottom: 20px;
}

.thbp-calc-title {
	margin: 0 0 10px;
	font-size: 34px;
	line-height: 1.12;
	font-weight: 700;
	letter-spacing: -0.03em;
	color: #18253d;
	text-rendering: optimizeLegibility;
}

.thbp-calc-subtitle {
	margin: 0 auto;
	max-width: 760px;
	font-size: 16px;
	line-height: 1.72;
	font-weight: 400;
	letter-spacing: -0.01em;
	color: #66758d;
}

/* =========================================================
   TABS
========================================================= */

.thbp-calc-tabs {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}

.thbp-calc-tab {
	appearance: none;
	border: 1px solid #d9e1eb;
	background: #ffffff;
	color: #243756;
	border-radius: 13px;
	padding: 11px 18px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(22, 33, 62, 0.035);
	transition: all 0.2s ease;
	min-width: 122px;
}

.thbp-calc-tab:hover {
	background: #f8fafc;
	border-color: #cbd6e5;
	transform: translateY(-1px);
}

.thbp-calc-tab.is-active {
	background: #1f3b82;
	border-color: #1f3b82;
	color: #ffffff;
	box-shadow: 0 8px 18px rgba(31, 59, 130, 0.14);
}

/* =========================================================
   PANELS
========================================================= */

.thbp-calc-panels {
	position: relative;
}

.thbp-calc-panel {
	display: none;
}

.thbp-calc-panel.is-active {
	display: block;
}

/* =========================================================
   GRID
========================================================= */

.thbp-calc-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
	gap: 18px;
	align-items: start;
}

.thbp-calc-col {
	min-width: 0;
}

.thbp-calc-results-stick {
	position: sticky;
	top: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* =========================================================
   CARDS
========================================================= */

.thbp-calc-card {
	background: #ffffff;
	border: 1px solid #e5ecf3;
	border-radius: 20px;
	padding: 20px;
	box-shadow: 0 10px 26px rgba(17, 30, 61, 0.045);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.thbp-calc-card:hover {
	border-color: #dbe5ef;
	box-shadow: 0 14px 30px rgba(17, 30, 61, 0.06);
}

.thbp-calc-card-head {
	margin-bottom: 14px;
}

.thbp-calc-card-head h2 {
	margin: 0 0 6px;
	font-size: 22px;
	line-height: 1.18;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #18253d;
	text-rendering: optimizeLegibility;
}

.thbp-calc-card-head p {
	margin: 0;
	font-size: 14px;
	line-height: 1.62;
	font-weight: 400;
	letter-spacing: -0.01em;
	color: #6d7b92;
}

/* =========================================================
   SECTIONS
========================================================= */

.thbp-calc-section + .thbp-calc-section {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid #eef3f8;
}

.thbp-calc-section-title {
	margin: 0 0 13px;
	font-size: 16px;
	line-height: 1.28;
	font-weight: 700;
	letter-spacing: -0.015em;
	color: #1d2d49;
}

.thbp-calc-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

/* =========================================================
   FIELDS
========================================================= */

.thbp-calc-field {
	margin-bottom: 13px;
}

.thbp-calc-field:last-child {
	margin-bottom: 0;
}

.thbp-calc-field-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

.thbp-calc-field label {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 7px;
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.38;
	letter-spacing: -0.01em;
	color: #2f4261;
}

.thbp-calc-field input[type="text"],
.thbp-calc-field select {
	width: 100%;
	height: 52px;
	border: 1px solid #dbe3ee;
	border-radius: 13px;
	background: #fbfcfe;
	padding: 0 15px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: #22324f;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.thbp-calc-field input[type="text"]::placeholder,
.thbp-calc-field select::placeholder {
	color: #99a6ba;
	font-weight: 400;
}

.thbp-calc-field input[type="text"]:focus,
.thbp-calc-field select:focus {
	outline: none;
	border-color: #9cb2d7;
	background: #ffffff;
	box-shadow: 0 0 0 4px rgba(43, 99, 217, 0.08);
}

.thbp-calc-optional {
	font-size: 10px;
	font-weight: 700;
	color: #8190a7;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* =========================================================
   INFO ICON
========================================================= */

.thbp-calc-info {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1px solid #cfd8e6;
	color: #8090a8;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	cursor: help;
	background: #ffffff;
	flex: 0 0 16px;
}

/* =========================================================
   SLIDER
========================================================= */

.thbp-calc-slider-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.thbp-calc-slider-wrap input[type="range"] {
	flex: 1 1 auto;
	height: 6px;
	border-radius: 999px;
	background: #dde5ef;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
}

.thbp-calc-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 999px;
	background: #dde5ef;
}

.thbp-calc-slider-wrap input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #1c79d7;
	border: 3px solid #ffffff;
	box-shadow: 0 3px 10px rgba(28, 121, 215, 0.22);
	margin-top: -7px;
}

.thbp-calc-slider-wrap input[type="range"]::-moz-range-track {
	height: 6px;
	border-radius: 999px;
	background: #dde5ef;
}

.thbp-calc-slider-wrap input[type="range"]::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #1c79d7;
	border: 3px solid #ffffff;
	box-shadow: 0 3px 10px rgba(28, 121, 215, 0.22);
	cursor: pointer;
}

.thbp-calc-slider-value {
	min-width: 54px;
	text-align: right;
}

.thbp-calc-slider-value span {
	display: inline-block;
	font-size: 18px;
	line-height: 1;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #243756;
}

/* =========================================================
   QUICK PICKS
========================================================= */

.thbp-calc-quick-picks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.thbp-calc-quick-btn {
	appearance: none;
	border: 1px solid #dce4ef;
	background: #f8fafc;
	color: #3c4f6e;
	border-radius: 10px;
	padding: 8px 13px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s ease;
}

.thbp-calc-quick-btn:hover {
	background: #f1f5fa;
	border-color: #ccd7e6;
}

.thbp-calc-quick-btn.is-active {
	background: #1f3b82;
	border-color: #1f3b82;
	color: #ffffff;
	box-shadow: 0 6px 14px rgba(31, 59, 130, 0.14);
}

/* =========================================================
   EXTRA INCOME
========================================================= */

.thbp-calc-add-btn {
	appearance: none;
	border: 1px solid #dbe3ee;
	background: #f8fafc;
	color: #294066;
	border-radius: 10px;
	padding: 10px 13px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.thbp-calc-add-btn:hover {
	background: #f2f6fa;
	border-color: #ced9e8;
}

.thbp-calc-revenue-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.thbp-calc-revenue-row {
	display: grid;
	grid-template-columns: 140px minmax(0, 1fr) 104px;
	gap: 12px;
	padding: 12px;
	border: 1px solid #e7edf4;
	border-radius: 15px;
	background: #fcfdff;
	align-items: end;
}

.thbp-calc-revenue-row .thbp-calc-field {
	margin-bottom: 0;
}

.thbp-calc-revenue-remove-wrap {
	display: flex;
	align-items: flex-end;
}

.thbp-calc-remove-btn {
	width: 100%;
	height: 52px;
	appearance: none;
	border: 1px solid #edd8d4;
	background: #fff9f8;
	color: #c06a63;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.thbp-calc-remove-btn:hover:not(:disabled) {
	background: #fff4f2;
	border-color: #e4c9c4;
}

.thbp-calc-revenue-list.is-empty {
	display: none;
}

.thbp-calc-revenue-empty {
	font-size: 13px;
	line-height: 1.68;
	color: #7f8da3;
	padding: 1px 2px 0;
}

/* =========================================================
   ACTIONS
========================================================= */

.thbp-calc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 22px;
}

.thbp-calc-primary-btn,
.thbp-calc-secondary-btn {
	appearance: none;
	border-radius: 12px;
	padding: 13px 18px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s ease;
}

.thbp-calc-primary-btn {
	border: 1px solid #1f3b82;
	background: #1f3b82;
	color: #ffffff;
	box-shadow: 0 8px 18px rgba(31, 59, 130, 0.16);
}

.thbp-calc-primary-btn:hover {
	background: #1a336f;
	border-color: #1a336f;
	transform: translateY(-1px);
}

.thbp-calc-secondary-btn {
	border: 1px solid #dde5ef;
	background: #f8fafc;
	color: #3e516d;
}

.thbp-calc-secondary-btn:hover {
	background: #f2f6fa;
	border-color: #cfd9e7;
}

/* =========================================================
   SUMMARY
========================================================= */

.thbp-calc-summary-card {
	padding: 22px;
	background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
	border-color: #dfe7f1;
	box-shadow: 0 14px 30px rgba(17, 30, 61, 0.065);
}

.thbp-calc-summary-label {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: #556983;
	margin-bottom: 10px;
}

.thbp-calc-summary-value {
	font-size: 42px;
	line-height: 1;
	font-weight: 700;
	letter-spacing: -0.04em;
	margin-bottom: 20px;
	color: #18253d;
	text-rendering: optimizeLegibility;
}

.thbp-calc-summary-value.is-profit {
	color: #2d9a67;
}

.thbp-calc-summary-value.is-loss {
	color: #c96a61;
}

.thbp-calc-summary-stats {
	display: flex;
	flex-direction: column;
	gap: 0;
	border-top: 1px solid #edf2f7;
}

.thbp-calc-summary-stat {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid #f0f4f8;
}

.thbp-calc-summary-stat:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.thbp-calc-summary-stat span {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: #657791;
}

.thbp-calc-summary-stat strong {
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #22324f;
	text-align: right;
}

/* =========================================================
   RESULT LISTS
========================================================= */

.thbp-calc-result-title {
	margin: 0 0 12px;
	font-size: 18px;
	line-height: 1.2;
	font-weight: 700;
	letter-spacing: -0.015em;
	color: #1d2d49;
}

.thbp-calc-result-list {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.thbp-calc-result-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 13px 0;
	border-bottom: 1px solid #f0f4f8;
}

.thbp-calc-result-row:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.thbp-calc-result-row span {
	font-size: 14px;
	font-weight: 500;
	letter-spacing: -0.01em;
	color: #60728e;
}

.thbp-calc-result-row strong {
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -0.015em;
	color: #22324f;
	text-align: right;
}

.thbp-calc-result-row strong.is-profit {
	color: #2d9a67;
}

.thbp-calc-result-row strong.is-loss {
	color: #c96a61;
}

.thbp-calc-result-row.is-total {
	padding-top: 16px;
}

.thbp-calc-result-row.is-total span,
.thbp-calc-result-row.is-total strong {
	color: #18253d;
	font-weight: 800;
}

/* =========================================================
   INSIGHTS / LOAN NOTE
========================================================= */

.thbp-calc-recommendation-card {
	background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
	border-color: #e1eaf5;
}

.thbp-calc-recommendation-card p {
	margin: 0;
	font-size: 14px;
	line-height: 1.78;
	letter-spacing: -0.01em;
	color: #5b6f89;
}

.thbp-calc-loan-note-card {
	margin-top: 10px;
	padding: 18px;
	background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
	border-color: #e1e9f3;
}

.thbp-calc-loan-note-card .thbp-calc-summary-value {
	font-size: 28px;
	margin-bottom: 10px;
}

.thbp-calc-help-text {
	margin: 10px 0 0;
	font-size: 13px;
	line-height: 1.68;
	color: #74839a;
}

/* =========================================================
   UTILITIES
========================================================= */

.thbp-calc-hidden {
	display: none !important;
}

/* =========================================================
   MOBILE BACK TO TOP
========================================================= */

.thbp-calc-back-top {
	position: fixed;
	right: 14px;
	bottom: 40px;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 999px;
	background: #1f3b82;
	color: #ffffff;
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 10px 20px rgba(17, 30, 61, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background 0.2s ease;
	z-index: 9999;
}

.thbp-calc-back-top:hover {
	background: #1a336f;
}

.thbp-calc-back-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

@media (min-width: 768px) {
	.thbp-calc-back-top {
		display: none !important;
	}
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1024px) {
	.thbp-calc-page {
		padding: 28px 16px 52px;
	}

	.thbp-calc-container {
		max-width: 100%;
	}

	.thbp-calc-title {
		font-size: 30px;
	}

	.thbp-calc-subtitle {
		font-size: 15px;
	}

	.thbp-calc-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.thbp-calc-results-stick {
		position: static;
	}

	.thbp-calc-summary-value {
		font-size: 35px;
	}

	.thbp-calc-summary-stat strong {
		font-size: 17px;
	}
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767px) {
	.thbp-calc-page {
		padding: 22px 12px 38px;
	}

	.thbp-calc-header {
		margin-bottom: 18px;
	}

	.thbp-calc-title {
		font-size: 27px;
		line-height: 1.18;
		margin-bottom: 10px;
	}

	.thbp-calc-subtitle {
		font-size: 15px;
		line-height: 1.68;
		max-width: 100%;
	}

	.thbp-calc-tabs {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
		margin-bottom: 18px;
	}

	.thbp-calc-tab {
		min-width: 0;
		width: 100%;
		padding: 12px 10px;
		font-size: 12px;
		border-radius: 11px;
	}

	.thbp-calc-card {
		padding: 16px;
		border-radius: 17px;
		box-shadow: 0 8px 20px rgba(17, 30, 61, 0.04);
	}

	.thbp-calc-card:hover {
		box-shadow: 0 8px 20px rgba(17, 30, 61, 0.04);
	}

	.thbp-calc-card-head {
		margin-bottom: 12px;
	}

	.thbp-calc-card-head h2 {
		font-size: 23px;
		line-height: 1.2;
	}

	.thbp-calc-card-head p {
		font-size: 14px;
		line-height: 1.65;
	}

	.thbp-calc-section + .thbp-calc-section {
		margin-top: 15px;
		padding-top: 15px;
	}

	.thbp-calc-section-title {
		font-size: 17px;
	}

	.thbp-calc-field-row {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.thbp-calc-section-head {
		flex-direction: column;
		align-items: stretch;
	}

	.thbp-calc-field label {
		font-size: 14px;
		line-height: 1.42;
	}

	.thbp-calc-field input[type="text"],
	.thbp-calc-field select {
		height: 52px;
		font-size: 16px;
	}

	.thbp-calc-slider-wrap {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.thbp-calc-slider-value {
		text-align: left;
		min-width: 0;
	}

	.thbp-calc-slider-value span {
		font-size: 19px;
	}

	.thbp-calc-revenue-row {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 12px;
	}

	.thbp-calc-revenue-remove-wrap {
		align-items: stretch;
	}

	.thbp-calc-remove-btn {
		height: 50px;
		font-size: 13px;
	}

	.thbp-calc-revenue-empty,
	.thbp-calc-help-text {
		font-size: 13px;
		line-height: 1.7;
	}

	.thbp-calc-actions {
		position: sticky;
		bottom: 10px;
		z-index: 8;
		padding: 10px;
		background: rgba(244, 246, 248, 0.96);
		backdrop-filter: blur(8px);
		border-radius: 14px;
		margin: 18px -4px 0;
		flex-direction: column;
		box-shadow: 0 10px 24px rgba(17, 30, 61, 0.08);
	}

	.thbp-calc-primary-btn,
	.thbp-calc-secondary-btn {
		width: 100%;
		font-size: 14px;
		padding: 14px 18px;
	}

	.thbp-calc-summary-card {
		padding: 18px;
	}

	.thbp-calc-summary-label {
		font-size: 15px;
	}

	.thbp-calc-summary-value {
		font-size: 34px;
		margin-bottom: 16px;
	}

	.thbp-calc-summary-stat {
		flex-direction: column;
		align-items: flex-start;
		gap: 5px;
	}

	.thbp-calc-summary-stat span {
		font-size: 14px;
	}

	.thbp-calc-summary-stat strong,
	.thbp-calc-result-row strong {
		text-align: left;
		font-size: 17px;
	}

	.thbp-calc-result-title {
		font-size: 18px;
	}

	.thbp-calc-result-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 5px;
	}

	.thbp-calc-result-row span {
		font-size: 14px;
	}

	.thbp-calc-recommendation-card p {
		font-size: 14px;
		line-height: 1.75;
	}
}

