/* =========================================================
   OC Member Directory — Frontend
   ========================================================= */

/* Override Gutenberg's constrained-layout max-width */
.is-layout-constrained > .oc-directory-wrap {
	max-width: none !important;
}

/* Ensure [hidden] always wins regardless of display rules on child elements */
.oc-directory-wrap [hidden] {
	display: none !important;
}

.oc-directory-wrap {
	width: 100%;
	max-width: 100%;
	font-size: 15px;
	font-family: inherit;
}

.oc-directory-wrap *,
.oc-directory-wrap *::before,
.oc-directory-wrap *::after {
	box-sizing: border-box;
}

/* ----- Quick search bar --------------------------------- */

.oc-directory-search {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 6px;
	max-width: 50%;
	margin: 0 auto 8px;
}

.oc-directory-search-inner {
	position: relative;
	flex: 1 1 260px;
	min-width: 0;
}

.oc-dir-search-icon {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	pointer-events: none;
	color: #646970;
}

.oc-dir-q {
	width: 100%;
	padding: 7px 10px 7px 32px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 0.9375em;
	/* Safari renders input[type=search] with its own native icon/clear-button
	   decoration (-webkit-appearance: searchfield), which sits on top of our
	   custom icon and padding. Disabling it leaves only our own icon. */
	-webkit-appearance: none;
	appearance: none;
}

.oc-dir-q::-webkit-search-decoration,
.oc-dir-q::-webkit-search-cancel-button,
.oc-dir-q::-webkit-search-results-button,
.oc-dir-q::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
}

.oc-dir-q:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; outline: none; }

.oc-dir-search-btn {
	flex-shrink: 0;
	white-space: nowrap;
}

.oc-dir-search-btn:disabled,
.oc-dir-adv-search-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

.oc-dir-advanced-toggle {
	background: none;
	border: none;
	padding: 0;
	color: #2271b1;
	cursor: pointer;
	font-size: 0.875em;
	text-decoration: underline;
	white-space: nowrap;
}
.oc-dir-advanced-toggle:hover { color: #135e96; }

/* ----- Advanced search panel ---------------------------- */

.oc-directory-advanced {
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #f9f9f9;
	margin-bottom: 10px;
	overflow: hidden;
}

.oc-directory-advanced-body {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
}

.oc-dir-adv-fieldset {
	flex: 1 1 240px;
	border: none;
	padding: 14px 16px 10px;
	margin: 0;
}

.oc-dir-adv-fieldset + .oc-dir-adv-fieldset {
	border-left: 1px solid #dcdcde;
}

.oc-dir-adv-legend {
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #3c434a;
	padding: 0 4px 6px;
}

.oc-dir-adv-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px 12px;
}

.oc-dir-adv-row {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.oc-dir-adv-row label {
	font-size: 0.8125em;
	color: #646970;
	font-weight: 600;
}

.oc-dir-adv-row input[type="text"],
.oc-dir-adv-row select {
	padding: 5px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 0.875em;
	background: #fff;
	width: 100%;
}

.oc-dir-adv-row input[type="text"]:focus,
.oc-dir-adv-row select:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

.oc-dir-adv-actions {
	display: flex;
	gap: 8px;
	padding: 10px 16px 14px;
	border-top: 1px solid #dcdcde;
	background: #f0f0f1;
}

/* ----- Active filter chips ----------------------------- */

.oc-directory-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-bottom: 10px;
	min-height: 0;
}

.oc-dir-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	font-size: 0.75em;
	border: 1px solid #8c8f94;
	border-radius: 20px;
	background: #f0f0f1;
	cursor: pointer;
	line-height: 1.5;
	white-space: nowrap;
}

.oc-dir-chip:hover { background: #dcdcde; }

.oc-dir-chip--clear {
	border-color: #d63638;
	color: #d63638;
	background: #fff;
}
.oc-dir-chip--clear:hover { background: #fcf0f1; }

/* ----- Layout: facet rail + results column ------------- */

.oc-directory-layout {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	width: 100%;
}

/* ----- Refine results rail ----------------------------- */

.oc-directory-facets {
	flex: 0 0 180px;
	min-width: 0;
	position: sticky;
	top: 32px;
}

.oc-directory-facets-inner {
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 12px;
}

.oc-dir-facet-section {
	margin-bottom: 12px;
}

.oc-dir-facet-section:last-child { margin-bottom: 0; }

.oc-dir-facet-section-toggle {
	display: flex;
	align-items: center;
	width: 100%;
	background: none;
	border: none;
	border-bottom: 1px solid #f0f0f1;
	padding: 0 0 4px;
	margin: 0 0 6px;
	cursor: pointer;
	font-size: 0.6875em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #50575e;
	text-align: left;
	line-height: 1.4;
	gap: 0;
}

.oc-dir-facet-section-toggle:hover { color: #2271b1; }

.oc-dir-facet-section-arrow {
	margin-left: auto;
	font-size: 0.85em;
	line-height: 1;
	padding-left: 6px;
	flex-shrink: 0;
}

.oc-dir-facet-section-body { margin-top: 2px; }

.oc-dir-facet-group {
	border: none;
	padding: 0;
	margin: 0 0 10px;
}

.oc-dir-facet-group:last-child { margin-bottom: 0; }

.oc-dir-facet-group-title {
	font-size: 0.75em;
	font-weight: 700;
	color: #3c434a;
	margin-bottom: 4px;
	padding: 0;
}

.oc-directory-facet-label {
	display: flex;
	align-items: baseline;
	gap: 5px;
	padding: 2px 0;
	font-size: 0.8125em;
	cursor: pointer;
	line-height: 1.4;
}

.oc-directory-facet-count {
	color: #646970;
	font-size: 0.8125em;
	margin-left: auto;
	white-space: nowrap;
	flex-shrink: 0;
}

/* Cascade child groups: indent to show drill-down hierarchy */
.oc-dir-facet-group--child {
	margin-left: 10px;
	padding-left: 8px;
	border-left: 2px solid #dcdcde;
}

.oc-dir-facet-group--l2 { margin-left: 18px; }
.oc-dir-facet-group--l3 { margin-left: 26px; }

/* Checked items with (0) count: visible but dimmed so user can uncheck */
.oc-directory-facet-label--zero {
	opacity: 0.45;
}
.oc-directory-facet-label--zero .oc-directory-facet-count {
	color: #a7aaad;
}

.oc-dir-filters-toggle { display: none; }

/* ----- Results column ---------------------------------- */

.oc-directory-results-col {
	flex: 1 1 0;
	min-width: 0;
}

/* ----- Results toolbar (inside results column) --------- */

.oc-directory-results-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid #dcdcde;
}

.oc-directory-count {
	font-size: 0.9375em;
	font-weight: 600;
	color: #3c434a;
}

.oc-directory-toolbar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.oc-directory-sort {
	display: flex;
	align-items: center;
	gap: 4px;
}

.oc-directory-sort-label {
	font-size: 0.8125em;
	color: #646970;
	white-space: nowrap;
}

.oc-dir-sort-select {
	padding: 4px 8px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 0.875em;
}

.oc-dir-sort-dir {
	cursor: pointer;
	padding: 3px 7px;
	font-size: 0.875em;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	background: #fff;
	line-height: 1;
}

/* ----- Member cards grid -------------------------------- */

.oc-directory-results {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 240px, 1fr ) );
	gap: 12px;
}

/* State messages (loading / empty / error) span all columns */
.oc-directory-results > .oc-directory-loading,
.oc-directory-results > .oc-directory-empty-state,
.oc-directory-results > .oc-directory-no-results,
.oc-directory-results > .oc-directory-error {
	grid-column: 1 / -1;
}

.oc-directory-member {
	display: flex;
	flex-direction: column;
	padding: 16px 18px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.06);
	transition: box-shadow 0.15s, border-color 0.15s;
}

.oc-directory-member:hover {
	border-color: #a7aaad;
	box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

/* Card header: name + decade badges */
.oc-directory-member-header {
	margin-bottom: 10px;
}

.oc-directory-member-name {
	font-size: 1.05em;
	font-weight: 700;
	color: #1e1e1e;
	margin: 0 0 6px;
	line-height: 1.3;
}

.oc-directory-member-decades {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.oc-directory-era-tag {
	font-size: 0.7em;
	font-weight: 600;
	background: #e8f4fd;
	color: #2271b1;
	padding: 2px 7px;
	border-radius: 10px;
	letter-spacing: 0.02em;
}

/* Profile fields: label/value pairs */
.oc-directory-member-fields {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin: 0 0 10px;
}

.oc-directory-member-fields:last-child { margin-bottom: 0; }

.oc-directory-member-field {
	display: flex;
	gap: 6px;
	align-items: baseline;
	font-size: 0.8125em;
	line-height: 1.5;
}

.oc-directory-member-field dt {
	color: #646970;
	white-space: nowrap;
	flex-shrink: 0;
	min-width: 80px;
}

.oc-directory-member-field dt::after { content: ':'; }

.oc-directory-member-field dd {
	margin: 0;
	color: #3c434a;
	word-break: break-word;
}

.oc-directory-member-field a { color: #2271b1; text-decoration: none; }
.oc-directory-member-field a:hover { text-decoration: underline; }

/* Associate section */
.oc-directory-associate {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #f0f0f1;
}

.oc-directory-associate-heading {
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #50575e;
	margin: 0 0 6px;
}

.oc-directory-associate-info {
	font-size: 0.8125em;
	color: #3c434a;
	margin: 0;
	line-height: 1.6;
}

.oc-directory-associate-info a { color: #2271b1; text-decoration: none; }
.oc-directory-associate-info a:hover { text-decoration: underline; }

/* Garage section */
.oc-directory-garage {
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid #f0f0f1;
}

.oc-directory-garage-heading {
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #50575e;
	margin: 0 0 6px;
}

.oc-directory-garage-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.oc-dir-vehicle {
	display: flex;
	flex-direction: row;
	gap: 10px;
	align-items: flex-start;
}

.oc-dir-vehicle-thumb {
	flex-shrink: 0;
	width: 60px;
	height: 48px;
	object-fit: cover;
	border-radius: 5px;
	background: #f0f0f1;
}

img.oc-dir-vehicle-thumb {
	cursor: pointer;
	transition: opacity 0.15s, box-shadow 0.15s;
}

img.oc-dir-vehicle-thumb:hover {
	opacity: 0.85;
	box-shadow: 0 0 0 2px #2271b1;
}

.oc-dir-vehicle-thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #b0b5ba;
}

.oc-dir-vehicle-thumb--empty svg {
	width: 28px;
	height: 28px;
}

.oc-dir-vehicle-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.oc-dir-vehicle-header {
	font-size: 0.85em;
	font-weight: 600;
	color: #3c434a;
	line-height: 1.4;
}

.oc-dir-vehicle-sub {
	font-size: 0.78em;
	color: #646970;
	line-height: 1.4;
}

.oc-dir-vehicle-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 3px;
}

.oc-dir-vpill {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 0.7em;
	padding: 2px 7px;
	border-radius: 10px;
	font-weight: 500;
	line-height: 1.5;
}

.oc-dir-vpill--cond {
	background: #fef8e7;
	color: #7a5c00;
	border: 1px solid #f0d050;
}

.oc-dir-vpill--op-green {
	background: #edfaee;
	color: #1a6b26;
	border: 1px solid #7ed688;
}

.oc-dir-vpill--op-amber {
	background: #fef9ec;
	color: #7a4f00;
	border: 1px solid #f0c040;
}

.oc-dir-vpill--op-red {
	background: #fdf2f2;
	color: #8b1a1a;
	border: 1px solid #e8a0a0;
}

.oc-directory-garage-empty {
	font-size: 0.8125em;
	color: #646970;
	margin: 0;
	font-style: italic;
}

/* ----- States ------------------------------------------ */

.oc-directory-loading,
.oc-directory-empty-state,
.oc-directory-no-results,
.oc-directory-error {
	padding: 40px 16px;
	text-align: center;
	color: #646970;
	font-size: 0.9375em;
}

.oc-directory-error { color: #d63638; }

/* No-results state with action buttons */
.oc-directory-no-results {
	padding: 40px 16px;
	text-align: center;
	color: #646970;
	font-size: 0.9375em;
}

.oc-directory-no-results p {
	margin: 0 0 14px;
}

.oc-dir-no-results-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

/* ----- Pagination -------------------------------------- */

.oc-directory-pages {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 16px;
	flex-wrap: wrap;
}

.oc-dir-page-current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 6px;
	border-radius: 3px;
	background: #2271b1;
	color: #fff;
	font-size: 0.875em;
	font-weight: 600;
}

.oc-dir-page-ellipsis {
	color: #646970;
	font-size: 0.875em;
}

/* ----- Mobile drawer ----------------------------------- */

.oc-directory-drawer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	background: #fff;
	border-top: 2px solid #c3c4c7;
	padding: 16px;
	max-height: 75vh;
	overflow-y: auto;
	box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.oc-directory-drawer-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 14px;
}

.oc-directory-drawer-header h3 { margin: 0; font-size: 1em; font-weight: 700; }

.oc-dir-drawer-close {
	font-size: 1.375em;
	background: none;
	border: none;
	cursor: pointer;
	padding: 2px 8px;
	line-height: 1;
	color: #3c434a;
}

.oc-directory-drawer-footer { margin-top: 16px; text-align: right; }

/* ----- Toast ------------------------------------------- */

.oc-directory-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 10000;
	padding: 12px 20px;
	background: #1e1e1e;
	color: #fff;
	border-radius: 4px;
	font-size: 0.875em;
	box-shadow: 0 2px 10px rgba(0,0,0,0.3);
	max-width: 320px;
}

.oc-directory-toast--error { background: #d63638; }

/* ----- Notice ------------------------------------------ */

.oc-directory-notice {
	padding: 12px 16px;
	background: #f0f0f1;
	border-left: 4px solid #8c8f94;
	margin: 16px 0;
	font-size: 0.9375em;
}

/* =========================================================
   Mobile — ≤ 680px
   ========================================================= */

@media ( max-width: 680px ) {

	.oc-directory-layout {
		flex-direction: column;
		align-items: stretch;
	}

	.oc-directory-facets {
		flex: none;
		width: 100%;
		position: static;
	}

	/* Hide desktop facet list; show mobile toggle instead */
	.oc-directory-facets-inner { display: none; }
	.oc-dir-filters-toggle {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		width: 100%;
		justify-content: center;
	}

	.oc-directory-search { max-width: 100%; flex-wrap: wrap; }

	.oc-directory-search-inner { flex: 1 1 100%; }

	.oc-dir-adv-fieldset + .oc-dir-adv-fieldset { border-left: none; border-top: 1px solid #dcdcde; }

	.oc-dir-adv-grid { grid-template-columns: 1fr; }

	.oc-directory-results-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}

	.oc-directory-toolbar-actions { width: 100%; justify-content: flex-end; }

	.oc-directory-results {
		grid-template-columns: 1fr;
	}
}

/* ----- Vehicle photo gallery overlay ------------------- */

.oc-dir-gallery-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
	z-index: 100000;
	align-items: center;
	justify-content: center;
	gap: 0;
}

.oc-dir-gallery-overlay.is-open {
	display: flex;
}

.oc-dir-gallery-stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	max-width: min(90vw, 900px);
}

.oc-dir-gallery-img {
	max-width: min(90vw, 900px);
	max-height: 78vh;
	object-fit: contain;
	border-radius: 4px;
	display: block;
}

.oc-dir-gallery-caption {
	color: #fff;
	font-size: 1em;
	font-weight: 600;
	margin: 0;
	text-align: center;
}

.oc-dir-gallery-counter {
	color: rgba(255, 255, 255, 0.55);
	font-size: 0.8em;
	margin: 0;
	text-align: center;
}

.oc-dir-gallery-close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: none;
	border: none;
	color: #fff;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	opacity: 0.75;
	padding: 4px 8px;
}

.oc-dir-gallery-close:hover { opacity: 1; }

.oc-dir-gallery-nav {
	background: none;
	border: none;
	color: #fff;
	font-size: 3.5em;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
	padding: 20px 16px;
	flex-shrink: 0;
	user-select: none;
}

.oc-dir-gallery-nav:hover { opacity: 1; }

@media (max-width: 640px) {
	.oc-dir-gallery-prev,
	.oc-dir-gallery-next {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
	}
	.oc-dir-gallery-prev { left: 10px; }
	.oc-dir-gallery-next { right: 10px; }
}

/* ----- Member contact button & overlay ----------------- */

.oc-dir-contact-btn {
	font-size: 0.75em;
	padding: 3px 10px;
	margin-top: 4px;
	margin-bottom: 10px;
	cursor: pointer;
	border-radius: 3px;
	background: none;
	border: 1px solid #c3c4c7;
	color: #50575e;
	line-height: 1.6;
}
.oc-dir-contact-btn:hover { border-color: #2271b1; color: #2271b1; }

.oc-dir-contact-paused-notice {
	font-size: 0.75em;
	color: #8c8f94;
	font-style: italic;
	margin: 4px 0 10px;
}

.oc-dir-contact-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.6);
	z-index: 100001;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.oc-dir-contact-overlay.is-open { display: flex; }

.oc-dir-contact-modal {
	position: relative;
	background: #fff;
	border-radius: 8px;
	padding: 28px 24px 20px;
	width: 100%;
	max-width: 480px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

.oc-dir-contact-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 1.2em;
	color: #646970;
	cursor: pointer;
	line-height: 1;
	padding: 4px 6px;
}
.oc-dir-contact-close:hover { color: #1d2327; }

.oc-dir-contact-title {
	font-size: 1.1em;
	font-weight: 600;
	margin: 0 0 10px;
}

.oc-dir-contact-note {
	font-size: 0.82em;
	color: #646970;
	margin: 0 0 12px;
	line-height: 1.5;
}

.oc-dir-contact-message {
	width: 100%;
	box-sizing: border-box;
	min-height: 120px;
	resize: vertical;
	padding: 8px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 0.9em;
	font-family: inherit;
}
.oc-dir-contact-message:focus { border-color: #2271b1; outline: 2px solid #2271b1; outline-offset: 0; }

.oc-dir-contact-error {
	min-height: 1.4em;
	font-size: 0.82em;
	color: #d63638;
	margin: 6px 0 0;
}

.oc-dir-contact-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 14px;
}

.oc-dir-contact-success {
	text-align: center;
	padding: 16px 0 8px;
	color: #1a6b26;
	font-weight: 500;
}
