/**
 * ThemeREX Auto Dealer - Admin Styles
 *
 * Styles for the vehicle and dealer edit screens in wp-admin.
 *
 * @package ThemeREX\AutoDealer
 */

/* ==========================================================================
   Meta Box Wrapper
   ========================================================================== */

.trx-ad-meta-box {
	padding: 12px 0;
}

.trx-ad-meta-box p.description {
	margin-top: 4px;
	color: #646970;
	font-style: italic;
	font-size: 12px;
}

/* ==========================================================================
   Field Rows
   ========================================================================== */

.trx-ad-field-row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f1;
}

.trx-ad-field-row:last-child {
	border-bottom: none;
}

.trx-ad-field-row label {
	flex: 0 0 150px;
	font-weight: 600;
	text-align: right;
	padding-top: 6px;
	color: #1d2327;
	font-size: 13px;
	line-height: 1.4;
}

.trx-ad-field-row .trx-ad-field-input {
	flex: 1 1 0%;
	min-width: 0;
}

.trx-ad-field-row input[type="text"],
.trx-ad-field-row input[type="number"],
.trx-ad-field-row input[type="url"],
.trx-ad-field-row input[type="email"],
.trx-ad-field-row input[type="date"],
.trx-ad-field-row select,
.trx-ad-field-row textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.trx-ad-field-row textarea {
	min-height: 80px;
	resize: vertical;
}

/* Checkbox row: inline layout */
.trx-ad-field-row--checkbox {
	align-items: center;
}

.trx-ad-field-row--checkbox label {
	flex: 0 0 auto;
	text-align: left;
	padding-top: 0;
	cursor: pointer;
}

.trx-ad-field-row--checkbox input[type="checkbox"] {
	margin-right: 6px;
	width: auto;
}

/* Half-width columns (two fields side by side) */
.trx-ad-field-row--half {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f1;
}

.trx-ad-field-row--half .trx-ad-field-col {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.trx-ad-field-row--half .trx-ad-field-col label {
	flex: 0 0 100px;
	font-size: 12px;
}

.trx-ad-field-row--half .trx-ad-field-col .trx-ad-field-input {
	flex: 1 1 0%;
	min-width: 0;
}

/* ==========================================================================
   Field Groups (Section Separators)
   ========================================================================== */

.trx-ad-field-group {
	margin: 20px 0 10px;
	padding: 0 0 6px;
	border-bottom: 2px solid #2271b1;
}

.trx-ad-field-group h3 {
	margin: 0;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	color: #2271b1;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.trx-ad-field-group:first-child {
	margin-top: 0;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.trx-ad-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
	text-transform: capitalize;
}

.trx-ad-badge--available {
	background-color: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.trx-ad-badge--sold {
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.trx-ad-badge--reserved {
	background-color: #fff3cd;
	color: #856404;
	border: 1px solid #ffeeba;
}

.trx-ad-badge--coming-soon {
	background-color: #d1ecf1;
	color: #0c5460;
	border: 1px solid #bee5eb;
}

/* ==========================================================================
   Listing Quality Bar
   ========================================================================== */

.trx-ad-quality-bar {
	position: relative;
	height: 8px;
	background-color: #e2e4e7;
	border-radius: 4px;
	overflow: hidden;
	margin: 6px 0;
	max-width: 200px;
}

.trx-ad-quality-bar__fill {
	height: 100%;
	border-radius: 4px;
	background: linear-gradient(90deg, #e74c3c 0%, #f39c12 40%, #27ae60 80%, #219a52 100%);
	transition: width 0.4s ease;
}

.trx-ad-quality-bar__label {
	display: inline-block;
	margin-left: 8px;
	font-size: 12px;
	font-weight: 600;
	color: #646970;
	vertical-align: middle;
}

.trx-ad-quality-wrap {
	display: flex;
	align-items: center;
}

/* ==========================================================================
   Vehicle-Type-Specific Field Wrappers
   ========================================================================== */

.trx-ad-ev-fields,
.trx-ad-boat-fields,
.trx-ad-truck-fields {
	display: none;
	margin-top: 8px;
	padding: 12px;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	background-color: #fcfcfc;
}

.trx-ad-ev-fields.is-visible,
.trx-ad-boat-fields.is-visible,
.trx-ad-truck-fields.is-visible {
	display: block;
}

.trx-ad-ev-fields .trx-ad-field-group h3 {
	color: #00a32a;
	border-bottom-color: #00a32a;
}

.trx-ad-boat-fields .trx-ad-field-group h3 {
	color: #0073aa;
	border-bottom-color: #0073aa;
}

.trx-ad-truck-fields .trx-ad-field-group h3 {
	color: #d63638;
	border-bottom-color: #d63638;
}

/* ==========================================================================
   Validation Messages
   ========================================================================== */

.trx-ad-field-error {
	color: #d63638;
	font-size: 12px;
	margin-top: 4px;
	display: none;
}

.trx-ad-field-error.is-visible {
	display: block;
}

.trx-ad-field-warning {
	color: #dba617;
	font-size: 12px;
	margin-top: 4px;
	display: none;
}

.trx-ad-field-warning.is-visible {
	display: block;
}

.trx-ad-field-row input.has-error {
	border-color: #d63638;
	box-shadow: 0 0 0 1px #d63638;
}

.trx-ad-field-row input.has-warning {
	border-color: #dba617;
	box-shadow: 0 0 0 1px #dba617;
}

/* ==========================================================================
   Dealer Meta Box Grid
   ==========================================================================
   Switches the dealer add/edit screen from full-width vertical stacks to a
   2-column grid. Short fields (city/state/zip/lat/lng) sit side-by-side;
   long ones (street address, working hours) span the full width.
   ========================================================================== */

.trx-ad-dealer-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 20px;
	padding: 8px 0 4px;
}

.trx-ad-dealer-cell {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.trx-ad-dealer-cell--full {
	grid-column: 1 / -1;
}

.trx-ad-dealer-cell label {
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
	margin-bottom: 4px;
}

.trx-ad-dealer-cell input[type="text"],
.trx-ad-dealer-cell input[type="email"],
.trx-ad-dealer-cell input[type="url"],
.trx-ad-dealer-cell input[type="tel"],
.trx-ad-dealer-cell textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.trx-ad-dealer-cell .description {
	margin-top: 4px;
	font-size: 12px;
	color: #646970;
	font-style: italic;
}

/* Side-meta-box (Map Location) — narrow column, force single-column. */
#trx_ad_dealer_location .trx-ad-dealer-grid {
	grid-template-columns: 1fr;
	gap: 12px;
}

@media screen and (max-width: 1100px) {
	.trx-ad-dealer-grid {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   Admin List Table Tweaks
   ========================================================================== */

.column-trx_ad_thumb,
.column-trx_ad_dealer_logo {
	width: 70px;
	padding: 8px 10px !important;
}

.column-trx_ad_price {
	width: 110px;
	text-align: right;
}

.column-trx_ad_status {
	width: 110px;
}

.column-trx_ad_quality {
	width: 150px;
}

.column-trx_ad_year {
	width: 60px;
}

.column-trx_ad_mileage {
	width: 90px;
}

.column-trx_ad_dealer_location {
	width: 25%;
}

.column-trx_ad_dealer_phone {
	width: 140px;
}

/* Right-align the price values, not just the header. */
.wp-list-table .column-trx_ad_price {
	text-align: right;
}

/* Thumbnail cell. */
.trx-ad-thumb {
	display: inline-block;
	width: 60px;
	height: 60px;
	border-radius: 4px;
	overflow: hidden;
	background: #f0f0f1;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
	vertical-align: middle;
}

.trx-ad-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.trx-ad-thumb--empty {
	background: linear-gradient(135deg, #f0f0f1 0%, #e2e4e7 100%);
	position: relative;
}

.trx-ad-thumb--empty::after {
	content: "";
	position: absolute;
	inset: 0;
	background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23a7aaad'><path d='M3 5h18v14H3V5zm2 2v10h14V7H5zm3 2h2v2H8V9zm5 5l-2-2-3 3h10l-3-4-2 3z'/></svg>") center/24px 24px no-repeat;
	opacity: 0.6;
}

.trx-ad-muted {
	color: #a7aaad;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 1200px) {
	.trx-ad-field-row--half {
		grid-template-columns: 1fr;
	}
}

@media screen and (max-width: 782px) {
	.trx-ad-field-row {
		flex-direction: column;
		gap: 4px;
	}

	.trx-ad-field-row label {
		flex: 0 0 auto;
		text-align: left;
		padding-top: 0;
	}

	.trx-ad-field-row .trx-ad-field-input {
		width: 100%;
	}

	.trx-ad-field-row--half .trx-ad-field-col {
		flex-direction: column;
		gap: 4px;
	}

	.trx-ad-field-row--half .trx-ad-field-col label {
		flex: 0 0 auto;
		text-align: left;
	}

	.trx-ad-quality-bar {
		max-width: 100%;
	}
}

@media screen and (max-width: 600px) {
	.trx-ad-meta-box {
		padding: 8px 0;
	}

	.trx-ad-field-group h3 {
		font-size: 13px;
	}

	.trx-ad-badge {
		font-size: 11px;
		padding: 1px 6px;
	}
}

/* ==========================================================================
   Settings page — Pro badge on filter-added tabs
   (built-in tabs never carry it; see AdminSettings::renderPage)
   ========================================================================== */

.trx-ad-pro-badge {
	display: inline-block;
	background: #f0b849;
	color: #1d2327;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 3px;
	vertical-align: middle;
	letter-spacing: 0.5px;
}

.nav-tab .trx-ad-pro-badge {
	margin-left: 4px;
	position: relative;
	top: -1px;
}

/* ==========================================================================
   Vehicles list table — column sizing
   ========================================================================== */

.wp-list-table .column-trx_ad_thumb {
	width: 60px;
}

.wp-list-table .column-title {
	min-width: 200px;
}

.wp-list-table .column-trx_ad_year,
.wp-list-table .column-trx_ad_price,
.wp-list-table .column-trx_ad_status,
.wp-list-table .column-trx_ad_condition,
.wp-list-table .column-trx_ad_quality,
.wp-list-table .column-trx_ad_featured {
	white-space: nowrap;
}

/* ==========================================================================
   Settings — Custom Fields tab table
   ========================================================================== */

.trx-ad-fields-table {
	margin-top: 10px;
}

.trx-ad-fields-table th,
.trx-ad-fields-table td {
	padding: 8px 6px;
	vertical-align: middle;
}

.trx-ad-fields-table tbody tr {
	background: #fff;
}

.trx-ad-fields-table tbody tr:nth-child(even) {
	background: #f9f9f9;
}

.trx-ad-fields-table .regular-text,
.trx-ad-fields-table .small-text,
.trx-ad-fields-table select {
	width: 100%;
}

.trx-ad-col-sort {
	text-align: center;
}

/* ==========================================================================
   Settings — Taxonomies tab table
   ========================================================================== */

.trx-ad-tax-table {
	margin-top: 10px;
}

.trx-ad-tax-table th,
.trx-ad-tax-table td {
	padding: 8px 6px;
	vertical-align: middle;
}

.trx-ad-tax-table tbody tr {
	background: #fff;
}

.trx-ad-tax-table tbody tr:nth-child(even) {
	background: #f9f9f9;
}

.trx-ad-tax-table .regular-text {
	width: 100%;
}

.trx-ad-tax-disabled-row {
	opacity: 0.5;
}

.trx-ad-tax-disabled-row td {
	background: #f9f0f0 !important;
}
