/* =============================================
   Pil's BMI Calculator – frontend styles
   ============================================= */

/* ── Wrapper ── */
.pils-bmi-wrap {
	position: relative;
	max-width: 560px;
	margin: 0 auto;
	font-family: inherit;
}

/* ── Card ── */
.pils-bmi-card {
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 4px 32px rgba(0, 0, 0, 0.10);
	padding: 32px;
	box-sizing: border-box;
}

/* ── Title ── */
.pils-bmi-title {
	margin: 0 0 24px;
	font-size: 1.75rem;
	font-weight: 800;
	color: #111111;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

/* ── Field ── */
.pils-bmi-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 16px;
}

.pils-bmi-field label {
	font-size: 13.5px;
	font-weight: 500;
	color: #111111;
	margin-bottom: 6px;
}

/* Required asterisk */
.pils-bmi-req {
	color: #2d7a4e;
	font-weight: 700;
}

/* ── Number inputs ── */
.pils-bmi-field input[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
	padding: 11px 14px;
	font-size: 15px;
	color: #111111;
	background: #ffffff;
	border: 1.5px solid #e0e0e0;
	border-radius: 8px;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.18s, box-shadow 0.18s;
}

.pils-bmi-field input[type="number"]::-webkit-inner-spin-button,
.pils-bmi-field input[type="number"]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.pils-bmi-field input[type="number"]:focus {
	outline: none;
	border-color: #2d7a4e;
	box-shadow: 0 0 0 3px rgba(45, 122, 78, 0.14);
}

.pils-bmi-field input[type="number"]::placeholder {
	color: #b0b0b0;
}

/* ── Error ── */
.pils-bmi-error {
	margin: 0 0 12px;
	font-size: 13px;
	color: #dc2626;
}

/* ── Submit button ── */
#pils-bmi-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #106D4A;
	color: #ffffff;
	border: none;
	border-radius: 10px;
	padding: 13px 24px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
	box-sizing: border-box;
	transition: background 0.18s;
	margin-top: 4px;
}

#pils-bmi-btn:hover {
	background: #0B5A3C;
}

#pils-bmi-btn:active {
	opacity: 0.85;
}

/* ============================================
   Result overlay — covers the card in-place
   ============================================ */
.pils-bmi-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 25, 20, 0.55);
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	animation: pilsBmiFadeIn 0.22s ease both;
}

.pils-bmi-overlay[hidden] {
	display: none;
}

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

/* Result card inside the overlay */
.pils-bmi-result-card {
	position: relative;
	background: #ffffff;
	border-radius: 14px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	padding: 28px 28px 24px;
	width: calc(100% - 32px);
	max-width: 420px;
	box-sizing: border-box;
	text-align: center;
	animation: pilsBmiSlideUp 0.22s ease both;
}

/* ── Close button ── */
.pils-bmi-close-btn {
	position: absolute;
	top: 12px;
	right: 12px;
	background: transparent;
	border: none;
	color: #888888;
	cursor: pointer;
	padding: 4px;
	line-height: 0;
	border-radius: 6px;
	transition: color 0.18s, background 0.18s;
}

.pils-bmi-close-btn:hover {
	color: #111111;
	background: #f0f0f0;
}

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

.pils-bmi-result-title {
	margin: 0 0 18px;
	font-size: 1.1rem;
	font-weight: 700;
	color: #111111;
}

/* ── Big BMI number ── */
.pils-bmi-result-main {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 8px;
	margin-bottom: 14px;
}

.pils-bmi-result-number {
	font-size: 3.2rem;
	font-weight: 800;
	color: #1a3d2b;
	line-height: 1;
}

.pils-bmi-result-unit {
	font-size: 1rem;
	font-weight: 600;
	color: #666666;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

/* ── Category badge ── */
.pils-bmi-category-wrap {
	margin-bottom: 14px;
}

.pils-bmi-category-badge {
	display: inline-block;
	padding: 5px 16px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

/* Colors injected by JS via data-cat attribute */
.pils-bmi-category-badge[data-cat="under"] {
	background: #dbeafe;
	color: #1d4ed8;
}
.pils-bmi-category-badge[data-cat="normal"] {
	background: #dcfce7;
	color: #15803d;
}
.pils-bmi-category-badge[data-cat="over"] {
	background: #fef3c7;
	color: #b45309;
}
.pils-bmi-category-badge[data-cat="obese"] {
	background: #fee2e2;
	color: #b91c1c;
}

/* ── Description text ── */
.pils-bmi-result-desc {
	font-size: 13.5px;
	color: #555555;
	line-height: 1.55;
	margin: 0 0 18px;
}

/* ── BMI scale bar ── */
.pils-bmi-scale {
	margin-bottom: 20px;
}

.pils-bmi-scale-bar {
	display: flex;
	border-radius: 8px;
	overflow: hidden;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
}

.pils-bmi-scale-seg {
	flex: 1;
	padding: 7px 4px;
	color: rgba(0,0,0,0.65);
}

.pils-bmi-seg--under  { background: #bfdbfe; }
.pils-bmi-seg--normal { background: #bbf7d0; }
.pils-bmi-seg--over   { background: #fde68a; }
.pils-bmi-seg--obese  { background: #fecaca; }

/* Active segment highlight */
.pils-bmi-scale-seg.pils-bmi-seg--active {
	outline: 2.5px solid #1a3d2b;
	outline-offset: -2.5px;
	color: #111111;
	font-weight: 800;
}

/* ── Reset button ── */
.pils-bmi-reset-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: #106D4A;
	border: 1.5px solid #106D4A;
	border-radius: 8px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
	box-sizing: border-box;
	transition: background 0.18s, color 0.18s;
}

.pils-bmi-reset-btn:hover {
	background: #106D4A;
	color: #ffffff;
}

/* ============================================
   Mobile
   ============================================ */
@media (max-width: 520px) {
	.pils-bmi-card {
		border-radius: 14px;
		padding: 22px 18px 26px;
	}

	.pils-bmi-title {
		font-size: 1.45rem;
		margin-bottom: 20px;
	}

	.pils-bmi-overlay {
		border-radius: 14px;
		align-items: flex-start;
		padding-top: 12px;
		overflow-y: auto;
	}

	.pils-bmi-result-card {
		padding: 22px 18px 20px;
		width: calc(100% - 24px);
		margin: 8px;
	}

	.pils-bmi-result-number {
		font-size: 2.8rem;
	}
}
