/* FlexiWrap styles (existing file) */

.flexiwrap-wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.flexiwrap-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.flexiwrap-card{
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  overflow:hidden;
  background:#fff;
}

.flexiwrap-card__media{
  display:block;
  aspect-ratio: 4 / 3;
  background:#f2f2f2;
  overflow:hidden;
}

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

.flexiwrap-card__placeholder{
  width:100%;
  height:100%;
}

.flexiwrap-card__body{
  padding: 12px 14px 14px;
}

.flexiwrap-card__price{
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.flexiwrap-card__addr{
  font-size: 14px;
  margin-bottom: 8px;
}

.flexiwrap-card__addr a{
  text-decoration:none;
}

.flexiwrap-card__meta{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  font-size: 12px;
  color:#555;
}

/* Listings controls */
.flexiwrap-controls{
  display:flex;
  flex-wrap:wrap;
  gap: 12px;
  margin: 0 0 18px;
  align-items:center;
}

.flexiwrap-controls label{
  font-size: 12px;
  font-weight: 600;
  color:#444;
}

.flexiwrap-controls select{
  padding: 8px 10px;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  background:#fff;
}

/* Load more */
.flexiwrap-load-more{
  display:flex;
  justify-content:center;
  margin-top: 18px;
}

.flexiwrap-load-more button{
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #d8d8d8;
  background:#fff;
  cursor:pointer;
}

/* Single listing layout */
.flexiwrap-single__header{
  margin-bottom: 14px;
}

.flexiwrap-single__title{
  font-size: 28px;
  margin: 0 0 6px;
}

.flexiwrap-single__price{
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.flexiwrap-single__meta{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  font-size: 13px;
  color:#555;
}

/* Base gallery */
.flexiwrap-gallery{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 28px;
}

.flexiwrap-gallery img{
  width:100%;
  height:auto;
  display:block;
  border-radius: 10px;
}

/* =========================================
   ADDED: Fotorama (single listing gallery)
   ========================================= */

/* IMPORTANT:
   .flexiwrap-gallery is a 2-column grid by default.
   When we use the same class for the Fotorama wrapper, the .fotorama element
   ends up occupying only 1 of 2 columns (i.e., ~50% width).
   This override restores full-width behavior for the Fotorama version.
*/
.flexiwrap-single .flexiwrap-gallery--fotorama{
  /* Override base .flexiwrap-gallery grid so Fotorama can use full width */
  display:block;
  grid-template-columns:none;
  gap:0;

  width: 100%;
  max-width: 1200px;     /* matches your template data-maxwidth */
  margin: 18px auto 28px;
}

/* Force Fotorama itself to be responsive/full width */
.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama{
  width: 100% !important;
  max-width: 100% !important;
}

/* Make sure Fotorama’s generated wrapper also stretches */
.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama__wrap,
.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama__stage,
.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama__stage__frame{
  width: 100% !important;
  max-width: 100% !important;
}

/* Thumbs look nicer + don’t crush */
.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama__nav-wrap{
  margin-top: 10px;
}

.flexiwrap-single .flexiwrap-gallery--fotorama .fotorama__thumb{
  border-radius: 6px;
  overflow:hidden;
}

/* =========================================
   UPDATED: Details (Definition List) layout
   Two columns overall (specs grid)
   ========================================= */

.flexiwrap-dl{
  margin: 10px 0 0;
  padding: 0;

  /* Two columns of rows overall */
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
}

.flexiwrap-dl__row{
  /* Each row is still label/value side-by-side */
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  column-gap: 14px;
  align-items: start;

  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.flexiwrap-dl__row dt{
  margin: 0;
  font-weight: 600;
  color: #333;
}

.flexiwrap-dl__row dd{
  margin: 0;          /* kills default <dd> indent */
  color: #444;
  word-break: break-word;
}

/* Better spacing on small screens */
@media (max-width: 900px){
  .flexiwrap-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Collapse details to one column overall on smaller screens */
  .flexiwrap-dl{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px){
  .flexiwrap-grid{
    grid-template-columns: 1fr;
  }

  .flexiwrap-wrap{
    padding: 18px 12px;
  }

  .flexiwrap-single__title{
    font-size: 22px;
  }

  /* On very small screens, stack label/value within each row */
  .flexiwrap-dl__row{
    grid-template-columns: 1fr;
    row-gap: 4px;
  }
}

/* =========================================
   Listings Filters UI (Search + Sort)
   ========================================= */

.flexiwrap-header{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.flexiwrap-title{
  margin: 0;
}

/* Controls wrapper becomes a “panel” */
.flexiwrap-controls{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;

  padding: 12px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fbfbfb;
}

/* Make forms behave */
.flexiwrap-controls form{
  margin: 0;
}

/* Search form layout: overrides the inline style nicely */
.flexiwrap-search{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  flex: 1 1 560px;
}

/* Sort form sits neatly to the right when there’s room */
.flexiwrap-sort{
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 0 1 auto;
}

/* Label + field stack */
.flexiwrap-controls label{
  display: flex;
  flex-direction: column;
  gap: 6px;

  font-size: 12px;
  font-weight: 600;
  color: #3e3e3e;
  letter-spacing: 0.2px;
}

/* Inputs/selects */
.flexiwrap-controls input[type="text"],
.flexiwrap-controls input[type="number"],
.flexiwrap-controls select{
  height: 40px;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: #222;
  outline: none;
  min-width: 140px;
}

/* Make the keyword search a little wider */
.flexiwrap-controls input[name="q"]{
  min-width: 240px;
}

/* Focus state (subtle) */
.flexiwrap-controls input:focus,
.flexiwrap-controls select:focus{
  border-color: #bfc9ca;
  box-shadow: 0 0 0 3px rgba(138, 178, 173, 0.18); /* teal-ish, subtle */
}

/* Buttons */
.flexiwrap-controls button{
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #cfd7d8;
  background: #ffffff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: #1e1e1e;
}

/* Primary feel for Apply */
.flexiwrap-search button[type="submit"]{
  border-color: #8ab2ad;
  background: rgba(138, 178, 173, 0.18);
}

/* Hover states */
@media (hover: hover){
  .flexiwrap-controls button:hover{
    background: #f2f2f2;
  }
  .flexiwrap-search button[type="submit"]:hover{
    background: rgba(138, 178, 173, 0.28);
  }
}

/* Reset link */
.flexiwrap-controls a{
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: #444;
  text-decoration: none;
  border: 1px solid transparent;
}

@media (hover: hover){
  .flexiwrap-controls a:hover{
    background: #f2f2f2;
    border-color: #e3e3e3;
  }
}

/* Mobile: let everything breathe */
@media (max-width: 720px){
  .flexiwrap-controls{
    padding: 12px;
  }

  .flexiwrap-search,
  .flexiwrap-sort{
    flex: 1 1 100%;
  }

  .flexiwrap-controls input[name="q"]{
    min-width: 100%;
  }

  .flexiwrap-controls input[type="text"],
  .flexiwrap-controls input[type="number"],
  .flexiwrap-controls select{
    min-width: 100%;
  }

  .flexiwrap-search button[type="submit"],
  .flexiwrap-controls button{
    width: 100%;
  }

  .flexiwrap-controls a{
    width: 100%;
    justify-content: center;
  }
}

/* --- Fix Sort alignment in the controls bar --- */

/* Top-align everything so the Sort block doesn't sink */
.flexiwrap-controls{
  align-items: flex-start; /* was flex-end */
}

/* Push sort to the far right AND keep it top-aligned */
.flexiwrap-sort{
  margin-left: auto;
  align-self: flex-start;
}

/* Ensure the Sort label stacks the same way as the others */
.flexiwrap-sort label{
  align-items: flex-start;
}

/* =========================================
   Keep filters on one row (desktop)
   ========================================= */

/* Force the search form into a single row when there is room */
@media (min-width: 900px){
  .flexiwrap-search{
    flex-wrap: nowrap;
    align-items: flex-end;
  }

  /* Prevent inputs from shrinking awkwardly */
  .flexiwrap-search label{
    flex: 0 0 auto;
  }

  /* Keyword search can grow, others stay compact */
  .flexiwrap-search label:first-child{
    flex: 1 1 280px;
  }

  .flexiwrap-search button[type="submit"]{
    flex: 0 0 auto;
    margin-left: 4px;
  }
}

/* Ensure Sort stays visually aligned */
.flexiwrap-sort{
  margin-left: auto;
  align-self: flex-end;
}

.flexiwrap-search button[type="submit"]{
  font-weight: 700;
  letter-spacing: 0.2px;
}
