/**
 * FESCO Bill Checker — WordPress overlay.
 * Original bill styles live in gbill-design.scoped.css.
 */

.fesco-bill-checker {
	--gbn-navy: #0c2356;
	--gbn-navy-light: #1a3d6e;
	--gbn-green: #1b753a;
	--gbn-surface: #f4f7fb;
	--gbn-border: #c5d0de;
	font-family: "Roboto", Arial, sans-serif;
	box-sizing: border-box;
	max-width: 100%;
}

.fesco-bill-checker *,
.fesco-bill-checker *::before,
.fesco-bill-checker *::after {
	box-sizing: border-box;
}

/* Do not paint the WordPress page charcoal like the PITC html/body canvas. */
.fesco-bill-checker.fesco-bill-checker--search,
.fesco-bill-checker.fesco-bill-checker--result {
	background: transparent !important;
	width: 100% !important;
	color: #050505;
}

.fesco-bill-checker .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.fesco-bill-checker .gbn-is-hidden {
	display: none !important;
}

/* ---------- Search UI ---------- */

.fesco-checker {
	max-width: 520px;
	margin: 24px auto;
	padding: 28px 24px 32px;
	background: #ffffff;
	border: 1px solid #c5d0de;
	border-top: 4px solid #0c2356;
	box-shadow: 0 8px 24px rgba(12, 35, 86, 0.08);
	text-align: center;
}

.fesco-checker__logo {
	width: 72px;
	height: 72px;
	object-fit: contain;
	margin: 0 auto 10px;
	display: block;
}

.fesco-checker__title {
	margin: 0;
	color: #0c2356;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.fesco-checker__tagline {
	margin: 4px 0 0;
	color: #1b753a;
	font-size: 12px;
	font-weight: 700;
}

.fesco-checker__hint {
	margin: 18px 0 12px;
	color: #334155;
	font-size: 14px;
}

.fesco-checker__error {
	margin: 0 0 14px;
	padding: 10px 12px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
	font-size: 13px;
	font-weight: 600;
}

.fesco-checker__form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: stretch;
}

.fesco-checker__types {
	display: flex;
	justify-content: center;
	gap: 18px;
	margin: 0;
	padding: 0;
	border: none;
}

.fesco-checker__type {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 700;
	color: #0c2356;
	cursor: pointer;
}

.fesco-checker__type input {
	margin: 0;
	accent-color: #0c2356;
}

.fesco-checker__row {
	display: flex;
	gap: 8px;
	align-items: stretch;
}

.fesco-checker__row .fesco-checker__input {
	flex: 1 1 auto;
	min-width: 0;
}

.fesco-checker__form:not(:has([data-fesco-search-by][value="appno"]:checked)) [data-search-field="appno"] {
	display: none;
}

.fesco-checker__form:has([data-fesco-search-by][value="appno"]:checked) [data-search-field="refno"] {
	display: none;
}

.fesco-checker__ru {
	flex: 0 0 64px;
	width: 64px;
	padding: 8px 6px;
	border: 1px solid #cbd5e1;
	border-radius: 2px;
	background: #fff;
	color: #050505;
	font-size: 16px;
	font-weight: 700;
	font-family: "Roboto", Arial, sans-serif;
	text-align: center;
}

.fesco-checker__ru:focus {
	outline: 2px solid #0c2356;
	outline-offset: 1px;
}

.fesco-checker__input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 2px;
	font-size: 18px;
	letter-spacing: 0.08em;
	text-align: center;
	font-family: "Roboto", Arial, sans-serif;
	background: #fff;
	color: #050505;
}

.fesco-checker__input:focus {
	outline: 2px solid #0c2356;
	outline-offset: 1px;
}

.fesco-checker__submit {
	appearance: none;
	border: none;
	background: #0c2356;
	color: #ffffff;
	font-weight: 800;
	font-size: 14px;
	letter-spacing: 0.08em;
	padding: 12px 18px;
	cursor: pointer;
	font-family: "Roboto", Arial, sans-serif;
}

.fesco-checker__submit:hover,
.fesco-checker__submit:focus {
	background: #1b753a;
}

.fesco-checker__submit:disabled,
.fesco-checker__form.is-loading .fesco-checker__submit {
	opacity: 0.7;
	cursor: wait;
}

/* ---------- Result chrome ---------- */

.fesco-bill-checker--result {
	padding: 8px 0 20px;
}

/* Keep the official 794px A4 width, but allow height to grow so the slip is never clipped. */
.fesco-bill-checker .a4-container {
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
	overflow: visible !important;
}

.fesco-bill-checker .gbn-app-shell {
	max-width: min(100%, 1260px);
	margin: 0 auto;
	overflow: visible;
}

.fesco-bill-checker .tabs {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 10px 0 14px;
	background: linear-gradient(180deg, #1a3d6e 0%, #0c2356 100%);
	border-radius: 4px 4px 0 0;
}

.fesco-bill-checker .tabs__list {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	flex: 1;
}

.fesco-bill-checker .tab {
	padding: 11px 22px;
	border-radius: 4px 4px 0 0;
	color: #0c2356;
	background: #f4f7fb;
	border: 1px solid #dce4ee;
	border-bottom: none;
	font-size: 13px;
	font-weight: 700;
}

.fesco-bill-checker .tabs__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 4px 6px 0;
}

.fesco-bill-checker .fesco-new-search {
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	padding: 8px 10px;
}

.fesco-bill-checker .fesco-new-search:hover {
	text-decoration: underline;
	color: #ffffff;
}

.fesco-bill-checker .gbn-print-btn {
	appearance: none;
	background: #ffffff;
	color: #0c2356;
	border: 1.5px solid rgba(255, 255, 255, 0.35);
	border-radius: 4px;
	font-family: "Roboto", Arial, sans-serif;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.04em;
	cursor: pointer;
	padding: 8px 12px;
}

.fesco-bill-checker .gbn-print-btn:hover {
	background: #1b753a;
	color: #ffffff;
}

.fesco-bill-checker .tab-content {
	display: none;
	background: #e8eef5;
	border: 1px solid #c5d0de;
	border-top: 3px solid #1b753a;
	padding: 12px 8px 18px;
	overflow: auto;
}

.fesco-bill-checker .tab-content.active {
	display: block;
}

.fesco-bill-checker .header-qr-trigger {
	display: block;
	width: 80px;
	height: 80px;
	padding: 0;
	margin: 0;
	border: none;
	background: #ffffff;
	cursor: pointer;
	line-height: 0;
	flex-shrink: 0;
}

.fesco-bill-checker .header-qr-host,
.fesco-bill-checker .header-qr-host svg,
.fesco-bill-checker .header-qr-host img {
	width: 80px !important;
	height: 80px !important;
	display: block;
}

.fesco-bill-checker .qr-charges-trigger {
	display: inline-block;
	margin: 0 auto 4px;
	padding: 2px;
	border: none;
	background: #ffffff;
	cursor: pointer;
	line-height: 0;
}

.fesco-bill-checker .qr-charges-host,
.fesco-bill-checker .qr-charges-host svg,
.fesco-bill-checker .qr-charges-host img {
	width: 150px !important;
	height: 150px !important;
	display: block;
}

.fesco-bill-checker .disco-logo-slip {
	width: 56px;
	height: 56px;
	object-fit: contain;
}

.fesco-bill-checker .bill-qr-modal {
	position: fixed;
	inset: 0;
	z-index: 200000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fesco-bill-checker .bill-qr-modal.gbn-is-hidden,
.fesco-bill-checker .bill-qr-modal[hidden] {
	display: none !important;
}

.fesco-bill-checker .bill-qr-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 35, 86, 0.55);
}

.fesco-bill-checker .bill-qr-modal-panel {
	position: relative;
	z-index: 1;
	background: #ffffff;
	padding: 20px;
	border: 1px solid #c5d0de;
	text-align: center;
}

.fesco-bill-checker .bill-qr-modal-host svg,
.fesco-bill-checker .bill-qr-modal-host img {
	width: min(400px, 88vw) !important;
	height: min(400px, 88vw) !important;
	display: block;
	margin: 0 auto;
}

.fesco-bill-checker .bill-qr-modal-hint {
	margin: 10px 0 0;
	font-size: 12px;
	font-weight: 600;
	color: #0c2356;
}

.fesco-bill-checker .fesco-qr-close {
	margin-top: 12px;
	background: #0c2356;
	color: #fff;
	border: none;
	padding: 8px 14px;
	cursor: pointer;
	font-weight: 700;
}

.fesco-bill-checker .val-space {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 8px;
	font-weight: 700;
	color: #050505;
}

.fesco-bill-checker .val-space.val-space--address {
	align-items: flex-start;
	justify-content: flex-start;
	text-align: left;
}

.fesco-bill-checker .slip-title-area a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Mobile reflow ---------- */

@media (max-width: 820px) {
	.fesco-bill-checker .a4-container {
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		padding: 10px 8px !important;
		overflow: visible !important;
	}

	.fesco-bill-checker .main-dashboard-grid {
		grid-template-columns: 1fr !important;
		gap: 8px;
	}

	.fesco-bill-checker .main-dashboard-grid > section:last-child,
	.fesco-bill-checker .main-dashboard-grid > section.right-sidebar--gbn {
		width: 100% !important;
		max-width: 100% !important;
		justify-self: stretch;
	}

	.fesco-bill-checker .bill-header {
		flex-wrap: wrap;
	}

	.fesco-bill-checker .header-left,
	.fesco-bill-checker .header-right {
		width: auto;
		max-width: 100%;
	}

	.fesco-bill-checker .header-center {
		order: -1;
		flex: 1 1 100%;
	}

	.fesco-bill-checker .grid-4col {
		grid-template-columns: 1fr 1fr;
	}

	.fesco-bill-checker .meter-info-card--gbn .meter-info-grid {
		grid-template-columns: 1fr 1fr;
	}

	.fesco-bill-checker .charges-breakdown-grid {
		grid-template-columns: 1fr;
	}

	.fesco-bill-checker .history-data-wrapper {
		grid-template-columns: 1fr;
	}

	.fesco-bill-checker .history-center-divider::before,
	.fesco-bill-checker .history-center-divider::after {
		display: none;
	}

	.fesco-bill-checker .slip-branding-grid {
		grid-template-columns: 1fr;
	}

	.fesco-bill-checker .slip-branding-grid > div:last-child {
		width: 100%;
		max-width: 100%;
		justify-self: stretch;
	}

	.fesco-bill-checker .slip-matrix-grid {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: none;
	}

	.fesco-bill-checker .slip-payable-within-title,
	.fesco-bill-checker .slip-payable-after-title,
	.fesco-bill-checker .slip-main-amount {
		grid-column: auto;
		grid-row: auto;
	}

	.fesco-bill-checker .header-brand-mark--split .header-brand-text {
		font-size: 28px;
	}

	.fesco-bill-checker .tabs {
		flex-wrap: wrap;
		border-radius: 0;
	}

	.fesco-bill-checker .tab-content {
		padding: 8px 4px 12px;
		overflow: visible;
	}
}

@media (max-width: 520px) {
	.fesco-bill-checker .grid-4col,
	.fesco-bill-checker .meter-info-card--gbn .meter-info-grid,
	.fesco-bill-checker .right-grid-2col,
	.fesco-bill-checker .payable-card--split,
	.fesco-bill-checker .history-footer-banner {
		grid-template-columns: 1fr;
	}

	.fesco-bill-checker .grid-col-cell.border-divider-left {
		border-left: none;
		border-top: 1px solid #e2e8f0;
	}

	.fesco-checker {
		margin: 12px 0;
		padding: 20px 14px;
	}

	.fesco-bill-checker .header-qr-urdu-row {
		grid-template-columns: 80px minmax(0, 1fr);
	}

	.fesco-bill-checker .lp-surcharge-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- Print ---------- */

@media print {
	.noprint,
	.fesco-bill-checker .tabs,
	.fesco-bill-checker .gbn-print-btn,
	.fesco-bill-checker .fesco-new-search,
	.fesco-bill-checker .qr-charges-tap-hint,
	.fesco-bill-checker .bill-qr-modal,
	.fesco-bill-checker .fesco-checker,
	#wpadminbar,
	.site-header,
	.site-footer,
	.entry-header,
	.entry-footer,
	.nav-links,
	.comments-area,
	.widget-area,
	.sidebar,
	header.wp-block-template-part,
	footer.wp-block-template-part {
		display: none !important;
	}

	.fesco-bill-checker-page #page,
	.fesco-bill-checker-page #content,
	.fesco-bill-checker-page .site-content,
	.fesco-bill-checker-page .entry-content,
	.fesco-bill-checker-page .wp-block-post-content {
		margin: 0 !important;
		padding: 0 !important;
		width: 100% !important;
		max-width: none !important;
		float: none !important;
		background: #fff !important;
	}

	.fesco-bill-checker,
	.fesco-bill-checker--result {
		background: #fff !important;
		padding: 0 !important;
		box-shadow: none !important;
	}

	.fesco-bill-checker .tab-content,
	.fesco-bill-checker .tab-content.active {
		display: block !important;
		padding: 0 !important;
		border: none !important;
		background: #fff !important;
		box-shadow: none !important;
		overflow: visible !important;
	}

	.fesco-bill-checker .canvas-viewport,
	.fesco-bill-checker .bill-canvas-viewport {
		padding: 0 !important;
		background: #fff !important;
	}

	.fesco-bill-checker .a4-container {
		box-shadow: none !important;
		border: none !important;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow: visible !important;
		page-break-inside: avoid !important;
	}

	.fesco-bill-checker .header-qr-trigger,
	.fesco-bill-checker .qr-charges-trigger {
		display: block !important;
		border: none;
		box-shadow: none;
		background: transparent;
	}

	.fesco-bill-checker .gbn-app-shell {
		max-width: none !important;
	}
}

/* Loading state */
.fesco-bill-checker--loading .fesco-loading {
	text-align: center;
	padding: 40px 20px;
}

.fesco-loading__spinner {
	width: 40px;
	height: 40px;
	margin: 0 auto 16px;
	border: 4px solid #e5e7eb;
	border-top-color: #1a2744;
	border-radius: 50%;
	animation: fesco-spin 0.8s linear infinite;
}

@keyframes fesco-spin {
	to { transform: rotate(360deg); }
}

.fesco-loading__text {
	color: #6b7280;
	font-size: 15px;
	margin: 0;
}
