/*
 * BungalovTR - Bölgede Popüler
 * V226 - Related/popular alignment cleanup
 *
 * Goals:
 * - Benzer Bungalovlar + Bölgede Popüler sections share the same visual rhythm.
 * - Reduce excessive vertical gap between the two sections.
 * - Equalize heading spacing and container widths.
 * - Keep grids flush with no extra top margin.
 * - Mobile popular grid: 2 columns x 3 rows (up to 6 businesses).
 */

/* ---------------------------------------------------------
   Shared section rhythm on bungalow detail pages
   --------------------------------------------------------- */
body.single-bungalov .bungalow-related,
body.single-bungalov .btr-popular-region {
  box-sizing: border-box;
}

/* Both sections use the exact same content width. */
body.single-bungalov .bungalow-related > .container,
body.single-bungalov .btr-popular-region > .container {
  width: min(calc(100% - 64px), 1280px);
  margin-inline: auto;
}

/* Benzer Bungalovlar: reduce bottom space so the next section sits closer. */
body.single-bungalov .bungalow-related {
  padding-top: 34px;
  padding-bottom: 26px;
  margin: 0;
}

/* Bölgede Popüler follows with the same spacing system. */
body.single-bungalov .btr-popular-region {
  padding: 26px 0 38px;
  margin: 0;
  background: #fbfaf7;
  border-top: 1px solid rgba(64, 88, 68, .08);
}

/* Heading spacing is identical in both sections. */
body.single-bungalov .bungalow-related .section-head,
body.single-bungalov .btr-popular-region__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

body.single-bungalov .bungalow-related .section-head h2,
body.single-bungalov .btr-popular-region__head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -.025em;
  color: #26372c;
}

/* Remove any inherited top spacing from both card grids. */
body.single-bungalov .bungalow-related .bungalow-grid,
body.single-bungalov .btr-popular-region__grid {
  margin-top: 0;
}

/* ---------------------------------------------------------
   Bölgede Popüler - desktop
   --------------------------------------------------------- */
.btr-popular-region__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 0;
  padding: 0;
}

.btr-popular-region .bungalow-card {
  min-width: 0;
  width: 100%;
  margin: 0;
}

/* ---------------------------------------------------------
   Tablet
   --------------------------------------------------------- */
@media (max-width: 1100px) {
  body.single-bungalov .bungalow-related > .container,
  body.single-bungalov .btr-popular-region > .container {
    width: min(calc(100% - 40px), 1280px);
  }

  .btr-popular-region__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

/* ---------------------------------------------------------
   Mobile - 2 columns, up to 6 businesses / 3 rows
   --------------------------------------------------------- */
@media (max-width: 820px) {
  body.single-bungalov .bungalow-related > .container,
  body.single-bungalov .btr-popular-region > .container {
    width: calc(100% - 24px);
  }

  body.single-bungalov .bungalow-related {
    padding-top: 24px;
    padding-bottom: 18px;
  }

  body.single-bungalov .btr-popular-region {
    padding: 20px 0 28px;
    overflow: visible;
  }

  body.single-bungalov .bungalow-related .section-head,
  body.single-bungalov .btr-popular-region__head {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin: 0 0 12px;
  }

  body.single-bungalov .bungalow-related .section-head h2,
  body.single-bungalov .btr-popular-region__head h2 {
    font-size: 22px;
    line-height: 1.15;
  }

  .btr-popular-region__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    scroll-snap-type: none;
    padding: 0;
    margin: 0;
  }

  .btr-popular-region__grid .bungalow-card {
    min-width: 0;
    width: 100%;
    flex: none;
    margin: 0;
    scroll-snap-align: none;
  }
}

/* Very narrow phones: keep two cards but tighten the gap. */
@media (max-width: 380px) {
  .btr-popular-region__grid {
    gap: 8px;
  }

  body.single-bungalov .bungalow-related .section-head h2,
  body.single-bungalov .btr-popular-region__head h2 {
    font-size: 20px;
  }
}


/* ---------------------------------------------------------
   V226 - Related section cleanup / hard alignment
   --------------------------------------------------------- */
body.single-bungalov .bungalow-related > .container.section-head,
body.single-bungalov .bungalow-related > .container.bungalow-grid,
body.single-bungalov .btr-popular-region > .container {
  width: min(calc(100% - 64px), 1280px) !important;
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.single-bungalov .bungalow-related .bungalow-section-eyebrow {
  display: none !important;
}

body.single-bungalov .bungalow-related .section-head {
  margin-top: 0 !important;
}

@media (max-width: 1100px) {
  body.single-bungalov .bungalow-related > .container.section-head,
  body.single-bungalov .bungalow-related > .container.bungalow-grid,
  body.single-bungalov .btr-popular-region > .container {
    width: min(calc(100% - 40px), 1280px) !important;
  }
}

@media (max-width: 820px) {
  body.single-bungalov .bungalow-related > .container.section-head,
  body.single-bungalov .bungalow-related > .container.bungalow-grid,
  body.single-bungalov .btr-popular-region > .container {
    width: calc(100% - 24px) !important;
  }
}

/* ---------------------------------------------------------
   V227 - Mobile heading hard alignment
   Benzer Bungalovlar and Bolgede Populer start on same axis.
   --------------------------------------------------------- */
@media (max-width: 820px) {
  body.single-bungalov .bungalow-related > .container.section-head,
  body.single-bungalov .btr-popular-region > .container {
    width: calc(100% - 24px) !important;
    max-width: none !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.single-bungalov .bungalow-related .section-head {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    text-align: left !important;
  }

  body.single-bungalov .bungalow-related .section-head > div {
    width: auto !important;
    max-width: none !important;
    flex: 0 1 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
  }

  body.single-bungalov .bungalow-related .section-head h2,
  body.single-bungalov .btr-popular-region__head h2 {
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
  }

  body.single-bungalov .bungalow-related > .container.bungalow-grid,
  body.single-bungalov .btr-popular-region__grid {
    margin-top: 0 !important;
  }
}


/* ---------------------------------------------------------
   V228 - Mobile related title structure fix
   Remove dependency on the old nested wrapper and align the
   title with Bolgede Populer / card grid axis.
   --------------------------------------------------------- */
body.single-bungalov .btr-related-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

body.single-bungalov .btr-related-head .btr-related-title {
  margin: 0;
  padding: 0;
}

@media (max-width: 820px) {
  body.single-bungalov .bungalow-related > .container.btr-related-head,
  body.single-bungalov .bungalow-related > .container.bungalow-grid,
  body.single-bungalov .btr-popular-region > .container {
    box-sizing: border-box !important;
    width: calc(100% - 24px) !important;
    max-width: none !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.single-bungalov .btr-related-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
  }

  body.single-bungalov .btr-related-head .btr-related-title,
  body.single-bungalov .btr-popular-region__head h2 {
    display: block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
  }

  body.single-bungalov .btr-related-head > a {
    margin-left: auto !important;
  }
}

/* ---------------------------------------------------------
   V229 - Final mobile related/popular heading alignment
   Overrides the legacy mobile single-bungalow rule that
   centers .bungalow-related .section-head with !important.
   --------------------------------------------------------- */
@media (max-width: 820px) {
  html.btr-mobile-app body.single-bungalov .bungalow-related .section-head.btr-related-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  html.btr-mobile-app body.single-bungalov .bungalow-related .section-head.btr-related-head .btr-related-title {
    display: block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
  }

  html.btr-mobile-app body.single-bungalov .bungalow-related .section-head.btr-related-head > a {
    display: none !important;
  }

  html.btr-mobile-app body.single-bungalov .btr-popular-region__head {
    justify-content: flex-start !important;
    text-align: left !important;
  }

  html.btr-mobile-app body.single-bungalov .btr-popular-region__head h2 {
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
  }
}

/* BungalovTR V209 - final mobile related/popular regression guard. */
@media (max-width: 820px) {
  html.btr-mobile-app body.single-bungalov .bungalow-related .bungalow-grid,
  html.btr-mobile-app body.single-bungalov .btr-popular-region__grid {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: visible !important;
  }

  html.btr-mobile-app body.single-bungalov .bungalow-related .bungalow-card,
  html.btr-mobile-app body.single-bungalov .btr-popular-region__grid .bungalow-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  html.btr-mobile-app body.single-bungalov .bungalow-related .section-head.btr-related-head,
  html.btr-mobile-app body.single-bungalov .btr-popular-region__head {
    min-width: 0 !important;
    overflow: visible !important;
  }
}

/* ---------------------------------------------------------
   V210 - Mobile Benzer / Bolgede Populer horizontal alignment
   core.css adds --btr-detail-edge padding to .bungalow-related.
   The related section also has its own 12px container margin, which
   caused a double inset on mobile. Keep one shared 12px axis only.
   --------------------------------------------------------- */
@media (max-width: 820px) {
  html.btr-mobile-app body.single-bungalov .bungalow-related {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  html.btr-mobile-app body.single-bungalov .bungalow-related > .container.btr-related-head,
  html.btr-mobile-app body.single-bungalov .bungalow-related > .container.bungalow-grid,
  html.btr-mobile-app body.single-bungalov .btr-popular-region > .container {
    box-sizing: border-box !important;
    width: calc(100% - 24px) !important;
    max-width: none !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}
