/**
 * HisabCalc — front-end styles.
 * Everything is scoped under .hisabcalc so it plays nicely with any theme.
 *
 * @package HisabCalc
 */

.hisabcalc {
	--hisabcalc-accent: #0f766e;
	--hisabcalc-accent-soft: rgba(15, 118, 110, 0.1);
	--hisabcalc-border: #dfe6e3;
	--hisabcalc-text: #16281f;
	--hisabcalc-muted: #667a72;
	--hisabcalc-surface: #ffffff;
	--hisabcalc-surface-alt: #f6faf8;
	--hisabcalc-radius: 14px;

	box-sizing: border-box;
	max-width: 720px;
	margin: 1.75rem auto;
	background: var(--hisabcalc-surface);
	border: 1px solid var(--hisabcalc-border);
	border-radius: var(--hisabcalc-radius);
	box-shadow: 0 6px 24px rgba(16, 40, 32, 0.07);
	color: var(--hisabcalc-text);
	font-size: 16px;
	line-height: 1.55;
	overflow: hidden;
}

.hisabcalc *,
.hisabcalc *::before,
.hisabcalc *::after {
	box-sizing: border-box;
}

.hisabcalc__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.15rem 0.6rem;
	padding: 1.1rem 1.25rem;
	background: var(--hisabcalc-surface-alt);
	border-bottom: 1px solid var(--hisabcalc-border);
}

.hisabcalc__icon {
	font-size: 1.5rem;
	line-height: 1;
}

.hisabcalc__title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	width: 100%;
}

.hisabcalc__tagline {
	margin: 0.15rem 0 0;
	font-size: 0.9rem;
	color: var(--hisabcalc-muted);
	width: 100%;
}

.hisabcalc__body {
	padding: 1.25rem;
}

.hisabcalc__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.9rem;
}

@media (min-width: 620px) {
	.hisabcalc__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* A drop-down carries longer text than a number box, so it always takes the
   whole row instead of being squeezed into one half of the grid. */
.hisabcalc__field--select {
	grid-column: 1 / -1;
}

.hisabcalc__field {
	min-width: 0;
}

.hisabcalc__label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--hisabcalc-muted);
}

.hisabcalc__control {
	position: relative;
	display: flex;
	align-items: center;
}

.hisabcalc__input {
	width: 100%;
	padding: 0.65rem 0.75rem;
	font-size: 1rem;
	font-family: inherit;
	color: inherit;
	background: #fff;
	border: 1.5px solid var(--hisabcalc-border);
	border-radius: 10px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

select.hisabcalc__input {
	padding-right: 2rem;
	background-image: linear-gradient(45deg, transparent 50%, var(--hisabcalc-muted) 50%),
		linear-gradient(135deg, var(--hisabcalc-muted) 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
}

.hisabcalc__input:focus {
	outline: none;
	border-color: var(--hisabcalc-accent);
	box-shadow: 0 0 0 3px var(--hisabcalc-accent-soft);
}

.hisabcalc__control--prefix .hisabcalc__input {
	padding-left: 2.3rem;
}

/* Currency symbol sits on the left, the way it is written in Bangladesh. */
.hisabcalc__control--prefix .hisabcalc__unit {
	left: 0.85rem;
	right: auto;
}

.hisabcalc__unit {
	position: absolute;
	right: 0.75rem;
	font-size: 0.9rem;
	color: var(--hisabcalc-muted);
	pointer-events: none;
}

.hisabcalc__help {
	margin: 0.3rem 0 0;
	font-size: 0.78rem;
	color: var(--hisabcalc-muted);
}

.hisabcalc__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1.1rem;
}

.hisabcalc__go,
.hisabcalc__reset {
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	border-radius: 10px;
	padding: 0.7rem 1.15rem;
	border: 1.5px solid transparent;
	transition: transform 0.06s ease, background 0.15s ease;
}

.hisabcalc__go {
	flex: 1 1 auto;
	color: #fff;
	background: var(--hisabcalc-accent);
}

.hisabcalc__go:hover {
	filter: brightness(1.07);
}

.hisabcalc__go:active {
	transform: translateY(1px);
}

.hisabcalc__reset {
	background: transparent;
	color: var(--hisabcalc-muted);
	border-color: var(--hisabcalc-border);
}

.hisabcalc__reset:hover {
	color: var(--hisabcalc-text);
	border-color: var(--hisabcalc-muted);
}

.hisabcalc__results {
	margin-top: 1.15rem;
	background: var(--hisabcalc-surface-alt);
	border: 1px solid var(--hisabcalc-border);
	border-radius: 12px;
	padding: 0.5rem 1rem;
}

.hisabcalc__row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.35rem 1rem;
	padding: 0.55rem 0;
	border-bottom: 1px dashed var(--hisabcalc-border);
}

.hisabcalc__row:last-child {
	border-bottom: 0;
}

.hisabcalc__rowlabel {
	font-size: 0.9rem;
	color: var(--hisabcalc-muted);
}

.hisabcalc__rowvalue {
	font-weight: 700;
	margin-left: auto;
	text-align: right;
}

.hisabcalc__rowvalue--muted {
	font-weight: 500;
	color: var(--hisabcalc-muted);
}

.hisabcalc__row--hero {
	border-bottom: 1px solid var(--hisabcalc-border);
}

.hisabcalc__row--hero .hisabcalc__rowvalue {
	font-size: 1.5rem;
	color: var(--hisabcalc-accent);
	line-height: 1.2;
}

.hisabcalc__meter {
	margin: 0.9rem 0 0.35rem;
}

.hisabcalc__meterbar {
	position: relative;
	height: 10px;
	border-radius: 999px;
	background: linear-gradient(90deg, #60a5fa 0%, #34d399 32%, #fbbf24 62%, #f87171 100%);
}

.hisabcalc__meterdot {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin-left: -8px;
	transform: translateY(-50%);
	background: #fff;
	border: 3px solid var(--hisabcalc-accent);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
	transition: left 0.25s ease;
}

.hisabcalc__meterscale {
	display: flex;
	justify-content: space-between;
	font-size: 0.72rem;
	color: var(--hisabcalc-muted);
	margin-top: 0.25rem;
}

.hisabcalc__extra {
	margin-top: 1rem;
}

.hisabcalc__details {
	border: 1px solid var(--hisabcalc-border);
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

.hisabcalc__details summary {
	cursor: pointer;
	padding: 0.65rem 0.9rem;
	font-size: 0.9rem;
	font-weight: 600;
	background: var(--hisabcalc-surface-alt);
}

.hisabcalc__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.86rem;
}

.hisabcalc__table th,
.hisabcalc__table td {
	padding: 0.45rem 0.6rem;
	text-align: right;
	border-bottom: 1px solid var(--hisabcalc-border);
	white-space: nowrap;
}

.hisabcalc__table th:first-child,
.hisabcalc__table td:first-child {
	text-align: left;
}

.hisabcalc__table th {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--hisabcalc-muted);
}

.hisabcalc__table tbody tr:last-child td {
	border-bottom: 0;
}

.hisabcalc__note {
	margin: 1rem 0 0;
	font-size: 0.8rem;
	color: var(--hisabcalc-muted);
}

.hisabcalc__credit {
	margin: 0.5rem 0 0;
	font-size: 0.72rem;
	color: var(--hisabcalc-muted);
	text-align: right;
}

.hisabcalc__credit a {
	color: inherit;
	text-decoration: underline;
}

.hisabcalc-error {
	color: #b91c1c;
	font-weight: 600;
}

/* Respect dark themes without fighting them. */
@media (prefers-color-scheme: dark) {
	.hisabcalc {
		--hisabcalc-border: #2c3b36;
		--hisabcalc-text: #e8f1ed;
		--hisabcalc-muted: #9bb0a8;
		--hisabcalc-surface: #16211d;
		--hisabcalc-surface-alt: #1d2a25;
		box-shadow: none;
	}

	.hisabcalc__input {
		background: #111a17;
		color: var(--hisabcalc-text);
	}

	.hisabcalc__details,
	.hisabcalc__details summary {
		background: #111a17;
	}
}
