/*!
 * Business Reply & Invoice Toolkit — Frontend Shortcode Styles
 * Scoped entirely under .bt-front to avoid theme conflicts.
 */

.bt-front {
	--btf-blue: #2563eb;
	--btf-blue-dark: #1d4ed8;
	--btf-blue-light: #eff4ff;
	--btf-green: #16a34a;
	--btf-green-dark: #128a3e;
	--btf-red: #dc2626;
	--btf-text: #1e2433;
	--btf-text-muted: #667085;
	--btf-border: #e6e9f0;
	--btf-bg: #f5f7fb;
	--btf-card-bg: #ffffff;
	--btf-radius: 14px;
	--btf-radius-sm: 10px;
	--btf-shadow: 0 4px 18px rgba(30, 41, 59, 0.06);

	max-width: 1100px;
	margin: 24px auto;
	color: var(--btf-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	position: relative;
	box-sizing: border-box;
}

.bt-front *,
.bt-front *::before,
.bt-front *::after {
	box-sizing: border-box;
}

/* -----------------------------------------------------------
   Tabs
----------------------------------------------------------- */
.bt-front-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	background: var(--btf-card-bg);
	border: 1px solid var(--btf-border);
	border-radius: 999px;
	padding: 6px;
	box-shadow: var(--btf-shadow);
	margin-bottom: 22px;
}

.bt-front-tab {
	flex: 1;
	min-width: 140px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: transparent;
	border: none;
	border-radius: 999px;
	padding: 11px 16px;
	font-size: 13px;
	font-weight: 600;
	color: var(--btf-text-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.bt-front-tab .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.bt-front-tab:hover {
	color: var(--btf-blue);
}

.bt-front-tab.is-active {
	background: var(--btf-blue);
	color: #fff;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

/* -----------------------------------------------------------
   Panels
----------------------------------------------------------- */
.bt-front-panel {
	display: none;
	animation: btf-fade-in 0.25s ease;
}

.bt-front-panel.is-active {
	display: block;
}

@keyframes btf-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.bt-front-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	align-items: start;
}

.bt-front-grid-invoice {
	grid-template-columns: 1fr 1.1fr;
}

.bt-front-card {
	background: var(--btf-card-bg);
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius);
	box-shadow: var(--btf-shadow);
	padding: 22px;
}

.bt-front-card h3 {
	font-size: 15px;
	font-weight: 700;
	margin: 0 0 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--btf-border);
	color: var(--btf-text);
}

.bt-front-subheading {
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
	color: var(--btf-blue);
	margin: 18px 0 10px;
}

/* -----------------------------------------------------------
   Forms
----------------------------------------------------------- */
.bt-front-field {
	margin-bottom: 14px;
}

.bt-front-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.bt-front-field label {
	display: block;
	font-size: 12.5px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--btf-text);
}

.bt-front-required {
	color: var(--btf-red);
}

.bt-front-field input[type="text"],
.bt-front-field input[type="number"],
.bt-front-field input[type="file"],
.bt-front-field select,
.bt-front-field textarea {
	width: 100%;
	padding: 10px 12px;
	font-size: 13px;
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	background: var(--btf-card-bg);
	color: var(--btf-text);
	font-family: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bt-front-field input:focus,
.bt-front-field select:focus,
.bt-front-field textarea:focus {
	outline: none;
	border-color: var(--btf-blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bt-front-field input[readonly] {
	background: var(--btf-bg);
	color: var(--btf-text-muted);
}

.bt-front-radio-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.bt-front-radio-pill {
	position: relative;
	display: inline-flex;
	margin: 0;
}

.bt-front-radio-pill input {
	position: absolute;
	opacity: 0;
}

.bt-front-radio-pill span {
	padding: 8px 15px;
	border: 1px solid var(--btf-border);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	color: var(--btf-text-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.bt-front-radio-pill input:checked + span {
	background: var(--btf-blue);
	border-color: var(--btf-blue);
	color: #fff;
}

/* -----------------------------------------------------------
   Buttons
----------------------------------------------------------- */
.bt-front-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	padding: 10px 18px;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.15s ease, background 0.15s ease;
	line-height: 1;
}

.bt-front-btn:active {
	transform: scale(0.96);
}

.bt-front-btn-primary {
	background: var(--btf-blue);
	color: #fff;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.bt-front-btn-primary:hover {
	background: var(--btf-blue-dark);
	color: #fff;
}

.bt-front-btn-success {
	background: var(--btf-green);
	color: #fff;
	box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.bt-front-btn-success:hover {
	background: var(--btf-green-dark);
	color: #fff;
}

.bt-front-btn-ghost {
	background: transparent;
	border-color: var(--btf-border);
	color: var(--btf-text);
}

.bt-front-btn-ghost:hover {
	border-color: var(--btf-blue);
	color: var(--btf-blue);
}

.bt-front-btn-small {
	padding: 7px 14px;
	font-size: 12px;
}

.bt-front-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
}

.bt-front-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 18px;
}

/* -----------------------------------------------------------
   Output box (reply / refund)
----------------------------------------------------------- */
.bt-front-output {
	min-height: 160px;
	background: var(--btf-bg);
	border: 1px dashed var(--btf-border);
	border-radius: var(--btf-radius-sm);
	padding: 18px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--btf-text);
}

.bt-front-output .bt-front-placeholder {
	color: var(--btf-text-muted);
	font-style: italic;
	margin: 0;
}

/* Editable generated-message textarea (replaces the old read-only div) */
.bt-front-output-textarea {
	width: 100%;
	min-height: 160px;
	background: var(--btf-bg);
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	padding: 16px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--btf-text);
	font-family: inherit;
	resize: vertical;
}

.bt-front-output-textarea:focus {
	outline: none;
	border-color: var(--btf-blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bt-front-output-textarea::placeholder {
	color: var(--btf-text-muted);
	font-style: italic;
}

/* Direct WhatsApp send row (customer number + Send button) */
.bt-front-whatsapp-row {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	flex-wrap: wrap;
}

.bt-front-whatsapp-row input {
	flex: 1;
	min-width: 160px;
	padding: 10px 13px;
	font-size: 13px;
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	background: var(--btf-card-bg);
	color: var(--btf-text);
}

.bt-front-whatsapp-row input:focus {
	outline: none;
	border-color: var(--btf-blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bt-front-hint {
	font-size: 11.5px;
	color: var(--btf-text-muted);
	margin: 6px 0 0;
	line-height: 1.5;
}

/* -----------------------------------------------------------
   Price calculator results
----------------------------------------------------------- */
.bt-front-result-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bt-front-result-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--btf-bg);
	border-radius: var(--btf-radius-sm);
	font-size: 13px;
}

.bt-front-result-row span {
	color: var(--btf-text-muted);
	font-weight: 600;
}

.bt-front-result-row strong {
	font-size: 15px;
	color: var(--btf-text);
}

.bt-front-result-highlight {
	background: var(--btf-blue-light);
	border: 1px solid var(--btf-blue);
}

.bt-front-result-highlight strong {
	color: var(--btf-blue);
	font-size: 17px;
}

/* -----------------------------------------------------------
   Invoice items
----------------------------------------------------------- */
.bt-front-invoice-items {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 10px;
}

.bt-front-item-row {
	display: grid;
	grid-template-columns: 2fr 0.7fr 1fr 32px;
	gap: 8px;
	align-items: center;
}

.bt-front-item-row input {
	padding: 8px 10px;
	font-size: 12.5px;
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	background: var(--btf-card-bg);
	color: var(--btf-text);
}

.bt-front-item-remove {
	background: transparent;
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	color: var(--btf-red);
	cursor: pointer;
	height: 34px;
	font-size: 18px;
	line-height: 1;
}

.bt-front-item-remove:hover {
	background: rgba(220, 38, 38, 0.08);
}

.bt-front-logo-upload {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.bt-front-logo-upload img {
	max-height: 44px;
	max-width: 90px;
	border-radius: 8px;
	border: 1px solid var(--btf-border);
	object-fit: contain;
	background: #fff;
	padding: 4px;
}

/* -----------------------------------------------------------
   Invoice preview document
----------------------------------------------------------- */
.bt-front-invoice-preview {
	background: var(--btf-bg);
	border-radius: var(--btf-radius-sm);
	padding: 16px;
	margin-bottom: 18px;
}

.bt-front-invoice-doc {
	background: #ffffff;
	color: #1e2433;
	border-radius: 10px;
	padding: 24px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.bt-front-doc-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	border-bottom: 2px solid #2563eb;
	padding-bottom: 14px;
	margin-bottom: 14px;
}

.bt-front-doc-brand img {
	max-height: 40px;
	max-width: 130px;
	object-fit: contain;
	margin-bottom: 8px;
}

.bt-front-doc-brand h2 {
	margin: 0 0 4px;
	font-size: 17px;
	color: #1e2433;
}

.bt-front-doc-brand p {
	margin: 0;
	font-size: 11.5px;
	color: #667085;
}

.bt-front-doc-meta {
	text-align: right;
	font-size: 12px;
	color: #1e2433;
}

.bt-front-doc-meta p {
	margin: 0 0 4px;
}

.bt-front-doc-customer {
	margin-bottom: 16px;
}

.bt-front-doc-customer h4 {
	margin: 0 0 6px;
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #2563eb;
}

.bt-front-doc-customer p {
	margin: 0;
	font-size: 12.5px;
	color: #1e2433;
	line-height: 1.5;
}

.bt-front-doc-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
	font-size: 12.5px;
}

.bt-front-doc-table th {
	text-align: left;
	background: #eff4ff;
	color: #2563eb;
	padding: 9px 11px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.bt-front-doc-table td {
	padding: 9px 11px;
	border-bottom: 1px solid #e6e9f0;
	color: #1e2433;
}

.bt-front-doc-table .bt-front-empty-row td {
	text-align: center;
	color: #98a2b3;
	font-style: italic;
}

.bt-front-doc-totals {
	max-width: 270px;
	margin-left: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bt-front-total-row {
	display: flex;
	justify-content: space-between;
	font-size: 12.5px;
	color: #475467;
}

.bt-front-total-grand {
	border-top: 2px solid #2563eb;
	margin-top: 6px;
	padding-top: 8px;
	font-weight: 700;
	font-size: 14px;
	color: #2563eb;
}

.bt-front-doc-footer {
	text-align: center;
	margin: 20px 0 0;
	font-size: 11.5px;
	color: #98a2b3;
}

/* -----------------------------------------------------------
   Toasts
----------------------------------------------------------- */
.bt-front-toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bt-front-toast {
	min-width: 250px;
	max-width: 320px;
	background: #1e2433;
	color: #fff;
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 500;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	animation: btf-toast-in 0.25s ease forwards;
}

.bt-front-toast.bt-front-toast-success {
	background: #16a34a;
}

.bt-front-toast.bt-front-toast-error {
	background: #dc2626;
}

.bt-front-toast.bt-front-toast-hide {
	animation: btf-toast-out 0.25s ease forwards;
}

@keyframes btf-toast-in {
	from {
		opacity: 0;
		transform: translateX(30px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes btf-toast-out {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(30px);
	}
}

/* -----------------------------------------------------------
   History (frontend "My Recent Activity" — this browser only)
----------------------------------------------------------- */
.bt-front-history-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.bt-front-history-toolbar p {
	margin: 0;
	font-size: 12px;
	color: var(--btf-text-muted);
}

.bt-front-history-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bt-front-history-item {
	background: var(--btf-bg);
	border: 1px solid var(--btf-border);
	border-radius: var(--btf-radius-sm);
	padding: 14px 16px;
}

.bt-front-history-item-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 6px;
	gap: 8px;
	flex-wrap: wrap;
}

.bt-front-history-badge {
	display: inline-block;
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--btf-blue-light);
	color: var(--btf-blue);
}

.bt-front-history-time {
	font-size: 11.5px;
	color: var(--btf-text-muted);
}

.bt-front-history-item p.bt-front-history-text {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--btf-text);
	line-height: 1.6;
	white-space: pre-wrap;
}

.bt-front-history-empty {
	text-align: center;
	color: var(--btf-text-muted);
	font-size: 13px;
	font-style: italic;
	padding: 30px 0;
}

/* -----------------------------------------------------------
   Responsive
----------------------------------------------------------- */
@media (max-width: 782px) {
	.bt-front-grid,
	.bt-front-grid-invoice,
	.bt-front-field-row {
		grid-template-columns: 1fr;
	}

	/* Tabs: switch to a clean 2-column grid of rounded-rectangle buttons.
	   A full 999px pill radius on a stretched, full-width button produces
	   an ugly "stadium/oval" shape once tabs wrap onto separate rows, so
	   we drop to a much smaller radius here as well. */
	.bt-front-tabs {
		display: grid;
		grid-template-columns: 1fr 1fr;
		border-radius: var( --btf-radius );
		padding: 8px;
		gap: 8px;
	}

	.bt-front-tab {
		flex: none;
		min-width: 0;
		width: 100%;
		flex-direction: column;
		justify-content: center;
		gap: 4px;
		border-radius: var( --btf-radius-sm );
		padding: 12px 10px;
		background: var( --btf-bg );
		text-align: center;
		white-space: normal;
		line-height: 1.3;
	}

	.bt-front-tab.is-active {
		background: var( --btf-blue );
	}

	.bt-front-item-row {
		grid-template-columns: 1fr 1fr;
	}

	.bt-front-toast-container {
		left: 10px;
		right: 10px;
	}

	.bt-front-toast {
		max-width: 100%;
	}

	.bt-front {
		margin: 14px auto;
		padding: 0 4px;
	}

	.bt-front-card {
		padding: 18px;
	}
}

@media (max-width: 480px) {
	.bt-front-tab {
		font-size: 12.5px;
		padding: 12px 14px;
	}
}

/* -----------------------------------------------------------
   Print styles
----------------------------------------------------------- */
@media print {
	body.bt-front-printing * {
		visibility: hidden;
	}

	body.bt-front-printing #bt-front-invoice-doc,
	body.bt-front-printing #bt-front-invoice-doc * {
		visibility: visible;
	}

	body.bt-front-printing #bt-front-invoice-doc {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		box-shadow: none;
	}
}
