/**
 * Auto Listings Archive Styles
 *
 * Corify-inspired styling for /listings/ archive and body-type taxonomy pages.
 * Uses design tokens from single-listing.css for consistency.
 *
 * Section 8 - docs/tasks.md
 */

/* ============================================================================
   Full-Width Layout (No Sidebar)
   ============================================================================ */

/*
 * Note: Sidebar is disabled via body_class filter in functions.php
 * (removes et_right_sidebar, adds et_no_sidebar + et_full_width_page)
 * These styles just ensure proper spacing and max-width.
 */

.post-type-archive-auto-listing #main-content .container {
  max-width: 1280px;
  width: 100%;
  padding-left: 5%;
  padding-right: 5%;
}

#left-area .auto-listings-items ul {
  list-style: none;
  padding: 0;
}

.auto-listings-items.grid-view li .at-a-glance {
  min-height: 66px;
}

.auto-listings-items.grid-view .title {
  padding: 0;
  width: 100%;
}

/* ============================================================================
   Search Form - Auto Listings (Free Version) Markup
   ============================================================================ */

/* Main Search Form Container */
.post-type-archive-auto-listing .auto-listings-search {
  background: #eaf0f8;
  border-radius: 8px;
  padding: 24px;
  margin: 0 0 36px 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  width: 100%;
  max-width: 100%;
}

/* Condition Row - "I'm looking for" */
.post-type-archive-auto-listing .auto-listings-search .row.condition-wrap {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.condition-wrap
  .field.condition {
  text-align: center;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.condition-wrap
  .prefix {
  color: #004781;
  font-size: 28px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0px;
}

/* Price Row - Inline Fields */
.post-type-archive-auto-listing .auto-listings-search .row.price-wrap {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.post-type-archive-auto-listing .auto-listings-search .row.price-wrap .field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-type-archive-auto-listing .auto-listings-search .row.price-wrap .prefix {
  font-size: 16px;
  font-weight: 400;
  color: #454c63;
  white-space: nowrap;
}

.post-type-archive-auto-listing .auto-listings-search .row.price-wrap select {
  background: #fff;
  border: 1px solid #dcddde;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 16px;
  color: #454c63;
  min-height: 48px;
  min-width: 120px;
}

/* Area Row - Location Search with Button */
.post-type-archive-auto-listing .auto-listings-search .row.area-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.area-wrap
  .field.within {
  flex-shrink: 0;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.area-wrap
  .field.within
  select {
  background: #fff;
  border: 1px solid #dcddde;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 16px;
  color: #454c63;
  min-height: 48px;
  min-width: 140px;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.area-wrap
  input.area {
  flex: 1;
  background: #fff;
  border: 1px solid #dcddde;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 16px;
  color: #454c63;
  min-height: 48px;
}

/* Primary search row for Make/Model moved out of extras (advanced) */
.post-type-archive-auto-listing .auto-listings-search .row.primary-search-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.primary-search-wrap
  .field {
  flex: 1;
}

/* Hide duplicate Make/Model fields inside the advanced extras row */
.post-type-archive-auto-listing
  .auto-listings-search
  .row.extras-wrap
  .field.make,
.post-type-archive-auto-listing
  .auto-listings-search
  .row.extras-wrap
  .field.model {
  display: none;
}

/* Search Button */
.post-type-archive-auto-listing .auto-listings-search .al-button {
  background: #5b85d5;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 48px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.post-type-archive-auto-listing .auto-listings-search .al-button:hover {
  background: #004781;
}

/* More Refinements Toggle */
.post-type-archive-auto-listing .auto-listings-search a.refine {
  color: #5b85d5;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  margin-bottom: 16px;
}

.post-type-archive-auto-listing .auto-listings-search a.refine:hover {
  color: #004781;
}

.post-type-archive-auto-listing .auto-listings-search a.refine i {
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.post-type-archive-auto-listing .auto-listings-search a.refine.active i {
  transform: rotate(180deg);
}

/* Advanced Fields Container - Extras Row */
.post-type-archive-auto-listing .auto-listings-search .row.extras-wrap {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.post-type-archive-auto-listing .auto-listings-search .row.extras-wrap.active {
  display: grid;
}

.post-type-archive-auto-listing
  .auto-listings-search
  .row.extras-wrap
  .field
  select {
  background: #fff;
  border: 1px solid #dcddde;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 16px;
  color: #454c63;
  min-height: 48px;
  width: 100%;
}

.auto-listings-pagination {
  display: flex;
  float: none;
  justify-content: center;
  margin-top: 60px;
}

/* not ul.page-numbers */
.page-numbers:not(ul.page-numbers) {
  cursor: pointer;
}

.auto-listings-pagination ul {
  display: flex;
  flex-wrap: wrap;
  grid-gap: 10px;
  list-style: none !important;
}

.auto-listings-pagination ul .page-numbers:not(.dots).current,
.auto-listings-pagination ul .page-numbers:not(.dots):hover {
  background: #ce8339;
  color: #fff;
  text-decoration: none;
}

.auto-listings-pagination ul li span.current,
.auto-listings-pagination ul li span.dots {
  pointer-events: none;
  cursor: not-allowed;
}

.auto-listings-pagination ul .page-numbers {
  align-items: center;
  background: #edeff1;
  border: none;
  color: #293957;
  display: flex;
  font-size: 14px;
  height: 35px;
  justify-content: center;
  width: 35px;
}

/* ===== Auto Listings Search Form Customization ===== */

.post-type-archive-dealer .als {
  background: #f5f6f6;
  margin-top: 70px;
  margin-bottom: 93px;
  background: #f5f6f6;
}

@media (min-width: 768px) {
  .post-type-archive-dealer .als .als-field {
    flex: 0 0 33.33%;
    max-width: 33.33%;
  }
}

@media all and (max-width: 767px) {
  .post-type-archive-dealer .als {
    margin-bottom: 50px;
  }
}

.post-type-archive-dealer .als .SelectBox,
.post-type-archive-dealer .als input {
  background: #fff;
}

.auto-listings-sidebar .als {
  margin: 0;
  padding: 0;
}

.auto-listings-sidebar .als--one-col {
  padding: 25px 25px 50px;
  border: 1px solid #d7dce6;
  border-radius: 2px;
}

.als {
  background-color: var(--mg-bg-color-box);
  border-radius: 3px;
  border-radius: var(--mg-radius-box);
  color: var(--mg-color-primary);
  font-size: 14px;
  margin: 0 -85px 40px;
  padding: 65px 85px;
  position: relative;
  text-align: left;
}

@media (max-width: 1439px) {
  .als {
    margin: 0 0 40px;
    padding: 60px;
  }
}

@media (max-width: 767px) {
  .als {
    padding: 30px;
  }
}

.als .row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  margin: -10px;
}

.als input[type="text"] {
  height: 100%;
  width: 100%;
  padding: 30px 13px 10px;
  background: #f9f9f9;
  border-radius: 2px;
}

.als input[type="text"]::-webkit-input-placeholder {
  font-size: 16px;
}

.als input[type="text"]::-moz-placeholder {
  font-size: 16px;
  opacity: 1;
}

.als input[type="text"]:-ms-input-placeholder {
  font-size: 16px;
}

.als input[type="text"]:hover {
  border-color: var(--mg-color-tertiary);
}

.als input[type="text"]:active,
.als input[type="text"]:focus {
  border-color: var(--mg-color-primary);
}

.als .SumoSelect:not(.open):hover > .SelectBox {
  border-color: var(--mg-color-tertiary);
}

.als .SumoSelect.open > .SelectBox {
  background: #fff;
  border-color: var(--mg-color-primary);
}

.als .SumoSelect.open > .optWrapper {
  top: 65px;
}

.als .SumoSelect.open > .optWrapper ul {
  list-style: none !important;
  padding: 0 !important;
}

.als .SumoSelect > .optWrapper > .options li.opt {
  padding: 6px 12px;
}

.als .SumoSelect > .optWrapper.multiple > .options li.opt {
  padding: 6px 12px 6px 41px;
}

.als .SumoSelect > p.SelectBox {
  width: 100%;
  line-height: 1.875;
  padding: 23px 13px 5px;
  background: #f9f9f9;
  box-shadow: none;
  border-color: #d7dce6;
}

.als .SumoSelect > p.SelectBox > span {
  font-style: normal;
  color: #737f96;
  font-size: 16px;
  padding-right: 5px;
}

.als .SumoSelect > p.SelectBox label > i {
  font-style: normal;
  opacity: 1;
  color: var(--mg-color-primary);
  background-image: none;
  text-align: center;
  margin: auto auto 12px;
  font-size: 18px;
  width: 18px;
  height: 18px;
  line-height: 18px;
}

.als .SumoSelect > p.SelectBox label > i:before {
  content: "\f3d0";
  display: inline-block;
  font-family: "Ionicons";
  font-style: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.als-is-selected .SumoSelect > p.SelectBox {
  border-color: var(--mg-color-primary);
}

.als-is-selected .SumoSelect > p.SelectBox span {
  color: var(--mg-color-primary);
}

.als-body {
  margin-bottom: 34px;
}

@media (max-width: 991px) {
  .als-body .row > div {
    width: 100%;
  }
}

.als-body__left {
  padding: 10px;
  width: 85.47009%;
}

@media (min-width: 576px) {
  .als-body__left .als-field {
    max-width: 50%;
    flex: 0 0 50%;
  }
}

@media (min-width: 768px) {
  .als-body__left .als-field {
    max-width: 25%;
    flex: 0 0 25%;
  }
}

.als-body__right {
  width: 14.52991%;
  padding: 10px;
  align-self: flex-end;
}

.als-body__right button {
  margin-bottom: 0;
  width: 100%;
}

.als-field {
  position: relative;
  display: flex;
  padding: 10px;
}

.als-body__left .als-field {
  margin-bottom: 0;
}

.als-field.is-selected .SelectBox {
  background: #fff;
  border-color: var(--mg-color-primary);
}

.als-field.is-selected .SelectBox > span {
  color: var(--mg-color-primary);
}

.als-field .SumoSelect {
  width: 100%;
}

.als-field__label {
  color: var(--mg-color-primary);
  font-weight: bold;
  line-height: 18px;
  position: absolute;
  text-transform: uppercase;
  top: 19px;
  left: 24px;
  z-index: 1;
  font-size: 12px;
}

.als-field--condition {
  padding: 0;
}

@media (max-width: 575px) {
  .als-field--condition {
    width: 100%;
  }
  .als-field--condition .als-field__radio {
    width: 100%;
    display: flex;
    flex-direction: column;
    grid-gap: 5px;
  }
  .als-field--condition span {
    width: 100%;
  }
}

.als-field--condition .als-field__radio span {
  font-size: 14px;
  background: none;
  display: inline-block;
  font-weight: bold;
  border-radius: 2px;
  transition: 0.3s ease;
  padding: 5px 15px;
  text-transform: uppercase;
  cursor: pointer;
}

.als-field--condition input[type="radio"] {
  position: absolute;
  left: -9999px;
}

.als-field--condition input[type="radio"]:checked + span {
  color: #fff;
  background: var(--mg-color-tertiary);
}

@media (max-width: 767px) {
  .als-field--condition {
    margin-bottom: 15px;
  }
  .als-field--condition .prefix {
    margin-bottom: 15px;
  }
}

button.als-submit {
  padding: 21px 15px;
  line-height: 1;
  background-color: var(--mg-color-secondary);
  font-weight: 700;
  letter-spacing: 0.025em;
  border-radius: 2px;
  border: 1px solid transparent;
}

button.als-submit:hover {
  background: var(--mg-color-primary);
}

button.als-toggle {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

button.als-toggle:after {
  content: "\f3d0";
  display: inline-block;
  font-family: "Ionicons";
  font-style: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin-left: 10px;
}

button.als-toggle.shown:after {
  content: "\f3d8";
}

button.als-reset {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 14px;
}

button.als-reset:before {
  content: "\f21c";
  display: inline-block;
  font-family: "Ionicons";
  font-style: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin-right: 10px;
}

.als .als-title {
  text-transform: uppercase;
  font-weight: 800;
  font-size: 18px;
  margin: 0 25px 0 0;
  padding-bottom: 0;
}

@media (max-width: 767px) {
  .als .als-title {
    margin: 0 25px 10px 0;
  }
}

.als-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.als-header .als-field--condition {
  display: none;
}

.als-footer {
  color: var(--mg-color-primary);
}

.als-footer button {
  color: inherit;
  background: none;
  padding: 0;
}

.als-footer button:before {
  font-weight: 400;
}

.als-footer__action {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: -10px;
}

.als-footer__action > button {
  margin-bottom: 10px;
  line-height: 1;
}

.als-total {
  margin-left: auto;
  font-style: italic;
  text-transform: uppercase;
  font-weight: 500;
}

@media all and (max-width: 767px) {
  .als-total {
    width: 100%;
  }
}

.als-total strong {
  color: var(--mg-color-tertiary);
}

.als-selected {
  margin-bottom: 45px;
}

@media (max-width: 767px) {
  .als-selected {
    margin-bottom: 20px;
  }
}

.als-selected__item {
  font-size: 16px;
  display: inline-block;
}

.als-selected__item:hover i {
  color: var(--mg-color-tertiary);
}

.als-selected__item:not(:last-child) {
  margin-right: 45px;
}

.als-selected__label {
  color: #9fa7b5;
}

.selected-item__value {
  color: var(--mg-color-primary);
}

.als-selected__close {
  cursor: pointer;
  margin-right: 13px;
}

@media all and (max-width: 991px) {
  .als-selected__close {
    margin-right: 3px;
  }
}

.als-selected__close:before {
  content: "\f128";
  display: inline-block;
  font-family: "Ionicons";
  font-style: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.als--one-col .als-title {
  margin-bottom: 26px;
  font-size: 16px;
}

.als--one-col .als-field__label {
  display: none;
}

.als--one-col .als-field {
  padding: 0;
}

.als--one-col .als-field:not(:last-of-type) {
  margin-bottom: 10px;
}

.als--one-col .SumoSelect > .CaptionCont label > i {
  margin: auto;
}

.als--one-col .als-selected__item {
  margin: 0;
  display: block;
}

.als--one-col .als-selected__item:not(:last-of-type) {
  margin: 0 0 15px;
}

@media all and (max-width: 991px) {
  .als--one-col .als-selected__item:not(:last-of-type) {
    margin: 0 30px 15px 0;
  }
}

.als--one-col .als-body,
.als--one-col .als-selected {
  margin-bottom: 32px;
}

.als--one-col .SumoSelect > p.SelectBox {
  padding: 8px 15px;
}

.als--one-col input[type="text"] {
  padding: 11px 15px;
}

.als--one-col .SumoSelect.open > .optWrapper {
  top: 45px;
}

.als--one-col .als-reset {
  width: 100%;
  padding: 18px 5px;
  font-size: 16px;
  background: var(--mg-color-tertiary);
  color: #fff;
}

.als--one-col .als-reset:hover {
  background: var(--mg-color-primary);
}

.als--one-col .opt {
  margin-top: 0;
  border-top: none;
}

.search-selected-item {
  display: inline-block;
}

.search-selected-item:not(.last-of-type) {
  margin-right: 45px;
}

.als-toggle-wrapper {
  display: none;
  margin-top: 10px;
}
