/* ── Heritage Public Pages ───────────────────────────────── */


/* ── Map Page Layout ─────────────────────────────────────── */
.hm-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Override Frappe default container padding for full-width layout */
.hm-page ~ * { display: none; }

.hm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #8B5E3C;
  color: #fff;
  flex-shrink: 0;
}

.hm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.hm-logo {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  flex-shrink: 0;
}
.hm-title { font-size: 1.3rem; font-weight: 700; }

.hm-lang button {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  margin-left: 4px;
  font-size: 0.85rem;
}

.hm-lang button.active {
  background: #fff;
  color: #8B5E3C;
  font-weight: 600;
}

.hm-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.hm-toolbar input,
.hm-toolbar select {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
}

.hm-toolbar input { flex: 1; min-width: 180px; }

.hm-toolbar button {
  background: #8B5E3C;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 18px;
  cursor: pointer;
  font-size: 0.9rem;
}

.hm-toolbar button:hover { background: #A67C52; }

#btn-clear {
  background: #fff;
  color: #dc3545;
  border: 1px solid #dc3545;
}
#btn-clear:hover { background: #dc3545; color: #fff; }

.hm-split {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#map {
  width: 50%;
  height: 100%;
  z-index: 1;
}

.hm-list {
  width: 50%;
  overflow-y: auto;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

#hm-result-bar,
#cards-container,
#btn-more {
  flex-shrink: 0;
}

#btn-more { margin-bottom: 4px; }

/* ── List panel footer ───────────────────────────────────── */
.hm-footer {
  margin-top: 16px;
  padding: 12px 16px;
  border-top: 2px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  text-align: center;
}

.hm-footer-copy {
  font-size: 0.75rem;
  color: #868e96;
  line-height: 1.6;
  direction: rtl;
}

.hm-footer-powered {
  font-size: 0.72rem;
  color: #adb5bd;
}

.hm-footer-powered a {
  color: #8B5E3C;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.hm-footer-powered a:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* ── Building Card ───────────────────────────────────────── */
.hm-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.hm-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }

.hm-card img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.hm-card-no-img {
  width: 80px;
  height: 80px;
  background: #e9ecef;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.hm-card-body { flex: 1; min-width: 0; }

.hm-card-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hm-card-address {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hm-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hm-tag {
  background: #e9ecef;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: #495057;
}

.hm-tag.status-good       { background: #d1fae5; color: #065f46; }
.hm-tag.status-fair       { background: #dbeafe; color: #1e40af; }
.hm-tag.status-poor       { background: #fef3c7; color: #92400e; }
.hm-tag.status-demolished { background: #fee2e2; color: #991b1b; }

.hm-card-link {
  display: inline-block;
  background: #8B5E3C;
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  text-decoration: none;
}

.hm-card-link:hover { background: #A67C52; color: #fff; }

#btn-more {
  width: 100%;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 4px;
}

#btn-more:hover { background: #e9ecef; }

#hm-result-bar {
  padding: 6px 4px;
  color: #8B5E3C;
  font-size: 0.82rem;
  font-weight: 600;
  border-bottom: 1px solid #c7d2fe;
  margin-bottom: 6px;
  text-align: start;
}

/* ── Building Detail Page ────────────────────────────────── */
.bd-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.bd-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.bd-back {
  color: #8B5E3C;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
.bd-back:hover { text-decoration: underline; }

.bd-share-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #1a2a3a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  z-index: 1000;
}
.bd-share-fab:hover {
  background: #C9A84C;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(201,168,76,0.4);
}

.bd-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a2a3a;
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
}
.bd-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bd-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bd-nav-logo {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  object-fit: contain;
  border-radius: 50%;
  border: 2px solid #e9ecef;
  padding: 2px;
  background: #fff;
  flex-shrink: 0;
}
.bd-nav-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a2a3a;
  line-height: 1.2;
  max-width: 100px;
  text-align: center;
}

.bd-main-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  display: block;
}

.bd-main-img-placeholder {
  width: 100%;
  height: 300px;
  background: #e9ecef;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: #adb5bd;
  margin-bottom: 10px;
}

.bd-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.bd-thumbs img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.bd-thumbs img.active,
.bd-thumbs img:hover { border-color: #8B5E3C; }

.bd-name {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.bd-address {
  color: #6c757d;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.bd-divider {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 12px 0;
}

.bd-description {
  line-height: 1.7;
  color: #343a40;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

#bd-mini-map {
  height: 300px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  margin-top: 8px;
}

.bd-directions-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  background: #8B5E3C;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s;
}
.bd-directions-btn:hover { background: #A67C52; color: #fff; }

.bd-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #adb5bd;
  padding: 14px 20px;
  border-top: 1px solid #f1f3f5;
  margin-top: 8px;
}
.bd-footer a {
  color: #adb5bd;
  text-decoration: underline;
}
.bd-footer a:hover { color: #8B5E3C; }

/* ── Frappe web-footer overrides ─────────────────────────── */
footer.web-footer {
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 24px 0 20px;
  margin-top: 0;
}
footer.web-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
footer.web-footer .footer-info {
  width: 100%;
}
footer.web-footer .footer-info .row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
footer.web-footer .footer-col-left,
footer.web-footer .footer-col-right {
  width: 100%;
  text-align: center;
  color: #6c757d;
  font-size: 0.82rem;
  line-height: 1.6;
}
footer.web-footer .footer-col-right {
  color: #adb5bd;
  font-size: 0.78rem;
}
footer.web-footer .footer-col-right a,
footer.web-footer .footer-col-left a {
  color: #8B5E3C;
  text-decoration: none;
  transition: color 0.15s;
}
footer.web-footer .footer-col-right a:hover,
footer.web-footer .footer-col-left a:hover {
  color: #A67C52;
  text-decoration: underline;
}
footer.web-footer .footer-links {
  display: none;
}
footer.web-footer .footer-logo-extension {
  display: none;
}


.bd-404 {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.bd-404 h2 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  color: #343a40;
}

/* ── RTL support ─────────────────────────────────────────── */
[dir="rtl"] .hm-lang button { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .hm-card-link   { direction: rtl; }

/* ── Mobile tab toggle (hidden on desktop) ───────────────── */
.hm-tabs { display: none; }

/* shared mobile mixin — portrait phones AND landscape phones */
@media (max-width: 767px), (max-height: 540px) and (orientation: landscape) {
  .hm-header { padding: 6px 10px; }
  .hm-logo   { width: 32px !important; height: 32px !important; max-width: 32px !important; }
  .hm-title  { font-size: 0.95rem; }
  .hm-lang button { padding: 2px 7px; font-size: 0.78rem; }

  .hm-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px 10px;
  }
  .hm-toolbar input   { grid-column: 1 / -1; min-width: 0; }
  .hm-toolbar button  { grid-column: 1 / -1; }
  .hm-toolbar input,
  .hm-toolbar select  { padding: 5px 8px; font-size: 0.82rem; }

  .hm-tabs {
    display: flex;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 2px solid #dee2e6;
  }
  .hm-tab {
    flex: 1;
    padding: 7px 0;
    border: none;
    background: #fff;
    color: #6c757d;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
  }
  .hm-tab.active { color: #8B5E3C; border-bottom-color: #8B5E3C; }

  .hm-split { flex-direction: column; }

  #map {
    width: 100%;
    flex: 1;
    display: block;
  }

  .hm-list {
    width: 100%;
    flex: 1;
    display: none;
  }

  .hm-card img,
  .hm-card-no-img { width: 60px; height: 60px; }
  .hm-card-name   { font-size: 0.88rem; }

  /* Building detail — mobile */
  .bd-attrs-grid  { grid-template-columns: 1fr; }
  .bd-page        { padding: 10px 12px 32px; }
  .bd-nav         { gap: 6px; flex-wrap: nowrap; }
  .bd-nav-title   { display: none; }
  .bd-nav-logo    { width: 28px !important; height: 28px !important; max-width: 28px !important; }
  .bd-back        { font-size: 0.8rem; white-space: nowrap; }
  .bd-name        { font-size: 1.2rem; }
  .bd-main-img    { max-height: 220px; }
  .bd-thumbs img  { width: 56px; height: 56px; }
}

/* landscape-only: compact toolbar in a single row */
@media (max-height: 540px) and (orientation: landscape) {
  .hm-toolbar {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
  .hm-toolbar input  { grid-column: 1 / 4; }
  .hm-toolbar button { grid-column: 4 / 5; }
}
