/**
 * Bank Statement Converter — frontend styles.
 * Everything is scoped under .bsc-converter so nothing leaks into (or is
 * overridden by) the surrounding theme; no bare element selectors.
 */

.bsc-converter {
	--bsc-primary: #1d4ed8;
	--bsc-primary-hover: #1e40af;
	--bsc-text: #1f2933;
	--bsc-muted: #6b7280;
	--bsc-border: #d1d5db;
	--bsc-background: #ffffff;
	--bsc-surface: #f9fafb;
	--bsc-danger: #b42318;
	--bsc-danger-bg: #fef3f2;
	--bsc-info-bg: #eff6ff;
	--bsc-radius: 8px;

	box-sizing: border-box;
	max-width: 960px;
	margin: 0 auto;
	color: var(--bsc-text);
	font-size: 15px;
	line-height: 1.5;
}

.bsc-converter *,
.bsc-converter *::before,
.bsc-converter *::after {
	box-sizing: inherit;
}

.bsc-noscript-notice {
	padding: 12px 16px;
	background: var(--bsc-info-bg);
	border-radius: var(--bsc-radius);
}

/* Tabs */
.bsc-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid var(--bsc-border);
	margin-bottom: 20px;
}

.bsc-tab {
	appearance: none;
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	padding: 12px 18px;
	font-size: 15px;
	font-weight: 600;
	color: var(--bsc-muted);
	cursor: pointer;
	min-height: 44px;
}

.bsc-tab:hover {
	color: var(--bsc-text);
}

.bsc-tab.is-active {
	color: var(--bsc-primary);
	border-bottom-color: var(--bsc-primary);
}

.bsc-tab:focus-visible {
	outline: 2px solid var(--bsc-primary);
	outline-offset: 2px;
}

/* Privacy notice */
.bsc-privacy-notice {
	font-size: 13px;
	color: var(--bsc-muted);
	margin: 0 0 16px;
}

/* Dropzone */
.bsc-dropzone {
	border: 2px dashed var(--bsc-border);
	border-radius: var(--bsc-radius);
	padding: 40px 20px;
	text-align: center;
	cursor: pointer;
	background: var(--bsc-surface);
	min-height: 44px;
}

.bsc-dropzone:hover {
	border-color: var(--bsc-primary);
}

.bsc-dropzone:focus-visible {
	outline: 2px solid var(--bsc-primary);
	outline-offset: 2px;
}

.bsc-dropzone.is-active {
	border-color: var(--bsc-primary);
	background: var(--bsc-info-bg);
}

.bsc-dropzone.is-disabled {
	opacity: 0.5;
	pointer-events: none;
}

.bsc-dropzone-label {
	font-weight: 600;
	font-size: 16px;
	margin: 0 0 6px;
}

.bsc-dropzone-hint {
	font-size: 13px;
	color: var(--bsc-muted);
	margin: 0;
}

.bsc-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Progress */
.bsc-progress {
	margin: 16px 0;
}

.bsc-progress-bar {
	height: 4px;
	background: var(--bsc-border);
	border-radius: 2px;
	overflow: hidden;
	margin-bottom: 8px;
}

.bsc-progress-bar-fill {
	height: 100%;
	width: 40%;
	background: var(--bsc-primary);
	animation: bsc-indeterminate 1.4s ease-in-out infinite;
}

@keyframes bsc-indeterminate {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(350%);
	}
}

.bsc-progress-message {
	font-size: 14px;
	color: var(--bsc-muted);
	margin: 0;
}

/* Alerts */
.bsc-alert {
	padding: 12px 16px;
	border-radius: var(--bsc-radius);
	margin: 16px 0;
	font-size: 14px;
}

.bsc-alert--error {
	background: var(--bsc-danger-bg);
	color: var(--bsc-danger);
	border: 1px solid #fda29b;
}

.bsc-alert--info {
	background: var(--bsc-info-bg);
	color: var(--bsc-primary-hover);
	border: 1px solid #bfdbfe;
}

.bsc-undo-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--bsc-surface);
	border: 1px solid var(--bsc-border);
	border-radius: var(--bsc-radius);
	padding: 10px 14px;
	margin: 12px 0;
	font-size: 14px;
}

/* Summary */
.bsc-summary p {
	margin: 4px 0;
	font-size: 14px;
	color: var(--bsc-muted);
}

/* Preview table */
.bsc-preview-host {
	margin: 16px 0;
}

.bsc-table-scroll {
	overflow-x: auto;
	max-height: 480px;
	overflow-y: auto;
	border: 1px solid var(--bsc-border);
	border-radius: var(--bsc-radius);
}

.bsc-preview-table {
	border-collapse: collapse;
	width: 100%;
	min-width: 560px;
	font-size: 14px;
}

.bsc-preview-table thead th {
	position: sticky;
	top: 0;
	background: var(--bsc-surface);
	text-align: left;
	padding: 10px 12px;
	border-bottom: 2px solid var(--bsc-border);
	white-space: nowrap;
	z-index: 1;
}

.bsc-preview-table td {
	padding: 8px 12px;
	border-bottom: 1px solid var(--bsc-border);
	vertical-align: top;
}

.bsc-preview-table tr:last-child td {
	border-bottom: none;
}

.bsc-align-right {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.bsc-row-medium td {
	background: #fffbeb;
}

.bsc-row-low td {
	background: #fef3f2;
}

.bsc-confidence {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	border: 1px solid transparent;
}

.bsc-confidence--high {
	color: #027a48;
	background: #ecfdf3;
	border-color: #abefc6;
}

.bsc-confidence--medium {
	color: #b54708;
	background: #fffaeb;
	border-color: #fedf89;
}

.bsc-confidence--low {
	color: var(--bsc-danger);
	background: var(--bsc-danger-bg);
	border-color: #fda29b;
}

.bsc-cell-input {
	width: 100%;
	min-width: 90px;
	padding: 6px 8px;
	border: 1px solid var(--bsc-border);
	border-radius: 4px;
	font: inherit;
}

.bsc-cell-input:focus-visible {
	outline: 2px solid var(--bsc-primary);
	outline-offset: 1px;
}

.bsc-table-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
}

.bsc-table-count {
	font-size: 13px;
	color: var(--bsc-muted);
	margin: 0;
}

.bsc-pagination {
	display: flex;
	align-items: center;
	gap: 10px;
}

.bsc-pagination-page {
	font-size: 13px;
	color: var(--bsc-muted);
	min-width: 60px;
	text-align: center;
}

/* Buttons */
.bsc-action-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0;
}

.bsc-btn {
	appearance: none;
	border-radius: 6px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	min-height: 44px;
	border: 1px solid transparent;
}

.bsc-btn:focus-visible {
	outline: 2px solid var(--bsc-primary);
	outline-offset: 2px;
}

.bsc-btn--primary {
	background: var(--bsc-primary);
	color: #fff;
}

.bsc-btn--primary:hover {
	background: var(--bsc-primary-hover);
}

.bsc-btn--secondary {
	background: var(--bsc-background);
	color: var(--bsc-text);
	border-color: var(--bsc-border);
}

.bsc-btn--secondary:hover {
	border-color: var(--bsc-primary);
}

.bsc-btn--secondary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.bsc-btn--link {
	background: transparent;
	color: var(--bsc-primary);
	padding: 4px 6px;
	min-height: auto;
	text-decoration: underline;
}

.bsc-btn--icon {
	background: transparent;
	border: none;
	color: var(--bsc-muted);
	padding: 4px 8px;
	min-height: auto;
	font-size: 14px;
}

.bsc-btn--icon:hover {
	color: var(--bsc-danger);
}

/* Column mapper */
.bsc-column-mapper {
	margin: 16px 0;
}

.bsc-column-mapper-heading {
	font-weight: 600;
	margin-bottom: 12px;
}

.bsc-column-mapper-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 12px;
}

.bsc-column-mapper-table th,
.bsc-column-mapper-table td {
	text-align: left;
	padding: 8px 10px;
	border-bottom: 1px solid var(--bsc-border);
}

.bsc-column-mapper-table select {
	width: 100%;
	max-width: 220px;
	padding: 8px;
	border: 1px solid var(--bsc-border);
	border-radius: 4px;
	font: inherit;
	min-height: 40px;
}

.bsc-column-mapper-error {
	color: var(--bsc-danger);
	font-size: 13px;
	margin-bottom: 12px;
}

/* Mobile */
@media (max-width: 600px) {
	.bsc-converter {
		font-size: 14px;
	}

	.bsc-dropzone {
		padding: 28px 14px;
	}

	.bsc-action-bar {
		flex-direction: column;
	}

	.bsc-action-bar .bsc-btn {
		width: 100%;
	}

	.bsc-table-footer {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* Dark theme support (only applied if the host theme sets prefers-color-scheme awareness via this attribute; otherwise the light palette above is always used, matching WordPress admin/theme conventions). */
@media (prefers-color-scheme: dark) {
	.bsc-converter[data-bsc-theme='auto'] {
		--bsc-text: #e5e7eb;
		--bsc-muted: #9ca3af;
		--bsc-border: #374151;
		--bsc-background: #111827;
		--bsc-surface: #1f2937;
		--bsc-info-bg: #1e3a5f;
	}
}
