@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Source+Sans+3:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #ededed;
  --panel: #f6f6f6;
  --text: #2b2b2b;
  --muted: #7a7a7a;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #2b2b2b;
  --accent-weak: rgba(0, 0, 0, 0.06);
  --error: #a23b31;
  --radius: 12px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.035'/></svg>");
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: var(--left-width, 2fr) 10px 1fr;
  height: 100vh;
  width: 100%;
  margin: 0;
  border-radius: 0;
  border: none;
  background: var(--panel);
}

.panel {
  padding: 34px 44px;
  background: transparent;
}

.panel-left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overscroll-behavior: contain;
  overflow-y: auto;
}

.panel-divider {
  cursor: col-resize;
  background: transparent;
  position: relative;
}

.panel-divider::before {
  content: "";
  position: absolute;
  inset: 0 4px;
  background: var(--line);
}

.panel-divider.active::before {
  background: var(--line-strong);
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.right-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 24px 28px 0;
}

.history-dock {
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin: 0 28px;
}

.history-view {
  gap: 16px;
}

.history-view .history-dock {
  flex: 1;
  max-height: none;
  margin: 0;
}

.history-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 6px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.history-item button:hover {
  background: var(--accent-weak);
}

.history-address {
  font-size: 13px;
  color: var(--text);
}

.history-egrid {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  background: transparent;
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.right-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-status {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 28px 12px;
}

.status-line {
  color: var(--text);
  font-size: 13px;
}

.bauzone-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.bauzone-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-shell {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fff;
}

#map {
  width: 100%;
  height: 100%;
}

#mapView {
  position: relative;
}

.map-legal {
  font-size: 11px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  padding: 12px 28px 24px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(246, 246, 246, 0) 0%, rgba(246, 246, 246, 0.92) 60%);
}

.map-disclaimer {
  font-size: 11px;
  color: var(--text);
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.left-hero {
  background: #e1e1e1;
  margin: -34px -44px 24px;
  padding: 34px 44px 24px;
  border-radius: 0;
}

.brand-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  color: #3a3a3a;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 6px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 10px 4px;
  background: transparent;
  color: var(--text);
}

#lang-select {
  font-size: 12px;
  padding: 6px 4px;
  width: 64px;
}

select:focus,
input:focus {
  outline: none;
  border-bottom-width: 2px;
}

input {
  flex: 1;
}

.search-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.btn-primary {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.btn-primary:hover {
  background: rgba(31, 29, 26, 0.06);
  border-color: rgba(31, 29, 26, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-text {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 6px;
}

.progress {
  position: absolute;
  left: 44px;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.3s ease, height 0.3s ease;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.progress-quote {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(31, 29, 26, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.18s linear;
}

.progress-meta {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.error-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(162, 59, 49, 0.3);
  border-radius: 12px;
  background: rgba(162, 59, 49, 0.08);
  color: var(--error);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.error-banner[hidden] {
  display: none;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  position: relative;
  flex: 1;
}

.egrid-badge {
  align-self: flex-end;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.egrid-label {
  color: var(--muted);
}

.egrid-value {
  color: var(--text);
  font-weight: 600;
}

.card {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 20px 0;
  box-shadow: none;
}

.restrictions-card {
  border-left: none;
  border-right: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.card-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
}

.card-subtitle {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: -6px;
  margin-bottom: 12px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: none;
}

.row-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 0 0 180px;
}

.row-value {
  flex: 1;
  font-size: 14px;
}

.row-value a {
  color: var(--accent);
  text-decoration: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.list-item:last-child {
  border-bottom: none;
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.accordion-item {
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}

.accordion-header {
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.accordion-title {
  font-weight: 500;
}

.accordion-panel {
  padding: 0 0 16px;
  border-top: 1px solid var(--line);
  display: none;
}

.restrictions-card .accordion-item {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--line);
}

.restrictions-card .accordion-panel {
  border-top: 1px solid var(--line);
}

.restrictions-card .list {
  gap: 10px;
}

.restrictions-card .list-item {
  border-bottom: none;
  padding: 6px 0;
}

.accordion-item.open .accordion-panel {
  display: block;
}

.section-title {
  margin: 12px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-left .section-title {
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 24px 0;
  background: transparent;
}

.empty-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-text {
  color: var(--muted);
  font-size: 14px;
}

.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  padding-left: 28px;
  padding-right: 28px;
  padding-top: 12px;
}

.pdf-title {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
}

.pdf-body {
  flex: 1;
  position: relative;
  min-height: 0;
}

#pdf-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  border-radius: 0;
  display: none;
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  border: none;
  border-radius: 0;
  position: absolute;
  inset: 0;
  background: var(--panel);
  pointer-events: none;
}

.pdf-body .empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(31, 29, 26, 0.12);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 13px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.show-more {
  margin-top: 10px;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0;
    height: auto;
    border-radius: 0;
  }

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .panel-divider {
    display: none;
  }

  .panel-right {
    padding-top: 0;
    height: auto;
    overflow: visible;
  }

  .right-view {
    overflow: visible;
  }

  .right-header {
    padding: 20px 18px 0;
  }

  .history-dock {
    margin: 0 18px;
  }

  .history-view .history-dock {
    margin: 0;
  }

  .map-status {
    padding: 0 18px 12px;
  }

  .map-legal {
    padding: 12px 18px 20px;
  }

  .pdf-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  #pdf-panel.collapsed {
    display: none;
  }

  .pdf-header {
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 2;
  }

  #pdf-close {
    display: inline-flex;
  }

  .right-header {
    flex-wrap: wrap;
  }
}

@media (min-width: 901px) {
  #pdf-close {
    display: none;
  }
}
