:root {
  --tz-bg: #f4fff4;
  --tz-surface: #ffffff;
  --tz-border: #d7f0d7;
  --tz-text: #123019;
  --tz-muted: #476b50;
  --tz-primary: #2e9b4a;
  --tz-primary-2: #2a8d43;
  --tz-danger: #d64545;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--tz-text);
  background: var(--tz-bg);
}

/* SweetAlert2 adds classes that can set height:auto and collapse full-height layouts */
html.swal2-shown,
body.swal2-shown,
body.swal2-height-auto {
  height: 100% !important;
}

body.swal2-height-auto {
  min-height: 100vh !important;
}

.tz-app {
  height: 100vh;
  min-height: 100vh;
  position: relative;
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  min-height: 240px;
  z-index: 0;
  transition: filter 120ms ease;
}

.tz-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--tz-border);
  padding: 12px 14px;
}

.tz-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Map blur when popups are open */
body.tz-blur #map {
  filter: blur(3px);
}

/* Mobile perf: blur/backdrop-filter can be expensive on some phones */
@media (max-width: 640px) {
  .tz-header { backdrop-filter: none; }
  body.tz-blur #map { filter: none; }
}

/* Keep map visible (lighter backdrop than default) */
.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-backdrop-hide {
  background: transparent !important;
}

/* Custom business pin marker */
.tz-div-icon {
  background: transparent;
  border: none;
}

.tz-pin {
  --tz-pin-color: var(--tz-primary);
  position: relative;
  width: 44px;
  height: 54px;
}

.tz-pin::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 4px;
  width: 36px;
  height: 36px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--tz-pin-color);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.tz-pin::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid var(--tz-pin-color);
}

.tz-pin-head {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.tz-pin-head img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tz-sale {
  border: 1px solid var(--tz-border);
  background: rgba(244, 255, 244, 0.7);
  border-radius: 12px;
  padding: 10px;
}

.tz-sale-title {
  font-weight: 900;
  margin-bottom: 4px;
}

.tz-sale-timer {
  font-weight: 800;
  color: var(--tz-primary);
}

.tz-pin-head .tz-pin-fallback {
  font-weight: 900;
  color: var(--tz-text);
  font-size: 12px;
  line-height: 1;
}

.tz-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.tz-brand .title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.tz-brand .subtitle {
  font-size: 12px;
  color: var(--tz-muted);
}

.tz-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tz-btn {
  border: 1px solid var(--tz-border);
  background: var(--tz-surface);
  color: var(--tz-text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
}

.tz-btn:hover {
  border-color: #bfe7bf;
  transform: translateY(-1px);
}

.tz-btn:active { transform: translateY(0px); }

.tz-btn-primary {
  background: linear-gradient(180deg, var(--tz-primary), var(--tz-primary-2));
  border-color: transparent;
  color: #fff;
}

.tz-btn-primary:hover { filter: brightness(1.02); }

.tz-btn-ghost {
  background: transparent;
}

.tz-link {
  color: var(--tz-primary);
  text-decoration: none;
  font-weight: 700;
}

.tz-page {
  min-height: 100vh;
  padding: 22px 14px;
}

.tz-card {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--tz-surface);
  border: 1px solid var(--tz-border);
  border-radius: 16px;
  padding: 16px;
}

.tz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.tz-h1 {
  font-size: 20px;
  margin: 0;
}

.tz-muted { color: var(--tz-muted); }

.tz-table {
  width: 100%;
  border-collapse: collapse;
}

.tz-table th, .tz-table td {
  border-top: 1px solid var(--tz-border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.tz-table th { color: var(--tz-muted); font-weight: 700; }

/* Swal2 theming */
.tz-popup {
  border-radius: 16px !important;
  border: 1px solid var(--tz-border) !important;
}

/* Better spacing for popup buttons */
.swal2-actions {
  gap: 10px !important;
}

.swal2-actions .tz-btn {
  margin: 0 !important;
}

@media (max-width: 640px) {
  .swal2-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .swal2-actions .tz-btn { width: 100%; }
}

/* Leaflet image sizing override (as requested) */
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
  width: 100%;
}

.tz-title { color: var(--tz-text) !important; }

.tz-html { color: var(--tz-text) !important; }

.tz-input, .tz-textarea {
  width: 100%;
  border: 1px solid var(--tz-border);
  border-radius: 12px;
  padding: 10px 10px;
  font-size: 14px;
  outline: none;
}

.tz-input:focus, .tz-textarea:focus {
  border-color: #bfe7bf;
}

.tz-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.tz-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.tz-biz {
  display: grid;
  gap: 10px;
}

.tz-biz img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--tz-border);
}

.tz-rating {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tz-stars {
  letter-spacing: 1px;
  color: #1f7a34;
  font-size: 16px;
}

.tz-danger {
  border-color: #f0c9c9;
  color: #a12e2e;
}
