/* ==========================================================
   Tank Volume Calculator — Teal & Navy Theme
   ========================================================== */

.tvc-widget {
	--tvc-navy-deep: #0a1626;
	--tvc-navy: #0e1f36;
	--tvc-navy-card: #12263f;
	--tvc-navy-raised: #17304f;
	--tvc-border: #1d3855;
	--tvc-teal: #2dd4bf;
	--tvc-teal-dark: #14b8a6;
	--tvc-teal-soft: #7ee8d8;
	--tvc-teal-dim: rgba(45, 212, 191, 0.18);
	--tvc-text: #eaf6f3;
	--tvc-text-dim: #9db3c6;
	--tvc-gold: #ffd166;
	--tvc-error: #ff8a8a;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	max-width: 720px;
	margin: 0 auto;
}
.tvc-widget * {
	box-sizing: border-box;
}
.tvc-card {
	background: var(--tvc-navy-deep);
	border: 1px solid var(--tvc-border);
	border-radius: 18px;
	padding: 32px 28px 28px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.tvc-eyebrow {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--tvc-teal);
	text-align: center;
}
.tvc-title {
	margin: 0 0 20px;
	text-align: center;
	font-size: 26px;
	font-weight: 800;
	color: #ffffff;
}

/* ---------- Shape tabs ---------- */
.tvc-shapes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 10px;
	justify-content: center;
}
.tvc-shape-btn {
	padding: 9px 16px;
	font-size: 13px;
	font-weight: 700;
	color: var(--tvc-teal-soft);
	background: var(--tvc-navy-card);
	border: 1px solid var(--tvc-border);
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.15s ease;
}
.tvc-shape-btn:hover {
	border-color: var(--tvc-teal-dark);
}
.tvc-shape-btn--active {
	background: linear-gradient(135deg, var(--tvc-teal) 0%, var(--tvc-teal-dark) 100%);
	color: #04211c;
	border-color: transparent;
}
.tvc-shape-caption {
	margin: 0 0 20px;
	text-align: center;
	font-size: 12.5px;
	color: var(--tvc-text-dim);
	min-height: 1.4em;
}

/* ---------- Top row: unit + fill mode ---------- */
.tvc-toprow {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 18px;
	justify-content: center;
}

/* ---------- Fields ---------- */
.tvc-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 12px;
	margin-bottom: 6px;
}
.tvc-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
}
.tvc-field label {
	display: flex;
	align-items: center;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tvc-teal-soft);
}
.tvc-input {
	width: 100%;
	padding: 12px 13px;
	font-size: 15px;
	border-radius: 10px;
	border: 1px solid var(--tvc-border);
	background: #ffffff;
	color: #0e1f36;
}
select.tvc-input {
	padding: 9px 12px;
}
.tvc-input:focus {
	outline: 2px solid var(--tvc-teal);
	outline-offset: 1px;
}

/* ---------- Buttons ---------- */
.tvc-btn {
	cursor: pointer;
	border-radius: 10px;
	font-weight: 700;
	font-size: 14px;
	border: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.tvc-btn--primary {
	display: block;
	width: 100%;
	padding: 14px 18px;
	font-size: 15px;
	color: #04211c;
	background: linear-gradient(135deg, var(--tvc-teal) 0%, var(--tvc-teal-dark) 100%);
	margin-bottom: 22px;
}
.tvc-btn--primary:hover {
	box-shadow: 0 8px 24px rgba(45, 212, 191, 0.35);
	transform: translateY(-1px);
}
.tvc-btn--outline {
	padding: 11px 18px;
	background: transparent;
	color: var(--tvc-teal-soft);
	border: 1px solid var(--tvc-teal-dark);
}
.tvc-btn--outline:hover {
	background: var(--tvc-teal-dim);
}
.tvc-btn--text {
	padding: 11px 14px;
	background: transparent;
	color: var(--tvc-text-dim);
	border: 1px solid var(--tvc-border);
}
.tvc-btn--text:hover {
	color: var(--tvc-text);
	border-color: var(--tvc-teal-dark);
}

/* ---------- Error ---------- */
.tvc-error {
	display: none;
	font-size: 12.5px;
	color: var(--tvc-error);
	background: rgba(255, 122, 122, 0.08);
	border: 1px solid rgba(255, 122, 122, 0.35);
	border-radius: 10px;
	padding: 10px 13px;
	margin-bottom: 14px;
}
.tvc-error.tvc-visible {
	display: block;
}

/* ---------- Pill radio group (fill mode) ---------- */
.tvc-pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.tvc-pill-row--small .tvc-pill span {
	height: 2.15rem;
	font-size: 0.8rem;
}
.tvc-pill {
	position: relative;
	flex: 1;
	min-width: fit-content;
}
.tvc-pill input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}
.tvc-pill span {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 2.4rem;
	padding: 0 0.9rem;
	border-radius: 999px;
	background: var(--tvc-navy-card);
	border: 1px solid var(--tvc-border);
	color: var(--tvc-text-dim);
	font-weight: 600;
	font-size: 0.85rem;
	white-space: nowrap;
	transition: all 0.15s ease;
}
.tvc-pill input:hover + span {
	border-color: var(--tvc-teal-dark);
	color: var(--tvc-text);
}
.tvc-pill input:checked + span {
	background: linear-gradient(135deg, var(--tvc-teal-dim), var(--tvc-teal));
	border-color: var(--tvc-teal);
	color: #04211c;
	box-shadow: 0 0 0 3px var(--tvc-teal-dim);
}

/* ---------- Examples ---------- */
.tvc-examples {
	margin-bottom: 22px;
}
.tvc-examples-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tvc-text-dim);
	margin-bottom: 10px;
}
.tvc-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.tvc-pill-example {
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--tvc-teal-soft);
	background: var(--tvc-navy-card);
	border: 1px solid var(--tvc-border);
	border-radius: 999px;
	cursor: pointer;
}
.tvc-pill-example:hover {
	background: #163150;
}
.tvc-pill-example--active {
	background: #3a4148;
	color: #ffffff;
	border-color: #3a4148;
}

/* ---------- Result ---------- */
.tvc-result {
	background: var(--tvc-navy-card);
	border: 1px solid var(--tvc-border);
	border-radius: 14px;
	padding: 20px 20px 22px;
}
.tvc-result-highlight {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 12px;
}
.tvc-result-card {
	background: var(--tvc-navy);
	border: 1px solid var(--tvc-teal-dark);
	border-radius: 12px;
	padding: 14px 16px;
	text-align: center;
}
.tvc-result-label {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--tvc-text-dim);
	margin-bottom: 6px;
}
.tvc-result-value {
	font-size: 28px;
	font-weight: 800;
	color: var(--tvc-teal);
	font-variant-numeric: tabular-nums;
}
.tvc-result-value small {
	font-size: 14px;
	font-weight: 700;
	color: var(--tvc-teal-soft);
}
.tvc-result-secondary {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 14px;
	font-size: 12.5px;
	color: var(--tvc-text-dim);
	margin-bottom: 14px;
	font-variant-numeric: tabular-nums;
}
.tvc-result-secondary strong {
	color: var(--tvc-text);
}
.tvc-capacity-row {
	font-size: 13.5px;
	color: var(--tvc-text-dim);
	text-align: center;
	padding-bottom: 8px;
}
.tvc-capacity-row strong {
	color: var(--tvc-text);
}
.tvc-capacity-row--muted {
	padding-bottom: 16px;
	margin-bottom: 16px;
	border-bottom: 1px dashed var(--tvc-border);
}

/* ---------- Diagram ---------- */
.tvc-diagram-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 18px;
}
.tvc-diagram-wrap svg {
	max-width: 100%;
	height: auto;
}
.tvc-diagram-caption {
	margin-top: 6px;
	font-size: 12px;
	color: var(--tvc-text-dim);
	text-align: center;
}
.tvc-diagram-caption strong {
	color: var(--tvc-teal-soft);
}

/* ---------- Breakdown ---------- */
.tvc-breakdown-title {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tvc-text-dim);
	margin-bottom: 12px;
	text-align: center;
}
.tvc-formula {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.tvc-formula-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 14px;
	background: var(--tvc-navy);
	border: 1px solid var(--tvc-border);
	border-radius: 10px;
	min-width: 90px;
}
.tvc-formula-box--result {
	border-color: var(--tvc-teal);
}
.tvc-formula-tag {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tvc-text-dim);
}
.tvc-formula-num {
	font-size: 15px;
	font-weight: 700;
	color: var(--tvc-text);
	font-variant-numeric: tabular-nums;
}
.tvc-formula-box--result .tvc-formula-num {
	color: var(--tvc-teal);
}
.tvc-formula-op {
	font-size: 18px;
	font-weight: 700;
	color: var(--tvc-text-dim);
}
.tvc-explain {
	margin: 0 0 20px;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--tvc-text-dim);
	text-align: center;
}
.tvc-explain strong {
	color: var(--tvc-text);
}
.tvc-result-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

/* ---------- Tooltips ("?" badges) ---------- */
.tvc-tip {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 15px;
	height: 15px;
	margin-left: 5px;
	border-radius: 50%;
	background: var(--tvc-teal-soft);
	color: var(--tvc-teal-dark);
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	cursor: help;
	vertical-align: middle;
	border: 1px solid var(--tvc-teal-dark);
}
.tvc-tip:hover,
.tvc-tip:focus {
	background: var(--tvc-teal);
	color: #04211c;
	outline: none;
}
.tvc-tip-bubble {
	position: absolute;
	z-index: 30;
	bottom: calc(100% + 8px);
	left: 0;
	transform: translateY(4px);
	width: max-content;
	max-width: min(240px, 80vw);
	background: var(--tvc-navy-deep);
	color: var(--tvc-text);
	font-size: 11.5px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--tvc-border);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.12s ease, transform 0.12s ease;
	text-align: left;
	white-space: normal;
}
.tvc-tip.tvc-tip-align-right .tvc-tip-bubble {
	left: auto;
	right: 0;
}
.tvc-tip-bubble::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 10px;
	border: 6px solid transparent;
	border-top-color: var(--tvc-navy-deep);
}
.tvc-tip.tvc-tip-align-right .tvc-tip-bubble::after {
	left: auto;
	right: 10px;
}
.tvc-tip:hover .tvc-tip-bubble,
.tvc-tip:focus .tvc-tip-bubble,
.tvc-tip.tvc-tip-open .tvc-tip-bubble {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* ---------- History ---------- */
.tvc-history-panel {
	margin-top: 18px;
	background: var(--tvc-navy-card);
	border: 1px solid var(--tvc-border);
	border-radius: 14px;
	padding: 18px 18px 20px;
}
.tvc-history-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
}
.tvc-history-head h4 {
	margin: 0;
	font-size: 14px;
	color: var(--tvc-text);
}
.tvc-history-head-actions {
	display: flex;
	gap: 8px;
}
.tvc-history-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.tvc-history-item {
	display: block;
	width: 100%;
	text-align: left;
	background: var(--tvc-navy);
	border: 1px solid var(--tvc-border);
	border-radius: 10px;
	padding: 10px 14px;
	cursor: pointer;
	color: var(--tvc-text);
	transition: border-color 0.15s ease, background 0.15s ease;
}
.tvc-history-item:hover {
	border-color: var(--tvc-teal-dark);
	background: var(--tvc-navy-raised);
}
.tvc-history-item__top {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	font-size: 11.5px;
	color: var(--tvc-text-dim);
	margin-bottom: 4px;
}
.tvc-history-item__type {
	font-weight: 700;
	color: var(--tvc-teal-soft);
}
.tvc-history-item__summary {
	font-size: 12.5px;
	color: var(--tvc-text-dim);
	margin-bottom: 3px;
}
.tvc-history-item__result {
	font-size: 14px;
	font-weight: 700;
	color: var(--tvc-teal);
}
.tvc-history-empty {
	display: none;
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--tvc-text-dim);
	text-align: center;
}
.tvc-history-empty.tvc-visible {
	display: block;
}

@media (max-width: 480px) {
	.tvc-card { padding: 24px 18px 20px; }
	.tvc-title { font-size: 21px; }
	.tvc-formula { gap: 6px; }
	.tvc-formula-box { min-width: 72px; padding: 8px 10px; }
	.tvc-result-highlight { grid-template-columns: 1fr; }
	.tvc-result-value { font-size: 26px; }
}

/* The hidden attribute must always win over any component's own display:
   grid/flex rule (e.g. .tvc-fields sets display:grid, which — at equal
   CSS specificity — would otherwise cancel the browser's default
   [hidden]{display:none} and leave every shape's fields visible at once,
   the exact bug this rebuild fixes). */
.tvc-widget [hidden] {
	display: none !important;
}
