/*
 * CC BMI Calculator - restyled to match the Online Meds design.
 *
 * The plugin is third party, so nothing here touches its files. It ships a
 * Bootstrap 3 clone scoped under #CCB-calc, and when dev_credit is on (the
 * default for shortcode placement) it also injects an inline <style> block
 * where every declaration is !important. Rules that contest one of those
 * inline declarations carry an extra selector component plus !important so
 * they win; everything else relies on normal cascade order.
 *
 * Three things the plugin JS depends on, which must not change:
 *   - .bmi-hidden stays display:none WITHOUT !important, because jQuery
 *     .show() writes an inline display while that class is still present.
 *   - no display on .BMI-Description or the imperial/metric panes, same reason.
 *   - the result banner has its innerHTML replaced on first calculation, so
 *     its two <p> children are styled rather than .form-control-static.
 */

#CCB-calc {
	--ccb-primary: #0bbec5;
	--ccb-primary-dark: #099aa0;
	--ccb-ink: #002439;
	--ccb-muted: #6b7f8c;
	--ccb-line: #e3e8ef;
	--ccb-card-line: #f9f9ff;
	--ccb-surface: var(--section-background-1, #f8fbfb);
	--ccb-radius-card: 30px;
	--ccb-radius-field: 10px;
}

#CCB-calc *,
#CCB-calc *::before,
#CCB-calc *::after {
	box-sizing: border-box;
}

/* Card */

body div#CCB-calc[class*="CCB-Widget"] {
	max-width: 600px;
	margin: 0 auto;
	padding: 0;
	background-color: #fff !important;
	border: 1px solid var(--ccb-card-line) !important;
	border-radius: var(--ccb-radius-card);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
	overflow: hidden;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--ccb-ink) !important;
}

/* Header */

body #CCB-calc #calc-header[class*="CCB-calc-header"] {
	background-color: transparent !important;
	color: var(--ccb-ink) !important;
	text-align: left;
	padding: 24px 24px 4px;
}

body #CCB-calc #calc-header h3 {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ccb-ink);
	text-transform: none;
	letter-spacing: 0;
	margin: 0;
	padding: 0;
}

body #CCB-calc #calc-header[class*="CCB-calc-header"] h3 a {
	color: var(--ccb-ink) !important;
	text-decoration: none;
}

/* Unit switcher */

body #CCB-calc #calc-options {
	display: flex;
	gap: 20px;
	text-align: left;
	padding: 0 24px;
	margin: 4px 0 12px;
}

body #CCB-calc #calc-options input[type="radio"] {
	accent-color: var(--ccb-primary);
	width: 17px;
	height: 17px;
	margin: 0;
	color: inherit;
	vertical-align: middle;
}

body #CCB-calc #calc-options label {
	font-weight: 600;
	margin: 0 0 0 6px;
	vertical-align: middle;
}

/* Form rows - the bespoke float grid is replaced with flex */

body #CCB-calc .col-200-4,
body #CCB-calc .col-200-5,
body #CCB-calc .col-200-6,
body #CCB-calc .col-200-8,
body #CCB-calc .col-200-12 {
	float: none;
	width: auto;
}

body #CCB-calc .form-group {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 24px;
	clear: none;
}

body #CCB-calc .form-group::after {
	content: none;
}

body #CCB-calc .control-label {
	flex: 0 0 76px;
	text-align: left;
	padding: 0;
	margin: 0;
	font-weight: 600;
	color: var(--ccb-ink);
}

body #CCB-calc .col-200-8 {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	gap: 10px;
}

body #CCB-calc .ft_input,
body #CCB-calc .in_input {
	flex: 1 1 0;
}

/* Inputs and unit add-ons */

body #CCB-calc .input-group {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	width: 100%;
}

body #CCB-calc .input-group .form-control {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	height: 48px;
	margin-top: 0;
	padding: 0 14px;
	font-size: 1rem;
	color: var(--ccb-ink);
	background-color: #fff;
	border: 1px solid var(--ccb-line);
	border-right: 0;
	border-radius: var(--ccb-radius-field) 0 0 var(--ccb-radius-field);
	box-shadow: none;
	transition: border-color 0.2s ease-in, box-shadow 0.2s ease-in;
}

body #CCB-calc .form-control[class*="ccb-form-control"] {
	border-color: var(--ccb-line) !important;
}

body #CCB-calc .input-group .form-control:focus {
	border-color: var(--ccb-primary);
	box-shadow: 0 0 0 3px rgba(11, 190, 197, 0.15);
	outline: none;
}

body #CCB-calc .form-control::placeholder {
	color: var(--ccb-muted);
	opacity: 1;
}

body #CCB-calc .input-group .input-group-addon {
	flex: 0 0 auto;
	width: auto;
	min-width: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 14px;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: normal;
	border: 1px solid var(--ccb-line);
	border-radius: 0 var(--ccb-radius-field) var(--ccb-radius-field) 0;
}

body #CCB-calc .input-group-addon[class*="ccb-addon"] {
	background-color: var(--ccb-surface) !important;
	color: var(--ccb-ink) !important;
	border-color: var(--ccb-line) !important;
}

/* Result banner - no display property here, jQuery owns it */

body #CCB-calc .BMI-Description-group {
	padding: 8px 24px;
}

body #CCB-calc .BMI-Description-group .col-200-12 {
	flex: 1 1 100%;
}

body #CCB-calc .alert {
	padding: 14px 18px;
	border: 1px solid;
	border-radius: 14px;
	text-align: left;
	font-weight: 400;
}

body #CCB-calc .alert p {
	margin: 0;
}

body #CCB-calc .alert p:first-child {
	font-size: 1.15rem;
	font-weight: 700;
}

body #CCB-calc .alert p:last-child {
	font-size: 0.9rem;
	font-weight: 600;
	margin-top: 2px;
	opacity: 0.85;
}

body #CCB-calc .alert-success {
	color: #0a7f84;
	background-color: #e6f9f9;
	border-color: #b9ebed;
}

body #CCB-calc .alert-info {
	color: #374d6e;
	background-color: #eef1f8;
	border-color: #d3dbeb;
}

body #CCB-calc .alert-warning {
	color: #8a6d3b;
	background-color: #fdf6e6;
	border-color: #f2e2bd;
}

body #CCB-calc .alert-danger {
	color: #b81c23;
	background-color: #fbeaeb;
	border-color: #f0c8cb;
}

/* Buttons */

body #CCB-calc .col-200-5 {
	flex: 1 1 0;
}

body #CCB-calc .col-200-offset-1 {
	margin-left: 0;
}

body #CCB-calc .col-200-5 .btn {
	margin-left: 0;
}

body #CCB-calc .btn {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 12px 24px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
	border-radius: 50px;
	box-shadow: none;
	transition: 0.2s all ease-in;
}

body #CCB-calc .btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(11, 190, 197, 0.3);
}

body #CCB-calc .btn:active,
body #CCB-calc .btn.active {
	box-shadow: none;
}

body #CCB-calc button.calculate_btn {
	background-color: var(--ccb-primary) !important;
	color: #fff !important;
	border: 1px solid var(--ccb-primary) !important;
}

body #CCB-calc button.calculate_btn:hover,
body #CCB-calc button.calculate_btn:focus {
	background-color: var(--ccb-primary-dark) !important;
	color: #fff !important;
	border-color: var(--ccb-primary-dark) !important;
}

body #CCB-calc button.clear_btn {
	background-color: transparent !important;
	color: var(--ccb-primary) !important;
	border: 1px solid var(--ccb-primary) !important;
}

body #CCB-calc button.clear_btn:hover,
body #CCB-calc button.clear_btn:focus {
	background-color: var(--ccb-primary) !important;
	color: #fff !important;
	border-color: var(--ccb-primary) !important;
}

/* Footer credit */

body #CCB-calc #calc-footer[class*="CCB-calc-footer"] {
	background-color: transparent !important;
	color: var(--ccb-muted) !important;
	text-align: right;
	padding: 10px 24px 18px;
	margin-top: 4px;
	border-top: 1px solid #f0f4f8;
}

body #CCB-calc #calc-footer p {
	font-size: 11px;
	margin: 0;
}

body #CCB-calc #calc-footer[class*="CCB-calc-footer"] p,
body #CCB-calc #calc-footer[class*="CCB-calc-footer"] p a,
body #CCB-calc #calc-footer[class*="CCB-calc-footer"] p a:visited {
	color: var(--ccb-muted) !important;
	background-color: transparent !important;
}

body #CCB-calc #calc-footer[class*="CCB-calc-footer"] p a {
	font-size: 1em;
	text-decoration: underline;
}

/* Responsive - the plugin 200px/400px queries never fire on a 600px card */

@media (max-width: 767px) {
	body #CCB-calc #calc-header[class*="CCB-calc-header"] {
		padding: 18px 18px 4px;
	}

	body #CCB-calc #calc-options,
	body #CCB-calc .form-group,
	body #CCB-calc .BMI-Description-group {
		padding-left: 18px;
		padding-right: 18px;
	}

	body #CCB-calc #calc-footer[class*="CCB-calc-footer"] {
		padding: 10px 18px 16px;
	}
}

@media (max-width: 480px) {
	body #CCB-calc .form-group {
		flex-wrap: wrap;
		gap: 8px;
	}

	body #CCB-calc .control-label {
		flex: 1 1 100%;
		text-align: left;
	}
}

/* Initial hidden state. No !important - jQuery .show() writes an inline
   display over this class and has to be able to win. */

#CCB-calc .bmi-hidden {
	display: none;
}
