/* Aviation Parts & RFQ Manager - Frontend Styles */

.aprfq-parts-wrapper {
	--aprfq-primary: #0b5394;
	--aprfq-primary-hover: #0a4578;
	--aprfq-border: #d7dbe0;
	--aprfq-table-header-bg: #f1f4f7;
	--aprfq-text: #1f2937;
	--aprfq-muted: #6b7280;
	--aprfq-bg: #ffffff;
	--aprfq-success: #1a7f37;
	--aprfq-radius: 6px;

	box-sizing: border-box;
	max-width: 100%;
	color: var(--aprfq-text);
}

.aprfq-parts-wrapper *,
.aprfq-parts-wrapper *::before,
.aprfq-parts-wrapper *::after {
	box-sizing: border-box;
}

.aprfq-header {
	margin-bottom: 1.25rem;
}

.aprfq-title {
	margin: 0 0 0.4rem;
}

.aprfq-subtitle {
	margin: 0;
	color: var(--aprfq-muted);
}

/* Toolbar: search + quote button */
.aprfq-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: stretch;
	margin-bottom: 1rem;
}

.aprfq-search-wrap {
	position: relative;
	flex: 1 1 260px;
	min-width: 0;
}

.aprfq-search-icon {
	position: absolute;
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	font-size: 16px;
	line-height: 1;
	opacity: 0.6;
	z-index: 1;
}

input.aprfq-search {
	width: 100%;
	height: 48px;
	padding: 0 16px 0 48px;
	font-size: 16px;
	border: 1px solid var(--aprfq-border);
	border-radius: var(--aprfq-radius);
	background: var(--aprfq-bg);
	color: var(--aprfq-text);
}

input.aprfq-search:focus {
	outline: 2px solid var(--aprfq-primary);
	outline-offset: 1px;
}

.aprfq-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0.6rem 1.1rem;
	font-size: 15px;
	font-weight: 600;
	border-radius: var(--aprfq-radius);
	border: 1px solid var(--aprfq-primary);
	background: var(--aprfq-primary);
	color: #fff;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.aprfq-button:hover {
	background: var(--aprfq-primary-hover);
	border-color: var(--aprfq-primary-hover);
}

.aprfq-button:focus-visible {
	outline: 2px solid var(--aprfq-primary-hover);
	outline-offset: 2px;
}

.aprfq-button-secondary {
	background: transparent;
	color: var(--aprfq-primary);
}

.aprfq-button-secondary:hover {
	background: rgba(11, 83, 148, 0.08);
}

.aprfq-quote-toggle {
	flex: 0 0 auto;
}

.aprfq-status {
	margin: 0.5rem 0;
	color: var(--aprfq-muted);
	min-height: 1.2em;
}

.aprfq-search-context {
	margin: 0 0 0.5rem;
	font-size: 0.9rem;
	color: var(--aprfq-muted);
}

.aprfq-search-context[hidden] {
	display: none;
}

/* Desktop table */
.aprfq-table-scroll {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table.aprfq-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 640px;
}

table.aprfq-table th,
table.aprfq-table td {
	text-align: left;
	padding: 0.75rem 0.9rem;
	border-bottom: 1px solid var(--aprfq-border);
	vertical-align: middle;
	word-break: break-word;
	overflow-wrap: break-word;
}

table.aprfq-table thead th {
	background: var(--aprfq-table-header-bg);
	font-weight: 600;
	white-space: nowrap;
}

table.aprfq-table td.aprfq-td-part-number {
	font-weight: 600;
}

.aprfq-add-quote {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 40px;
	padding: 0.4rem 0.9rem;
	border-radius: var(--aprfq-radius);
	border: 1px solid var(--aprfq-primary);
	background: var(--aprfq-primary);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.aprfq-add-quote.is-added {
	background: var(--aprfq-success);
	border-color: var(--aprfq-success);
}

.aprfq-add-quote:focus-visible {
	outline: 2px solid var(--aprfq-primary-hover);
	outline-offset: 2px;
}

/* Mobile cards (hidden on desktop by default) */
.aprfq-cards {
	display: none;
}

.aprfq-part-card {
	border: 1px solid var(--aprfq-border);
	border-radius: var(--aprfq-radius);
	padding: 1rem;
	margin-bottom: 0.85rem;
	background: var(--aprfq-bg);
}

.aprfq-part-card-number {
	font-size: 1.05rem;
	font-weight: 700;
	margin-bottom: 0.15rem;
	word-break: break-word;
}

.aprfq-part-card-description {
	color: var(--aprfq-muted);
	margin-bottom: 0.6rem;
	word-break: break-word;
}

.aprfq-part-card-meta {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem 1rem;
	margin-bottom: 0.85rem;
}

.aprfq-part-card-meta-item .aprfq-label {
	display: block;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--aprfq-muted);
	margin-bottom: 0.15rem;
}

.aprfq-part-card-meta-item .aprfq-value {
	font-weight: 600;
	word-break: break-word;
}

.aprfq-part-card .aprfq-add-quote {
	width: 100%;
	justify-content: center;
	min-height: 46px;
}

/* Pagination */
.aprfq-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 1.25rem 0;
}

.aprfq-page-btn {
	min-width: 40px;
	min-height: 40px;
	padding: 0 0.6rem;
	border: 1px solid var(--aprfq-border);
	background: var(--aprfq-bg);
	border-radius: var(--aprfq-radius);
	cursor: pointer;
	font-size: 14px;
}

.aprfq-page-btn.is-current {
	background: var(--aprfq-primary);
	border-color: var(--aprfq-primary);
	color: #fff;
	font-weight: 700;
}

.aprfq-page-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Quote panel (slide-over) */
.aprfq-quote-panel {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	z-index: 100000;
	display: flex;
	justify-content: flex-end;
}

.aprfq-quote-panel[hidden] {
	display: none;
}

.aprfq-quote-panel-inner {
	background: var(--aprfq-bg);
	width: 100%;
	max-width: 480px;
	height: 100%;
	overflow-y: auto;
	padding: 1.25rem;
	box-shadow: -4px 0 16px rgba(0,0,0,0.15);
}

.aprfq-quote-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.aprfq-quote-panel-header h3 {
	margin: 0;
}

.aprfq-close {
	background: transparent;
	border: none;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	color: var(--aprfq-muted);
	min-width: 44px;
	min-height: 44px;
}

.aprfq-quote-item {
	border: 1px solid var(--aprfq-border);
	border-radius: var(--aprfq-radius);
	padding: 0.85rem;
	margin-bottom: 0.65rem;
}

.aprfq-quote-item-number {
	font-weight: 700;
	word-break: break-word;
}

.aprfq-quote-item-desc {
	color: var(--aprfq-muted);
	margin: 0.15rem 0 0.5rem;
	word-break: break-word;
}

.aprfq-quote-item-qty {
	font-size: 0.9rem;
	margin-bottom: 0.5rem;
}

.aprfq-remove-btn {
	min-height: 40px;
	padding: 0 0.9rem;
	border: 1px solid var(--aprfq-border);
	background: var(--aprfq-bg);
	border-radius: var(--aprfq-radius);
	cursor: pointer;
	color: #b42318;
}

.aprfq-quote-panel-actions {
	display: flex;
	gap: 0.6rem;
	margin: 1rem 0;
	flex-wrap: wrap;
}

.aprfq-quote-panel-actions .aprfq-button {
	flex: 1 1 auto;
}

.aprfq-empty-quote {
	color: var(--aprfq-muted);
	padding: 1rem 0;
}

/* RFQ form */
.aprfq-rfq-form[hidden] {
	display: none;
}

.aprfq-field {
	margin-bottom: 0.9rem;
}

.aprfq-field label,
.aprfq-selected-label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
}

.aprfq-req {
	color: #b42318;
}

.aprfq-field input[type="text"],
.aprfq-field input[type="email"],
.aprfq-field input[type="tel"],
.aprfq-field textarea {
	width: 100%;
	min-height: 46px;
	padding: 0.6rem 0.75rem;
	font-size: 16px;
	border: 1px solid var(--aprfq-border);
	border-radius: var(--aprfq-radius);
	background: var(--aprfq-bg);
	color: var(--aprfq-text);
}

.aprfq-field textarea {
	min-height: 90px;
	resize: vertical;
}

.aprfq-field textarea.aprfq-message-small {
	min-height: 60px;
}

.aprfq-field input:focus,
.aprfq-field textarea:focus {
	outline: 2px solid var(--aprfq-primary);
	outline-offset: 1px;
}

.aprfq-selected-parts-summary {
	font-size: 0.9rem;
	color: var(--aprfq-muted);
}

.aprfq-selected-parts-summary div {
	padding: 0.15rem 0;
	word-break: break-word;
}

.aprfq-form-error {
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
	padding: 0.65rem 0.85rem;
	border-radius: var(--aprfq-radius);
	margin-bottom: 0.9rem;
}

.aprfq-form-error[hidden] {
	display: none;
}

/* Success state */
.aprfq-success[hidden] {
	display: none;
}

.aprfq-success h3 {
	margin-top: 0;
}

.aprfq-rfq-number {
	font-size: 1.1rem;
}

/* Mobile floating quote button */
.aprfq-float-quote {
	position: fixed;
	right: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 9999;
	min-height: 48px;
	padding: 0 1.1rem;
	border-radius: 999px;
	border: none;
	background: var(--aprfq-primary);
	color: #fff;
	font-weight: 700;
	box-shadow: 0 4px 12px rgba(0,0,0,0.25);
	cursor: pointer;
}

.aprfq-float-quote[hidden] {
	display: none;
}

/* ------------------------------------------------------------ */
/* Responsive breakpoints                                        */
/* ------------------------------------------------------------ */

@media (max-width: 768px) {
	.aprfq-table-scroll {
		display: none;
	}

	.aprfq-cards {
		display: block;
	}

	.aprfq-toolbar {
		flex-direction: column;
	}

	.aprfq-quote-toggle {
		width: 100%;
	}

	.aprfq-quote-panel-inner {
		max-width: 100%;
	}

	.aprfq-part-card-meta {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 576px) {
	.aprfq-title {
		font-size: 1.4rem;
	}

	input.aprfq-search {
		height: 50px;
	}

	.aprfq-quote-panel-inner {
		padding: 1rem;
	}
}

@media (max-width: 400px) {
	.aprfq-part-card-meta {
		grid-template-columns: 1fr;
	}
}

/* ------------------------------------------------------------ */
/* [aviation_parts_search] — compact search widget                */
/* Designed to be dropped into a header, hero section, or         */
/* sidebar without breaking the surrounding theme layout.         */
/* ------------------------------------------------------------ */

.aprfq-search-widget {
	--aprfq-primary: #0b5394;
	--aprfq-primary-hover: #0a4578;
	--aprfq-border: #d7dbe0;
	--aprfq-text: #1f2937;
	--aprfq-bg: #ffffff;
	--aprfq-radius: 6px;

	box-sizing: border-box;
	max-width: 100%;
	width: 100%;
}

.aprfq-search-widget *,
.aprfq-search-widget *::before,
.aprfq-search-widget *::after {
	box-sizing: border-box;
}

.aprfq-search-widget-heading {
	margin: 0 0 0.5rem;
	font-weight: 600;
	color: var(--aprfq-text);
}

.aprfq-search-admin-warning {
	margin: 0 0 0.5rem;
	padding: 0.5rem 0.75rem;
	background: #fff8e1;
	border: 1px solid #f5c451;
	border-radius: var(--aprfq-radius);
	font-size: 0.85rem;
	color: #6b4e00;
}

.aprfq-search-widget-form {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 0.5rem;
	width: 100%;
	max-width: 560px;
	position: relative;
}

.aprfq-search-widget-icon {
	position: absolute;
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	font-size: 16px;
	line-height: 1;
	opacity: 0.6;
	z-index: 1;
}

.aprfq-search-widget-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 50px;
	padding: 0 14px 0 48px;
	font-size: 16px;
	border: 1px solid var(--aprfq-border);
	border-radius: var(--aprfq-radius);
	background: var(--aprfq-bg);
	color: var(--aprfq-text);
}

.aprfq-search-widget-input:focus {
	outline: 2px solid var(--aprfq-primary);
	outline-offset: 1px;
}

.aprfq-search-widget-button {
	flex: 0 0 auto;
	min-height: 44px;
	white-space: nowrap;
}

/* Compact enough to sit inline in a header without wrapping oddly. */
@media (max-width: 480px) {
	.aprfq-search-widget-form {
		flex-direction: column;
	}

	.aprfq-search-widget-input {
		height: 46px;
	}

	.aprfq-search-widget-button {
		width: 100%;
	}
}
