/* ==========================================================================
   Parts Procurement v3 – Admin Stylesheet
   ========================================================================== */

/* ── Global ────────────────────────────────────────────────────────────────── */
.pp-wrap {
	max-width: 100%;
	padding-right: 16px;
}

/* ── Search bar ─────────────────────────────────────────────────────────────── */
.pp-search-form {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 16px 0;
}
.pp-search-input {
	width: 320px;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.pp-empty-state {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 40px;
	text-align: center;
	margin-top: 24px;
}
.pp-empty-icon {
	font-size: 48px;
	margin-bottom: 12px;
}
.pp-empty-state h3 {
	margin: 0 0 8px;
	font-size: 18px;
	color: #1d2327;
}
.pp-empty-state p {
	color: #50575e;
}

/* ── Estimates list table ───────────────────────────────────────────────────── */
.pp-estimates-table .pp-col-ro       { width: 130px; }
.pp-estimates-table .pp-col-vehicle  { width: 200px; }
.pp-estimates-table .pp-col-vin      { width: 160px; font-family: monospace; font-size: 12px; }
.pp-estimates-table .pp-col-estimator{ width: 150px; }
.pp-estimates-table .pp-col-received { width: 150px; }
.pp-estimates-table .pp-col-count    { width: 60px; text-align: center; }
.pp-estimates-table .pp-col-progress { width: 260px; }
.pp-estimates-table .pp-col-action   { width: 110px; }
.pp-estimates-table .pp-col-delete   { width: 90px; }

.pp-center { text-align: center; }

/* Row status colours */
.pp-row-complete   td { background-color: #f0fdf4 !important; }
.pp-row-inprogress td { background-color: #fffbeb !important; }

/* ── Sync status line ───────────────────────────────────────────────────────── */
.pp-sync-status-line {
	font-size: 13px;
	color: #50575e;
	margin: 0 0 12px;
}
.pp-sync-ok    { color: #00a32a; }
.pp-sync-error { color: #d63638; }

/* ── Sync Now button row ────────────────────────────────────────────────────── */
.pp-list-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}
.pp-sync-status-label {
	font-size: 13px;
	color: #50575e;
}

/* ── Progress bar ───────────────────────────────────────────────────────────── */
.pp-progress-wrap {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.pp-progress-bar {
	height: 10px;
	background: #e2e4e7;
	border-radius: 5px;
	overflow: hidden;
}
.pp-progress-fill {
	height: 100%;
	background: #2271b1;
	border-radius: 5px;
	transition: width 0.3s ease;
}
.pp-progress-fill.pp-complete {
	background: #00a32a;
}
.pp-progress-label {
	font-size: 11px;
	color: #50575e;
}

/* ── Delete / danger button ─────────────────────────────────────────────────── d63638*/
.pp-btn-danger {
	/*color: white !important;*/
	border-color: #d63638 !important;
}
.pp-btn-danger:hover {
	background: #d63638 !important;
	color: #fff !important;
}
.pp-btn-danger:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */
.pp-breadcrumb {
	margin: 8px 0 16px;
}
.pp-breadcrumb a {
	color: #2271b1;
	text-decoration: none;
	font-size: 13px;
}
.pp-breadcrumb a:hover {
	text-decoration: underline;
}

/* ── Detail header ──────────────────────────────────────────────────────────── */
.pp-detail-header {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 16px 20px;
	margin-bottom: 16px;
}
.pp-detail-title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}
.pp-detail-title-row h1 {
	margin: 0;
	font-size: 22px;
	color: #1d2327;
}
.pp-detail-header h1 {
	margin: 0 0 8px;
	font-size: 22px;
	color: #1d2327;
}
.pp-detail-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	font-size: 13px;
	color: #50575e;
}
.pp-meta-item strong {
	color: #1d2327;
}
.pp-meta-sep {
	color: #c3c4c7;
}

/* ── Detail info card ───────────────────────────────────────────────────────── */
.pp-info-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	margin-bottom: 16px;
	overflow: hidden;
}
.pp-info-section {
	padding: 12px 20px 14px;
	border-bottom: 1px solid #f0f0f1;
}
.pp-info-section:last-child {
	border-bottom: none;
}
.pp-info-section-title {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #8c8f94;
	margin-bottom: 8px;
}
.pp-info-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 32px;
}
.pp-info-item {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.pp-info-label {
	font-size: 11px;
	color: #8c8f94;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.pp-info-value {
	font-size: 13px;
	color: #1d2327;
}
.pp-info-value a {
	color: #2271b1;
	text-decoration: none;
}
.pp-info-value a:hover {
	text-decoration: underline;
}
.pp-vin {
	font-family: monospace;
	font-size: 13px;
	letter-spacing: 0.5px;
}

/* Status badges */
.pp-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.pp-badge-locked {
	background: #f0fdf4;
	color: #00a32a;
	border: 1px solid #a7f3d0;
}
.pp-badge-prelim {
	background: #fffbeb;
	color: #996800;
	border: 1px solid #fcd34d;
}

/* ── Notices ────────────────────────────────────────────────────────────────── */
.pp-notice {
	padding: 10px 14px;
	border-left: 4px solid;
	border-radius: 0 4px 4px 0;
	margin-bottom: 16px;
	font-size: 13px;
}
.pp-notice-info {
	background: #f0f6fc;
	border-color: #2271b1;
	color: #1d2327;
}
.pp-notice-warn,
.pp-notice-warning {
	background: #fff8e5;
	border-color: #f0c33c;
	color: #50575e;
}
.pp-notice a {
	color: #2271b1;
}

/* ── Parts table wrapper (horizontal scroll) ────────────────────────────────── */
.pp-table-scroll-wrap {
	overflow-x: auto;
	margin-bottom: 24px;
}

/* ── Parts table ────────────────────────────────────────────────────────────── */
.pp-parts-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #c3c4c7;
	font-size: 13px;
	min-width: 900px;
}
.pp-parts-table th,
.pp-parts-table td {
	border: 1px solid #e2e4e7;
	padding: 8px 10px;
	vertical-align: middle;
}
.pp-parts-table thead th {
	background: #f6f7f7;
	color: #1d2327;
	font-weight: 600;
	white-space: nowrap;
	text-align: center;
	font-size: 12px;
}
.pp-parts-table tbody tr:hover {
	background: #f8f9fa;
}

/* Column widths */
.pp-th-line     { width: 48px; }
.pp-th-part     { width: 140px; }
.pp-th-alt      { width: 120px; }
.pp-th-desc     { width: 200px; }
.pp-th-supplier { width: 130px; }
.pp-th-price    { width: 80px; }
.pp-th-qty      { width: 44px; }
.pp-th-track    { width: 120px; text-align: center !important; }
.pp-th-bin      { width: 120px; }
.pp-th-picker   { width: 130px; }

.pp-td-line  { text-align: center; font-weight: 600; color: #50575e; }
.pp-td-price { text-align: right;  font-variant-numeric: tabular-nums; }
.pp-td-qty   { text-align: center; }
.pp-td-alt   { color: #50575e; font-size: 12px; }

/* Picked row highlight */
.pp-line-picked {
	background-color: #f0fdf4 !important;
}
.pp-line-picked:hover {
	background-color: #e7faf0 !important;
}

/* ── Part type badges ───────────────────────────────────────────────────────── */
.pp-part-type {
	display: inline-block;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	vertical-align: middle;
}
.pp-type-oem {
	background: #dbeafe;
	color: #1e40af;
}
.pp-type-alt {
	background: #fef9c3;
	color: #854d0e;
}
.pp-type-rec {
	background: #dcfce7;
	color: #166534;
}
/* ── Tracking cell ──────────────────────────────────────────────────────────── */
.pp-td-track {
	text-align: center;
	padding: 4px 6px !important;
	vertical-align: middle;
}
.pp-track-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
}
.pp-track-event-label {
	font-size: 10px;
	color: #50575e;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	font-weight: 600;
	white-space: nowrap;
}
.pp-track-label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	user-select: none;
}
.pp-track-label input[type="checkbox"] {
	display: none;
}

/* Custom checkbox */
.pp-track-custom-checkbox {
	width: 22px;
	height: 22px;
	border: 2px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	cursor: pointer;
	flex-shrink: 0;
}
.pp-track-custom-checkbox:hover {
	border-color: #2271b1;
}
.pp-track-custom-checkbox.pp-checked {
	background: #2271b1;
	border-color: #2271b1;
}
.pp-track-custom-checkbox.pp-checked::after {
	content: '✓';
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}
.pp-track-custom-checkbox.pp-saving {
	background: #e2e4e7;
	border-color: #e2e4e7;
}
.pp-track-custom-checkbox.pp-saving::after {
	content: '…';
	color: #50575e;
	font-size: 12px;
}

/* Timestamp */
.pp-track-time {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}
.pp-track-time.pp-hidden {
	display: none;
}
.pp-time-value {
	font-size: 10px;
	color: #2271b1;
	font-weight: 600;
	white-space: nowrap;
}
.pp-history-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	padding: 0;
	opacity: 0.6;
	transition: opacity 0.15s;
	line-height: 1;
}
.pp-history-btn:hover {
	opacity: 1;
}

/* ── Dropdowns ──────────────────────────────────────────────────────────────── */
.pp-td-dropdown {
	padding: 6px 8px !important;
}
.pp-line-select {
	width: 100%;
	font-size: 12px;
	padding: 4px 6px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	background: #fff;
	cursor: pointer;
}
.pp-line-select:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}
.pp-line-select.pp-saved {
	border-color: #00a32a;
}

/* ── History Modal ──────────────────────────────────────────────────────────── */
.pp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
}
.pp-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.5);
}
.pp-modal-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 6px;
	width: 540px;
	max-width: 90vw;
	max-height: 80vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.pp-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #e2e4e7;
	background: #f6f7f7;
}
.pp-modal-header h2 {
	margin: 0;
	font-size: 16px;
	color: #1d2327;
}
.pp-modal-close {
	background: none;
	border: none;
	font-size: 18px;
	cursor: pointer;
	color: #50575e;
	padding: 0;
	line-height: 1;
}
.pp-modal-close:hover {
	color: #d63638;
}
.pp-modal-body {
	overflow-y: auto;
	padding: 16px 18px;
}

/* History table */
.pp-history-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}
.pp-history-table th {
	background: #f6f7f7;
	padding: 7px 10px;
	text-align: left;
	border-bottom: 2px solid #e2e4e7;
	font-weight: 600;
}
.pp-history-table td {
	padding: 7px 10px;
	border-bottom: 1px solid #f0f0f0;
}
.pp-history-table tr:last-child td {
	border-bottom: none;
}
.pp-history-table .pp-action-checked {
	color: #00a32a;
	font-weight: 600;
}
.pp-history-table .pp-action-unchecked {
	color: #d63638;
	font-weight: 600;
}
.pp-loading {
	text-align: center;
	color: #50575e;
	padding: 20px;
	font-style: italic;
}
.pp-no-history {
	text-align: center;
	color: #50575e;
	padding: 20px;
}

/* ── Settings page ──────────────────────────────────────────────────────────── */
.pp-settings-wrap h1 {
	margin-bottom: 16px;
}
.pp-settings-section {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 20px 24px;
	margin-bottom: 24px;
}
.pp-settings-section h2 {
	margin: 0 0 6px;
	font-size: 16px;
	color: #1d2327;
	border-bottom: 1px solid #e2e4e7;
	padding-bottom: 10px;
}
.pp-section-desc {
	margin: 8px 0 16px;
	color: #50575e;
	font-size: 13px;
}

/* ── Connection configuration ───────────────────────────────────────────────── */
.pp-connection-table {
	margin-bottom: 16px;
}
.pp-connection-table td .description {
	font-size: 12px;
	color: #50575e;
	margin-top: 4px;
}
.pp-connection-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
}
.pp-connection-result {
	font-size: 13px;
	font-weight: 600;
}
.pp-connection-result.pp-ok    { color: #00a32a; }
.pp-connection-result.pp-error { color: #d63638; }

/* API key show/hide */
.pp-key-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}
.pp-key-wrap .regular-text {
	flex: 1;
}
.pp-show-key {
	white-space: nowrap;
}

/* ── Settings tables (Suppliers / BINs / Pickers) ───────────────────────────── */
.pp-setting-table {
	margin-bottom: 12px;
}
.pp-setting-table .pp-setting-name-edit {
	width: 100%;
}
.pp-no-items td {
	color: #50575e;
	font-style: italic;
}
.pp-add-setting-wrap {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-top: 10px;
}
.pp-add-setting-wrap .regular-text {
	flex: 1;
	max-width: 320px;
}

/* ── User access table ──────────────────────────────────────────────────────── */
.pp-user-table {
	margin-top: 8px;
}
.pp-user-email {
	display: block;
	font-size: 12px;
	color: #50575e;
}

/* Toggle label (yes/no) */
.pp-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	user-select: none;
}
.pp-toggle input[type="checkbox"] {
	display: none;
}
.pp-toggle .pp-toggle-label {
	font-size: 12px;
	font-weight: 600;
	color: #50575e;
	padding: 2px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 10px;
	transition: all 0.15s ease;
}
.pp-toggle.pp-toggle-on .pp-toggle-label {
	color: #00a32a;
	border-color: #00a32a;
	background: #f0fdf4;
}

/* ── Responsive tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 960px) {
	.pp-detail-meta {
		flex-direction: column;
		gap: 4px;
	}
	.pp-meta-sep {
		display: none;
	}
}

/* ==========================================================================
   Frontend (shortcode) overrides
   ========================================================================== */

.pp-frontend-wrap {
	max-width: 90%;
	padding: 0;
}
.pp-frontend-wrap h2 {
	font-size: 1.4em;
	margin-bottom: 12px;
}

.pp-autosave-notice {
	display: inline-block;
	background: #edfaed;
	border: 1px solid #00a32a;
	border-radius: 4px;
	color: #00a32a;
	font-size: 13px;
	padding: 6px 12px;
	margin-bottom: 14px;
}

.pp-auth-notice {
	color: #50575e;
	font-size: 14px;
	padding: 12px;
	background: #f6f7f7;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
}

.pp-btn {
	display: inline-block;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	border: 1px solid #2271b1;
	background: #2271b1;
	color: #fff;
	line-height: 1.4;
}
.pp-btn:hover,
.pp-btn:focus {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
	text-decoration: none;
}
.pp-btn-sm {
	padding: 4px 10px;
	font-size: 12px;
}
.pp-btn-secondary {
	background: #f6f7f7;
	border-color: #c3c4c7;
	color: #2c3338;
}
.pp-btn-secondary:hover,
.pp-btn-secondary:focus {
	background: #e9e9e9;
	border-color: #8c8f94;
	color: #2c3338;
}

.pp-frontend-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Toast notification
   ========================================================================== */

#pp-toast {
	position: fixed;
	top: 24px;
	right: 24px;
	z-index: 99999;
	padding: 10px 18px;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	pointer-events: none;
	display: none;
	box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.pp-toast-success {
	background: #00a32a;
	color: #fff;
}
.pp-toast-error {
	background: #d63638;
	color: #fff;
}
