:root {
  --ink: #243c34;
  --green: #009a4d;
  --muted: #67766c;
  --line: #dce3da;
  --paper: #f7f8f2;

  /* == COLOR DEL BOTÓN DEL BUSCADOR ====== */
  --search-btn: #ff9705;
  --search-btn-hover: #ff7c01;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, sans-serif;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

button,
.button {
  display: inline-block;
  padding: 13px 21px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover,
.button:hover { background: #007a3d; text-decoration: none; }

/* Encabezado */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1240px;
  margin: auto;
  padding: 12px 28px 8px;
}

.brand { display: block; flex-shrink: 0; width: 220px; max-width: 100%; line-height: 0; margin-top: 8px; margin-left: 10px;}
.brand img { display: block; width: 100%; height: auto; }
nav { display: flex; align-items: center; gap: 20px; font-size: 14px; }
main { max-width: 1184px; margin: auto; padding: 0 0 60px; }

/* Portada */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  overflow: hidden;
  margin-top: 0;
  border-radius: 18px;
  background: #dbe7dc;
}

.hero-copy {
  display: flex;
  align-self: stretch;
  align-items: flex-start;
  justify-content: center;
  padding: 74px 56px 20px 80px;
}

.hero-copy-content {
  width: 100%;
  max-width: 520px;
  text-align: left;
  zoom: 1.1;
}

.hero-copy-content > p:not(.eyebrow) { 
  max-width: 480px; 
  margin-bottom: 0;
}

.hero img { align-self: stretch; width: 100%; height: 100%; min-height: 0; object-fit: cover; }

.eyebrow { color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: 2px; text-transform: uppercase; }
h1 { margin: 15px 0; font-size: 41px; line-height: 1.12; letter-spacing: -1.2px; overflow-wrap: break-word; }
h1 em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }

h2 { font-size: 25px; line-height: 1.3; letter-spacing: -0.6px; }
h3 { line-height: 1.4; }
p { color: var(--muted); }

.pills { display: flex; gap: 10px; margin-top: 26px; }
.pills a { padding: 10px 20px; border-radius: 25px; background: white; font-size: 14px; }

/* Estilos de inputs generales */
label { display: block; margin: 0 0 16px; font-size: 13px; font-weight: 600; }

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid #ccd5cb;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
}

textarea { font-size: 16px; }
input:focus,
select:focus,
textarea:focus { outline: 2px solid #529c85; outline-offset: 2px; }


/* ==========================================================================
   BUSCADOR EN ENCABEZADO (HEADER - PC)
   ========================================================================== */

.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.search-header label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.search-header label span {
  color: var(--muted);
  flex-shrink: 0;
}

.search-header input,
.search-header select {
  margin-top: 0;
  padding: 8px 12px;
  border: 1px solid #ccd5cb;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

#search-city-wrap input {
  width: 120px;
}

.search-header input::placeholder {
  color: #a0aca3;
  opacity: 1;
}

.search-header select {
  color: var(--ink);
}

.search-header select option[value=""],
.search-header select:invalid {
  color: #a0aca3 !important;
}

.search-header select option:not([value=""]) {
  color: var(--ink) !important;
}

.search-header button {
  padding: 8px 16px; font-size: 13px; border-radius: 6px; white-space: nowrap;
  background: linear-gradient(to bottom, #ffbc05, #ff9705);
  border: 1px solid rgba(0,0,0,0.15);
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}
.search-header button:hover {
  background: linear-gradient(to bottom, #ffc733, #e08404);
}


/* ==========================================================================
   BUSCADOR INFERIOR MÓVIL (Por defecto oculto en PC)
   ========================================================================== */
.search-mobile-bottom {
  display: none;
}


/* ==========================================================================
   BUSCADOR EXTENDIDO (MÁS FILTROS)
   ========================================================================== */
.extended-search { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.extended-search summary { padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--green); }
.extended-search-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 6px 14px 12px; }

.extended-search-form label { 
  display: flex; 
  flex-direction: column; 
  align-items: flex-start; 
  gap: 3px; 
  min-width: 0; 
  margin: 0; 
  font-size: 13px; 
  font-weight: 600; 
}

.extended-search-form label span { color: var(--muted); font-size: 12px; }

.extended-search-form input:not([type="hidden"]), .extended-search-form select { 
  width: 120px; 
  min-width: 0; 
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.extended-search-form .filter-short input, .extended-search-form .filter-short select { 
  width: 80px; 
}

.filter-range-group {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
}

.filter-range-group .filter-short input {
  width: 72px !important;
}

.range-separator {
  display: flex;
  align-items: center;
  padding-bottom: 8px;
  color: var(--muted);
  font-weight: bold;
}

.extended-search-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.extended-search-actions a { font-size: 13px; }
.extended-search-actions button { padding: 8px 16px; font-size: 13px; border-radius: 6px; background: var(--search-btn); }
.extended-search-actions button:hover { background: var(--search-btn-hover); }


/* Avisos y resultados */
.sectionhead { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.sectionhead h2 { margin-top: 4px; }
.sectionhead h2 span { color: var(--muted); font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* ==========================================================================
   TARJETAS DE RESULTADOS (Título grande de 1 línea con ellipsis y todo abajo unificado)
   ========================================================================== */
.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-decoration: none; 
}

.card .card-photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: #f0f0f0;
}

.card .card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cardbody { 
  padding: 14px 16px; 
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Título más grande (17px) limitado estrictamente a 1 línea con puntos suspensivos (...)[cite: 5] */
.cardbody h3 { 
  margin: 0 0 12px 0; 
  font-size: 17px; 
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contenedor inferior unificado: Metadatos y Precio en la misma línea[cite: 5] */
.card-footer-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto; 
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* Ciudad y Tipo a la izquierda[cite: 5] */
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
}

.card-location {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-type {
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Precio a la derecha en la misma línea[cite: 5] */
.card-price {
  flex-shrink: 0;
}

.card-price strong { 
  font-size: 17px; 
  font-weight: 700;
  color: var(--green);
}

/* Ficha del Aviso */
.listing-detail { max-width: 1050px; }
.back-link { display: inline-block; margin-bottom: 20px; font-weight: 600; }

.listing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}

.listing-media {
  overflow: hidden;
  border-radius: 12px;
  background: #edf0e5;
}

.listingphoto {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 740 / 466;
  margin: 0;
  border-radius: 12px;
  object-fit: cover;
}

.listing-info .location { margin-top: -5px; font-size: 15px; }
.listing-info .price { margin: 15px 0 20px; color: var(--green); font-size: 32px; font-weight: 800; }

.advertiser-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.advertiser-card h3 { margin: 0 0 5px; font-size: 18px; }
.advertiser-card h3 small { color: var(--muted); font-weight: 400; }
.advertiser-card p { margin: 0 0 15px; font-size: 14px; }

.button-wa {
  display: block;
  width: 100%;
  background: #25d366;
  text-align: center;
}
.button-wa:hover { background: #1eb956; }

.empty { padding: 45px; border: 1px dashed #b7c9bb; border-radius: 12px; text-align: center; }

/* Bloques generales y Pie de página */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 45px;
  padding: 25px 32px;
  border-radius: 12px;
  background: #e5eddf;
}

.panel { margin: 30px auto; padding: 35px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.narrow { max-width: 750px; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.box { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; }

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px max(28px, calc((100% - 1184px) / 2));
  border-top: 1px solid var(--line);
  background: #eef1e8;
  text-align: center;
}

footer small { color: var(--muted); }
footer .footer-tagline {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.25;
}

footer .footer-tagline strong { color: var(--ink); font-size: 16px; }
footer .footer-tagline span { color: var(--muted); font-size: 13px; }
footer .footer-notice { max-width: 760px; margin: 0 0 6px; font-size: 12px; line-height: 1.3; }
footer .footer-credit { margin: 0; font-size: 12px; line-height: 1.25; }

.description {
    column-count: 2;
    column-gap: 30px;
    orphans: 2;
    widows: 2;
}


/* ==========================================================================
   RESPONSIVE: PANTALLAS MEDIANAS (Hasta 900px)
   ========================================================================== */
@media (max-width: 900px) {
  main { padding: 0 20px 40px; }
  .top { flex-wrap: wrap; }
  .search-header { order: 3; width: 100%; flex-wrap: wrap; }
  .hero .hero-copy { padding: 25px; }
  .hero-copy-content { zoom: 1; }
  h1 { font-size: 32px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .listing-grid { grid-template-columns: 1fr; gap: 20px; }
  .description { column-count: 1; }
}


/* ==========================================================================
   RESPONSIVE: MÓVILES (Hasta 700px)
   ========================================================================== */
@media (max-width: 700px) {
  .top { 
    padding: 6px 14px; 
    flex-wrap: nowrap; 
    justify-content: space-between;
    align-items: center; 
    gap: 10px;
    padding-right: 20px;
  }
  
  .brand { 
    display: block; 
    width: 200px;
    max-width: 70%;
    margin-bottom: 0;
    line-height: 0; 
    flex-shrink: 0;
    margin-top: 10px;
    margin-left: 10px;
  }
  .brand img { display: block; width: 100%; height: auto; }

  nav { 
    display: flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: center; 
    gap: 6px; 
    font-size: 13px;
    margin-right: 5px;
  }

  nav a.account-link-mobile {
    display: block;
    text-align: center;
  }

  nav .button { 
    padding: 6px 10px; 
    font-size: 12px; 
  }

  /* Ocultar el buscador de la cabecera en móviles */
  header.top .search-header,
  .top > .search-header {
    display: none !important;
  }

  .hero { 
    grid-template-columns: 1fr; 
    margin-top: 6px; 
  }

  .hero-copy {
    padding: 20px 20px 12px 20px;
  }
  
  .hero-copy-content > p:not(.eyebrow) {
    font-size: 13.5px;
    line-height: 1.35;
    margin-top: 6px;
    margin-bottom: 0;
  }

  .hero img { max-height: 210px; }
  .grid,
  .twocol { grid-template-columns: 1fr; }
  
  button,
  .button {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Buscador inferior móvil compacto (Rubro, Provincia, Ciudad) */
  .search-mobile-bottom {
    display: flex !important;
    width: 100%;
    margin-top: 15px;
    margin-bottom: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
  }

  .search-mobile-bottom form {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin: 0;
  }

  .search-mobile-bottom label {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 600;
  }

  .search-mobile-bottom label span {
    color: var(--muted);
    flex-shrink: 0;
    width: 30%;
  }

  .search-mobile-bottom input,
  .search-mobile-bottom select {
    width: 70% !important;
    margin-top: 0;
    padding: 8px 10px;
    border: 1px solid #ccd5cb;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px !important;
  }

  /* Control estricto de color para selects en móviles (Gris si está vacío, Negro al seleccionar) */
  .search-mobile-bottom select {
    color: var(--ink);
  }

  .search-mobile-bottom select option[value=""],
  .search-mobile-bottom select:invalid {
    color: #a0aca3 !important;
  }

  .search-mobile-bottom select option:not([value=""]) {
    color: var(--ink) !important;
  }

  .search-mobile-bottom button { 
    width: 100% !important; 
    margin-top: 4px; 
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    background: linear-gradient(to bottom, #ffbc05, #ff9705);
    border: 1px solid rgba(0,0,0,0.15);
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
    cursor: pointer;
  }

  .banner { display: block; }
  .panel { padding: 18px; margin: 15px auto; }
  .inline { flex-wrap: wrap; }
  .sectionhead { align-items: start; }
  
  h1 { font-size: 30px; }
  .listing-info .price { font-size: 26px; }
}


/* ==========================================================================
   UTILIDADES ADICIONALES (Checkboxes)
   ========================================================================== */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 15px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    flex: none;
}