/**
 * Botey – Calculadora d'indemnització
 * @author Oriol Botey
 */

.bsjcalc {
	--bsj-navy: #1f3a5f;
	--bsj-navy-dark: #132741;
	--bsj-navy-soft: #e9eff6;
	--bsj-line: #d7e0ea;
	--bsj-text: #1e2a38;
	--bsj-muted: #5d6b7c;
	--bsj-accent: #b8925a;
	--bsj-bg: #ffffff;
	--bsj-radius: 14px;
	color: var(--bsj-text);
	max-width: 960px;
	margin: 0 auto 2.5rem;
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}
.bsjcalc *, .bsjcalc *::before, .bsjcalc *::after { box-sizing: border-box; }

/* Capçalera */
.bsjcalc-hero {
	background: linear-gradient(135deg, var(--bsj-navy) 0%, var(--bsj-navy-dark) 100%);
	color: #fff;
	border-radius: var(--bsj-radius) var(--bsj-radius) 0 0;
	padding: 2rem 2rem 1.75rem;
	position: relative;
	overflow: hidden;
}
.bsjcalc-hero::after {
	content: "";
	position: absolute;
	right: -60px; top: -60px;
	width: 220px; height: 220px;
	border: 2px solid rgba(255,255,255,.12);
	border-radius: 4px;
	transform: rotate(18deg);
}
.bsjcalc-eyebrow {
	display: inline-block;
	font-size: .75rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--bsj-accent);
	font-weight: 600;
	margin-bottom: .5rem;
}
.bsjcalc .bsjcalc-title {
	color: #fff;
	font-size: clamp(1.35rem, 2.6vw, 1.85rem);
	line-height: 1.25;
	margin: 0 0 .5rem;
	padding: 0;
	border: 0;
	background: none;
}
.bsjcalc .bsjcalc-title::before, .bsjcalc .bsjcalc-title::after { display: none; }
.bsjcalc-lead { margin: 0; opacity: .85; max-width: 46ch; }

/* Formulari */
.bsjcalc-form {
	background: var(--bsj-bg);
	border: 1px solid var(--bsj-line);
	border-top: 0;
	border-radius: 0 0 var(--bsj-radius) var(--bsj-radius);
	padding: 1.75rem 2rem 2rem;
	box-shadow: 0 10px 30px -18px rgba(19,39,65,.35);
}
.bsjcalc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.bsjcalc-field { margin: 0 0 1.25rem; border: 0; padding: 0; min-width: 0; }
.bsjcalc-field label, .bsjcalc-field legend {
	display: block;
	font-weight: 600;
	font-size: .9rem;
	margin-bottom: .45rem;
	padding: 0;
}
.bsjcalc-field abbr { color: #b3261e; text-decoration: none; border: 0; }
.bsjcalc input[type="date"], .bsjcalc input[type="text"] {
	width: 100%;
	height: 48px;
	padding: 0 .9rem;
	border: 1.5px solid var(--bsj-line);
	border-radius: 10px;
	font-size: 1rem;
	color: var(--bsj-text);
	background: #fbfcfe;
	transition: border-color .15s, box-shadow .15s;
	margin: 0;
}
.bsjcalc input:focus {
	outline: none;
	border-color: var(--bsj-navy);
	box-shadow: 0 0 0 4px rgba(31,58,95,.12);
	background: #fff;
}
.bsjcalc-money { position: relative; max-width: 320px; }
.bsjcalc-money input { padding-right: 2.5rem !important; font-variant-numeric: tabular-nums; }
.bsjcalc-money span { position: absolute; right: .95rem; top: 50%; transform: translateY(-50%); color: var(--bsj-muted); font-weight: 600; }
.bsjcalc-help { font-size: .82rem; color: var(--bsj-muted); margin: .4rem 0 0; }

/* Selector segmentat */
.bsjcalc-seg {
	display: inline-flex;
	background: var(--bsj-navy-soft);
	border-radius: 999px;
	padding: 4px;
	gap: 2px;
}
.bsjcalc-seg label { margin: 0; cursor: pointer; font-weight: 500; }
.bsjcalc-seg input { position: absolute; opacity: 0; pointer-events: none; }
.bsjcalc-seg span {
	display: block;
	padding: .5rem 1.15rem;
	border-radius: 999px;
	color: var(--bsj-navy);
	transition: background .15s, color .15s;
	font-size: .92rem;
}
.bsjcalc-seg input:checked + span { background: var(--bsj-navy); color: #fff; box-shadow: 0 2px 6px rgba(19,39,65,.25); }
.bsjcalc-seg input:focus-visible + span { outline: 2px solid var(--bsj-accent); outline-offset: 2px; }

.bsjcalc-error {
	background: #fdecea;
	color: #8a1c14;
	border-left: 4px solid #b3261e;
	padding: .75rem 1rem;
	border-radius: 8px;
	margin-bottom: 1.25rem;
	font-size: .92rem;
}

/* Botons */
.bsjcalc-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.bsjcalc .bsjcalc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 1.5rem;
	border-radius: 10px;
	font-weight: 600;
	font-size: .98rem;
	cursor: pointer;
	text-decoration: none;
	border: 1.5px solid var(--bsj-navy);
	transition: background .15s, color .15s, transform .1s;
	line-height: 1;
}
.bsjcalc .bsjcalc-btn:active { transform: translateY(1px); }
.bsjcalc .bsjcalc-btn-primary { background: var(--bsj-navy); color: #fff; }
.bsjcalc .bsjcalc-btn-primary:hover { background: var(--bsj-navy-dark); color: #fff; }
.bsjcalc .bsjcalc-btn-ghost { background: transparent; color: var(--bsj-navy); }
.bsjcalc .bsjcalc-btn-ghost:hover { background: var(--bsj-navy-soft); color: var(--bsj-navy); }

/* Resultat */
.bsjcalc-result {
	margin-top: 2rem;
	background: #fff;
	border: 1px solid var(--bsj-line);
	border-radius: var(--bsj-radius);
	padding: 2rem;
	box-shadow: 0 10px 30px -18px rgba(19,39,65,.35);
	scroll-margin-top: 90px;
}
.bsjcalc-result.is-in { animation: bsjcalc-in .45s ease-out; }
@keyframes bsjcalc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.bsjcalc-print-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding-bottom: 1.25rem;
	margin-bottom: 1.5rem;
	border-bottom: 2px solid var(--bsj-navy);
}
.bsjcalc-logo { width: 200px; max-width: 45%; height: auto; display: block; }
.bsjcalc-print-meta { text-align: right; font-size: .85rem; color: var(--bsj-muted); }
.bsjcalc-print-meta strong { display: block; color: var(--bsj-navy); font-size: .95rem; }

.bsjcalc-summary {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1px;
	background: var(--bsj-line);
	border: 1px solid var(--bsj-line);
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 1.5rem;
}
.bsjcalc-summary > div { background: #fafcfe; padding: .85rem 1rem; }
.bsjcalc-summary span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bsj-muted); margin-bottom: .2rem; }
.bsjcalc-summary strong { display: block; font-size: .98rem; color: var(--bsj-text); font-variant-numeric: tabular-nums; }
.bsjcalc-summary em { display: block; font-style: normal; font-size: .8rem; color: var(--bsj-muted); margin-top: .15rem; }

.bsjcalc-cards { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1rem; margin-bottom: 1.75rem; }
.bsjcalc-card {
	border: 1.5px solid var(--bsj-line);
	border-radius: 12px;
	padding: 1.15rem 1.2rem;
	display: flex;
	flex-direction: column;
	gap: .35rem;
	background: #fff;
}
.bsjcalc-card.is-main {
	background: linear-gradient(135deg, var(--bsj-navy) 0%, var(--bsj-navy-dark) 100%);
	border-color: var(--bsj-navy);
	color: #fff;
}
.bsjcalc-card-label { font-size: .85rem; font-weight: 600; }
.bsjcalc-card-amount { font-size: 1.65rem; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--bsj-navy); }
.bsjcalc-card.is-main .bsjcalc-card-amount { color: #fff; font-size: 2rem; }
.bsjcalc-card-rule { font-size: .78rem; color: var(--bsj-muted); }
.bsjcalc-card.is-main .bsjcalc-card-rule { color: rgba(255,255,255,.75); }

.bsjcalc-badge {
	display: inline-block;
	align-self: flex-start;
	background: #fff4e5;
	color: #8a5a12;
	border: 1px solid #f0d3a6;
	border-radius: 999px;
	font-size: .7rem;
	font-weight: 600;
	padding: .1rem .55rem;
	white-space: nowrap;
}
.bsjcalc-card.is-main .bsjcalc-badge { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }

.bsjcalc h4 { font-size: 1rem; color: var(--bsj-navy); margin: 0 0 .75rem; padding: 0; border: 0; background: none; }
.bsjcalc h4::before, .bsjcalc h4::after { display: none; }

.bsjcalc table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 0; border: 0; }
.bsjcalc th, .bsjcalc td { padding: .7rem .75rem; border: 0; border-bottom: 1px solid var(--bsj-line); text-align: left; vertical-align: top; background: none; }
.bsjcalc thead th { background: var(--bsj-navy-soft); color: var(--bsj-navy); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.bsjcalc td small { display: block; color: var(--bsj-muted); font-size: .78rem; margin-top: .1rem; }
.bsjcalc .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bsjcalc tr.is-hl td { background: #f6f9fc; }

.bsjcalc-breakdown, .bsjcalc-table-wrap { margin-bottom: 1.5rem; }
.bsjcalc-note { font-size: .85rem; color: var(--bsj-muted); margin: .6rem 0 0; }
.bsjcalc-footnote { font-size: .8rem; color: var(--bsj-muted); margin: 0 0 1.25rem; }

.bsjcalc-disclaimer {
	background: var(--bsj-navy-soft);
	border-left: 4px solid var(--bsj-navy);
	border-radius: 8px;
	padding: .9rem 1.1rem;
	font-size: .88rem;
	margin-bottom: 1.5rem;
}
.bsjcalc-contact-line { display: block; margin-top: .35rem; color: var(--bsj-navy); font-weight: 600; }

/* Responsive */
@media (max-width: 760px) {
	.bsjcalc-hero, .bsjcalc-form, .bsjcalc-result { padding-left: 1.15rem; padding-right: 1.15rem; }
	.bsjcalc-grid, .bsjcalc-cards { grid-template-columns: 1fr; }
	.bsjcalc-summary { grid-template-columns: 1fr 1fr; }
	.bsjcalc-print-head { flex-direction: column; align-items: flex-start; }
	.bsjcalc-print-meta { text-align: left; }
	.bsjcalc-logo { max-width: 70%; }
	.bsjcalc-table thead { display: none; }
	.bsjcalc-table tr { display: block; border-bottom: 1px solid var(--bsj-line); padding: .5rem 0; }
	.bsjcalc-table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem .25rem; text-align: right; }
	.bsjcalc-table td::before { content: attr(data-th); font-weight: 600; color: var(--bsj-muted); text-align: left; font-size: .78rem; text-transform: uppercase; }
	.bsjcalc-table td:first-child { display: block; text-align: left; }
	.bsjcalc-table td:first-child::before { display: none; }
	.bsjcalc-table td.bsjcalc-c-rule { display: block; text-align: left; color: var(--bsj-muted); font-size: .85rem; }
	.bsjcalc-table td.bsjcalc-c-rule::before { display: none; }
	.bsjcalc-actions .bsjcalc-btn { flex: 1 1 100%; }
}

/* Enllaç creuat entre calculadores */
.bsjcalc .bsjcalc-crosslink {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-top: 1.5rem;
	padding: 1.1rem 1.3rem;
	border: 1.5px solid var(--bsj-line);
	border-radius: var(--bsj-radius);
	background: linear-gradient(135deg, #f7f1e8, #fff);
	color: var(--bsj-text);
	text-decoration: none;
	transition: transform .15s, box-shadow .15s;
}
.bsjcalc .bsjcalc-crosslink:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -20px rgba(19,39,65,.5); color: var(--bsj-text); }
.bsjcalc-crosslink-ico { flex: none; width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--bsj-navy); color: #fff; font-weight: 800; font-size: 1.2rem; }
.bsjcalc-crosslink-text { flex: 1; }
.bsjcalc-crosslink-text strong { display: block; color: var(--bsj-navy); }
.bsjcalc-crosslink-text span { font-size: .9rem; color: var(--bsj-muted); }
.bsjcalc-crosslink-arrow { font-size: 1.4rem; color: var(--bsj-accent); font-weight: 700; }

@media print { .bsjcalc-crosslink { display: none !important; } }

.bsjcalc-print-root { display: none; }

/* Impressió / PDF: només el resultat */
@media print {
	@page { size: A4; margin: 14mm 12mm; }
	html.bsjcalc-printing body > *:not(.bsjcalc-print-root) { display: none !important; }
	html.bsjcalc-printing body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
	html.bsjcalc-printing .bsjcalc-print-root { display: block !important; }
	.bsjcalc-print-root .bsjcalc { max-width: none; margin: 0; }
	.bsjcalc-print-root .bsjcalc-result {
		margin: 0 !important;
		border: 0 !important;
		box-shadow: none !important;
		padding: 0 !important;
		animation: none !important;
	}
	.bsjcalc { font-size: 11pt; }
	.bsjcalc-noprint { display: none !important; }
	.bsjcalc-result { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.bsjcalc-cards { grid-template-columns: 1.3fr 1fr 1fr !important; }
	.bsjcalc-summary { grid-template-columns: repeat(4, 1fr) !important; }
	.bsjcalc-print-head { flex-direction: row !important; align-items: center !important; }
	.bsjcalc-print-meta { text-align: right !important; }
	.bsjcalc-logo { width: 170px !important; max-width: 170px !important; }
	.bsjcalc-table thead { display: table-header-group !important; }
	.bsjcalc-table tr { display: table-row !important; page-break-inside: avoid; }
	.bsjcalc-table td { display: table-cell !important; text-align: left; padding: .45rem .5rem !important; border-bottom: 1px solid #d7e0ea !important; }
	.bsjcalc-table td.num { text-align: right !important; }
	.bsjcalc-table td::before { display: none !important; }
	.bsjcalc-disclaimer { page-break-inside: avoid; }
}
