/**
 * Worked Hours Calculator - Frontend Styles
 * Mobile-first, accessible design
 *
 * @package WHC
 */

.whc-tool *,
.whc-tool *::before,
.whc-tool *::after {
	box-sizing: border-box;
}

/* Base styles */
.whc-tool {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 16px;
	line-height: 1.6;
	color: #333;
	background: #fff;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	width: 100%;
	max-width: 100%;
	margin: 20px 0;
	box-sizing: border-box;
	overflow-x: hidden;
}

/* Header */
.whc-header {
	margin-bottom: 24px;
	text-align: center;
}

.whc-title {
	font-size: 24px;
	font-weight: 700;
	margin: 0 0 12px 0;
	color: #1a1a1a;
}

.whc-microcopy {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 12px;
}

.whc-microcopy p {
	margin: 0;
	font-size: 14px;
	color: #666;
	font-weight: 500;
}

/* Controls */
.whc-controls {
	margin-bottom: 24px;
	padding: 16px;
	background: #f8f9fa;
	border-radius: 6px;
}

.whc-toggle-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}

.whc-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.whc-toggle-input {
	width: 40px;
	height: 20px;
	cursor: pointer;
}

.whc-toggle-label {
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
}

.whc-pay-settings {
	margin-top: 16px;
}

.whc-label {
	display: block;
	font-weight: 500;
	margin-bottom: 8px;
	font-size: 15px;
}

/* Inputs */
.whc-input {
	width: 100%;
	padding: 10px 8px;
	font-size: 14px;
	border: 2px solid #ddd;
	border-radius: 4px;
	background: #fff;
	transition: border-color 0.2s;
	box-sizing: border-box;
	max-width: 100%;
}

.whc-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.whc-input.whc-error {
	border-color: #d63638;
}

/* Break input wrapper */
.whc-break-cell {
	position: relative;
	min-width: 140px;
}

.whc-break-input-wrapper {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.whc-break-input-wrapper .whc-input {
	margin-bottom: 0;
}

.whc-break-presets {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	margin-top: 4px;
}

.whc-break-preset {
	padding: 6px 4px;
	font-size: 11px;
	font-weight: 600;
	border: 1px solid #0073aa;
	border-radius: 4px;
	background: #fff;
	color: #0073aa;
	cursor: pointer;
	transition: all 0.15s ease;
	text-align: center;
	min-width: 0;
	white-space: nowrap;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.whc-break-preset:hover {
	background: #0073aa;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.whc-break-preset:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(0, 115, 170, 0.1);
}

.whc-break-clear {
	grid-column: 1 / -1;
	background: #fff3cd;
	border-color: #ffc107;
	color: #856404;
	font-weight: 700;
	padding: 8px;
	margin-top: 2px;
	-webkit-tap-highlight-color: transparent;
}

.whc-break-clear:focus {
	outline: 2px solid #ffc107;
	outline-offset: 2px;
}

.whc-break-clear:hover {
	background: #ffc107;
	color: #000;
	border-color: #ffc107;
}

/* Week table */
.whc-week-table-wrapper {
	margin-bottom: 24px;
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.whc-week-table {
	width: 100%;
	min-width: 700px;
	border-collapse: collapse;
	table-layout: auto;
}

.whc-week-table thead {
	background: #f0f0f0;
}

.whc-week-table th {
	padding: 10px 6px;
	text-align: left;
	font-weight: 600;
	font-size: 13px;
	border-bottom: 2px solid #ddd;
	white-space: nowrap;
}

.whc-week-table td {
	padding: 10px 6px;
	border-bottom: 1px solid #eee;
	vertical-align: middle;
}

.whc-day-label {
	font-weight: 600;
	white-space: nowrap;
}

.whc-day-total {
	font-weight: 600;
	color: #0073aa;
}

.whc-btn-remove {
	background: #d63638;
	color: #fff;
	border: none;
	border-radius: 4px;
	width: 28px;
	height: 28px;
	font-size: 18px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	flex-shrink: 0;
}

.whc-btn-remove:hover,
.whc-btn-remove:focus {
	background: #b32d2e;
	outline: none;
	box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.2);
}

/* Checkboxes */
.whc-checkbox-label {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	white-space: nowrap;
}

.whc-checkbox {
	width: 18px;
	height: 18px;
	cursor: pointer;
	flex-shrink: 0;
}

.whc-checkbox-text {
	font-size: 12px;
	white-space: nowrap;
}

/* Buttons */
.whc-btn {
	padding: 12px 24px;
	font-size: 16px;
	font-weight: 600;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s;
	display: inline-block;
	text-align: center;
}

.whc-btn-primary {
	background: #0073aa;
	color: #fff;
}

.whc-btn-primary:hover,
.whc-btn-primary:focus {
	background: #005a87;
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

.whc-btn-secondary {
	background: #f0f0f0;
	color: #333;
}

.whc-btn-secondary:hover,
.whc-btn-secondary:focus {
	background: #e0e0e0;
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.whc-btn-add-day {
	background: #00a32a;
	color: #fff;
	margin-top: 12px;
}

.whc-btn-add-day:hover,
.whc-btn-add-day:focus {
	background: #008a20;
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 163, 42, 0.3);
}

/* Results */
.whc-results {
	margin-bottom: 24px;
}

.whc-daily-results,
.whc-weekly-results {
	margin-bottom: 20px;
}

.whc-results h3 {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 12px 0;
	color: #1a1a1a;
}

.whc-result-card {
	background: #f8f9fa;
	padding: 16px;
	border-radius: 6px;
	border-left: 4px solid #0073aa;
}

.whc-result-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #e0e0e0;
}

.whc-result-item:last-child {
	border-bottom: none;
}

.whc-result-label {
	font-weight: 500;
	color: #666;
}

.whc-result-value {
	font-weight: 700;
	font-size: 18px;
	color: #0073aa;
}

/* Errors */
.whc-errors {
	margin-top: 16px;
}

.whc-error-message {
	background: #fcf0f1;
	color: #d63638;
	padding: 12px;
	border-radius: 4px;
	border-left: 4px solid #d63638;
	margin-bottom: 8px;
	font-size: 14px;
}

.whc-row-error {
	background: #fcf0f1;
	color: #d63638;
	padding: 6px 8px;
	border-radius: 3px;
	font-size: 12px;
	margin-top: 4px;
	display: block;
}

/* FAQ placeholder */
.whc-faq-placeholder {
	margin-top: 32px;
	padding-top: 32px;
	border-top: 1px solid #eee;
}

/* Dark theme */
.whc-theme-dark {
	background: #1e1e1e;
	color: #e0e0e0;
}

.whc-theme-dark .whc-title {
	color: #fff;
}

.whc-theme-dark .whc-microcopy p {
	color: #aaa;
}

.whc-theme-dark .whc-controls {
	background: #2a2a2a;
}

.whc-theme-dark .whc-input {
	background: #2a2a2a;
	border-color: #444;
	color: #e0e0e0;
}

.whc-theme-dark .whc-input:focus {
	border-color: #0073aa;
}

.whc-theme-dark .whc-break-preset {
	background: #2a2a2a;
	border-color: #4a9eff;
	color: #4a9eff;
}

.whc-theme-dark .whc-break-preset:hover {
	background: #4a9eff;
	color: #1e1e1e;
	border-color: #4a9eff;
}

.whc-theme-dark .whc-break-clear {
	background: #3a2a1a;
	border-color: #ffc107;
	color: #ffc107;
}

.whc-theme-dark .whc-break-clear:hover {
	background: #ffc107;
	color: #1e1e1e;
	border-color: #ffc107;
}

.whc-theme-dark .whc-week-table thead {
	background: #2a2a2a;
}

.whc-theme-dark .whc-week-table th {
	border-bottom-color: #444;
}

.whc-theme-dark .whc-week-table td {
	border-bottom-color: #333;
}

.whc-theme-dark .whc-result-card {
	background: #2a2a2a;
	border-left-color: #0073aa;
}

.whc-theme-dark .whc-result-item {
	border-bottom-color: #333;
}

.whc-theme-dark .whc-result-label {
	color: #aaa;
}

.whc-theme-dark .whc-result-value {
	color: #4a9eff;
}

.whc-theme-dark .whc-error-message {
	background: #3a1f1f;
	color: #ff6b6b;
	border-left-color: #d63638;
}

/* Responsive */
@media (max-width: 768px) {
	.whc-tool {
		padding: 16px;
		font-size: 15px;
	}

	.whc-title {
		font-size: 20px;
		text-align: center;
	}

	.whc-week-table-wrapper {
		overflow-x: hidden;
	}

	.whc-week-table {
		min-width: 0;
	}

	.whc-week-table thead {
		display: none;
	}

	.whc-week-table, .whc-week-table tbody, .whc-week-table tr, .whc-week-table td {
		display: block;
		width: 100%;
	}

	.whc-day-row {
		margin-bottom: 20px;
		border: 1px solid #ddd;
		border-radius: 8px;
		padding: 16px;
		background: #fff;
		position: relative;
		box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	}

	.whc-week-table td {
		border: none;
		padding: 8px 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
	}

	.whc-week-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: #555;
		flex-shrink: 0;
		width: 40%;
	}

	.whc-day-label {
		font-size: 18px;
		font-weight: 700;
		color: #0073aa;
		border-bottom: 1px solid #eee !important;
		margin-bottom: 10px;
		padding-bottom: 10px !important;
		justify-content: flex-start !important;
	}

	.whc-day-label::before {
		display: none;
	}

	.whc-week-table .whc-input, 
	.whc-week-table .whc-break-input-wrapper {
		flex: 1;
		width: 100%;
		max-width: 100%;
	}

	.whc-remove-cell {
		position: absolute;
		top: 15px;
		right: 15px;
		width: auto !important;
		padding: 0 !important;
	}

	.whc-remove-cell::before {
		display: none;
	}

	.whc-btn-remove {
		width: 32px;
		height: 32px;
		border-radius: 50%;
	}

	.whc-tool {
		padding: 16px;
		font-size: 15px;
	}

	.whc-title {
		font-size: 20px;
		text-align: center;
	}

	.whc-input {
		padding: 8px 6px;
		font-size: 14px;
	}

	.whc-break-cell {
		min-width: 0;
	}

	.whc-break-input-wrapper {
		gap: 6px;
	}

	.whc-break-presets {
		grid-template-columns: repeat(4, 1fr);
		gap: 3px;
	}

	.whc-break-preset {
		padding: 5px 3px;
		font-size: 10px;
	}

	.whc-break-clear {
		padding: 6px;
		font-size: 10px;
		margin-top: 0;
	}

	.whc-checkbox {
		width: 16px;
		height: 16px;
	}

	.whc-checkbox-text {
		font-size: 11px;
	}

	.whc-actions {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}

	.whc-btn {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.whc-tool {
		padding: 12px;
	}

	.whc-microcopy {
		flex-direction: column;
		gap: 6px;
	}

	.whc-microcopy p {
		font-size: 13px;
	}

	.whc-week-table th {
		padding: 6px 3px;
		font-size: 10px;
	}

	.whc-week-table td {
		padding: 6px 3px;
	}

	.whc-input {
		padding: 6px 4px;
		font-size: 14px;
	}

	.whc-day-label {
		font-size: 11px;
	}

	.whc-break-cell {
		min-width: 100px;
	}

	.whc-break-presets {
		grid-template-columns: repeat(2, 1fr);
		gap: 2px;
	}

	.whc-break-preset {
		font-size: 9px;
		padding: 4px 2px;
	}

	.whc-break-clear {
		grid-column: 1 / -1;
		padding: 5px;
		font-size: 9px;
		margin-top: 0;
	}

	.whc-checkbox-text {
		font-size: 10px;
	}
}

/* Accessibility */
.whc-tool *:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.whc-tool button:focus,
.whc-tool input:focus,
.whc-tool select:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Print styles */
@media print {
	.whc-tool {
		box-shadow: none;
		border: 1px solid #ddd;
	}

	.whc-btn,
	.whc-btn-remove,
	.whc-break-presets {
		display: none;
	}
}
