/* Work Hours Calculator - front-end styles */

.whc-calculator {
	--whc-primary: #4f46e5;
	--whc-primary-dark: #4338ca;
	--whc-primary-light: #eef2ff;
	--whc-primary-border: #c7d2fe;
	--whc-danger: #ef4444;
	--whc-danger-bg: #fee2e2;
	--whc-text: #1f2937;
	--whc-text-light: #6b7280;
	--whc-border: #e5e7eb;
	--whc-bg: #ffffff;
	--whc-bg-alt: #f9fafb;

	max-width: 900px;
	margin: 1.5em 0;
	padding: 24px;
	box-sizing: border-box;
	background: var(--whc-bg);
	border: 1px solid var(--whc-border);
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--whc-text) !important;
}

.whc-calculator * {
	box-sizing: border-box;
}

.whc-calculator h3,
.whc-calculator p,
.whc-calculator span,
.whc-calculator label,
.whc-calculator td,
.whc-calculator th,
.whc-calculator button,
.whc-calculator input {
	color: var(--whc-text);
	font-family: inherit;
	line-height: 1.5;
}

/* ---------- Header ---------- */

.whc-header {
	margin: 0 0 18px;
}

.whc-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 6px;
	font-size: 1.25em;
	font-weight: 700 !important;
	color: var(--whc-text) !important;
}

.whc-title-icon {
	color: var(--whc-primary);
	flex-shrink: 0;
}

.whc-subtitle {
	margin: 0;
	font-size: 0.9em;
	color: var(--whc-text-light) !important;
}

/* ---------- Controls bar ---------- */

.whc-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
	background: var(--whc-bg-alt);
	border: 1px solid var(--whc-border);
	border-radius: 10px;
	padding: 14px 18px;
	margin-bottom: 20px;
}

.whc-control-group {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	cursor: pointer;
}

.whc-control-label {
	font-weight: 600 !important;
	font-size: 0.92em;
	color: var(--whc-text) !important;
	white-space: nowrap;
}

/* Hourly rate input with currency affix */

.whc-input-with-affix {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--whc-border);
	border-radius: 6px;
	overflow: hidden;
	background: var(--whc-bg);
}

.whc-currency-affix {
	display: flex;
	align-items: center;
	padding: 0 10px;
	background: #eef0f3;
	color: var(--whc-text-light) !important;
	font-weight: 600;
	font-size: 0.95em;
}

.whc-currency-affix.is-prefix {
	border-right: 1px solid var(--whc-border);
}

.whc-currency-affix.is-suffix {
	border-left: 1px solid var(--whc-border);
}

.whc-input-with-affix .whc-hourly-rate {
	border: none;
	width: 90px;
	padding: 9px 10px;
	font-size: 0.95em;
	background: transparent;
}

.whc-input-with-affix .whc-hourly-rate:focus {
	outline: 2px solid var(--whc-primary);
	outline-offset: -2px;
}

/* Toggle switch */

.whc-toggle-group {
	user-select: none;
}

.whc-toggle {
	position: relative;
	display: inline-block;
	width: 42px;
	height: 24px;
	flex-shrink: 0;
}

.whc-toggle .whc-enable-ot {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.whc-toggle-slider {
	position: absolute;
	inset: 0;
	background: #cbd5e1;
	border-radius: 24px;
	transition: background-color 0.2s ease;
}

.whc-toggle-slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.whc-toggle .whc-enable-ot:checked + .whc-toggle-slider {
	background: var(--whc-primary);
}

.whc-toggle .whc-enable-ot:checked + .whc-toggle-slider::before {
	transform: translateX(18px);
}

.whc-toggle .whc-enable-ot:focus-visible + .whc-toggle-slider {
	outline: 2px solid var(--whc-primary);
	outline-offset: 2px;
}

/* ---------- Table ---------- */

.whc-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--whc-border);
	border-radius: 10px;
	margin-bottom: 0;
}

.whc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.93em;
}

.whc-table thead th {
	background: var(--whc-primary);
	color: #ffffff !important;
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.76em;
	letter-spacing: 0.05em;
	padding: 12px 10px;
	text-align: center;
	border: none;
	white-space: nowrap;
}

.whc-table thead th:first-child {
	border-top-left-radius: 9px;
}

.whc-table thead th:last-child {
	border-top-right-radius: 9px;
}

.whc-table tbody tr:nth-child(even) {
	background: var(--whc-bg-alt);
}

.whc-table tbody tr:hover {
	background: var(--whc-primary-light);
}

.whc-table td {
	padding: 10px;
	text-align: center;
	border-bottom: 1px solid var(--whc-border);
	vertical-align: middle;
}

.whc-table input {
	width: 100%;
	padding: 7px 8px;
	border: 1px solid var(--whc-border);
	border-radius: 6px;
	font-size: 0.95em;
	background: var(--whc-bg);
	color: var(--whc-text);
}

.whc-table input:focus {
	outline: 2px solid var(--whc-primary);
	outline-offset: -1px;
	border-color: var(--whc-primary);
}

.whc-table input.whc-break {
	width: 64px;
	margin: 0 auto;
	text-align: center;
}

.whc-hours {
	font-weight: 600 !important;
	white-space: nowrap;
}

.whc-pay {
	font-weight: 700 !important;
	color: var(--whc-primary-dark) !important;
	white-space: nowrap;
}

.whc-action-col {
	width: 44px;
}

.whc-remove-row {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: none;
	border-radius: 8px;
	background: var(--whc-danger-bg);
	color: var(--whc-danger) !important;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.whc-remove-row:hover {
	background: var(--whc-danger);
	color: #ffffff !important;
}

/* ---------- Footer / totals ---------- */

.whc-table tfoot td {
	border-bottom: none;
}

.whc-totals-row td {
	background: var(--whc-bg-alt);
	border-top: 2px solid var(--whc-border);
	padding: 14px 10px;
	font-weight: 700 !important;
}

.whc-add-row-cell {
	text-align: left !important;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.whc-total-hours,
.whc-total-pay {
	font-size: 1.05em;
	white-space: nowrap;
}

.whc-total-pay {
	color: var(--whc-primary-dark) !important;
}

.whc-summary-row td {
	background: var(--whc-bg-alt);
	font-weight: 500 !important;
	font-size: 0.85em;
	color: var(--whc-text-light) !important;
	padding: 0 10px 14px;
}

.whc-summary-row td:first-child {
	text-align: left;
}

.whc-ot-summary {
	font-weight: 600 !important;
	white-space: nowrap;
}

/* ---------- Buttons ---------- */

.whc-add-row,
.whc-reset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 9px 16px;
	font-size: 0.88em;
	font-weight: 600 !important;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
	white-space: nowrap;
}

.whc-add-row {
	background: var(--whc-primary);
	color: #ffffff !important;
}

.whc-add-row:hover {
	background: var(--whc-primary-dark);
}

.whc-reset {
	background: var(--whc-bg);
	color: var(--whc-text-light) !important;
	border-color: var(--whc-border);
}

.whc-reset:hover {
	background: var(--whc-bg-alt);
	color: var(--whc-text) !important;
}

.whc-add-row:active,
.whc-reset:active {
	transform: scale(0.98);
}

/* ---------- Tip note ---------- */

.whc-note {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	background: var(--whc-primary-light);
	border: 1px solid var(--whc-primary-border);
	border-radius: 8px;
	padding: 10px 14px;
	margin: 16px 0 0;
	font-size: 0.85em !important;
	color: #3730a3 !important;
}

.whc-note-icon {
	flex-shrink: 0;
	margin-top: 2px;
	color: #4338ca;
}

/* ---------- Responsive stacked layout ---------- */

@media (max-width: 680px) {
	.whc-calculator {
		padding: 16px;
	}

	.whc-controls {
		flex-direction: column;
		align-items: stretch;
	}

	.whc-control-group {
		justify-content: space-between;
	}

	.whc-table thead {
		display: none;
	}

	.whc-table,
	.whc-table tbody,
	.whc-table tfoot,
	.whc-table tr,
	.whc-table td {
		display: block;
		width: 100%;
	}

	.whc-table tbody tr,
	.whc-table tfoot tr {
		border: 1px solid var(--whc-border);
		border-radius: 8px;
		margin-bottom: 10px;
		overflow: hidden;
	}

	.whc-table tbody tr:last-child,
	.whc-table tfoot tr:last-child {
		margin-bottom: 0;
	}

	.whc-table td {
		border: none;
		border-bottom: 1px solid var(--whc-border);
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.75em;
		text-align: right;
		padding: 10px 12px;
	}

	.whc-table td:last-child {
		border-bottom: none;
	}

	.whc-table td[data-label]:not([data-label=""])::before {
		content: attr(data-label);
		font-weight: 600;
		text-align: left;
		flex: 1 0 auto;
		color: var(--whc-text-light);
		font-size: 0.85em;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}

	.whc-table td.whc-action-col {
		justify-content: flex-end;
	}

	.whc-table input {
		flex: 1 1 auto;
		max-width: 60%;
	}

	.whc-add-row-cell {
		justify-content: flex-start;
	}

	.whc-summary-row td:first-child::before {
		content: none;
	}
}
