:root {
  --primary-color: #0056b3;
  --primary-light: #1976d2;
  --primary-dark: #003d82;
  --primary-gradient: linear-gradient(135deg, #0056b3 0%, #1976d2 100%);
  --accent-color: #00acc1;
  --accent-light: #4dd0e1;
  --success-color: #4caf50;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #7a8699;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 14px 30px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.16);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html,
body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

main {
  flex: 1 0 auto;
}

footer {
  margin-top: auto;
  position: relative;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%) !important;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-color) 50%, transparent 100%);
}

footer p {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 400;
}

footer a {
  color: rgba(255, 255, 255, 0.9);
}

footer a:hover {
  color: #ffffff;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

h1,
.h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

.display-4 {
  font-family: "Poppins", sans-serif;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lead {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.7;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
  transform: translateY(-0.75rem);
}

.site-logo__mark {
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 16px rgba(0, 86, 179, 0.18));
}

.site-logo__parcel {
  fill: rgba(0, 86, 179, 0.08);
  stroke: var(--primary-color);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.site-logo__grid {
  fill: none;
  stroke: var(--primary-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
  opacity: 0.65;
}

.site-logo__pin {
  fill: var(--accent-color);
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 2;
}

.site-logo__pin-dot {
  fill: #ffffff;
}

.site-logo__text {
  color: var(--primary-dark);
  font-family: "Poppins", sans-serif;
  font-size: 1.3rem;
  line-height: 1;
  white-space: nowrap;
}

.site-logo__text-strong {
  font-weight: 800;
}

.site-logo__text-light {
  font-weight: 500;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-light);
  text-decoration: none;
}

.small {
  font-size: 0.875rem;
  line-height: 1.5;
}

.trust-note {
  display: inline-flex;
  align-items: center;
  max-width: 36rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.trust-note::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.5rem;
  border-radius: 999px;
  background: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.12);
  flex: 0 0 auto;
}

.hero,
.bg-light {
  background-image:
    radial-gradient(1200px 600px at 20% -10%, rgba(0, 86, 179, 0.12), transparent),
    linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
}

.hero {
  min-height: calc(100vh - 78px);
  display: flex;
  align-items: center;
}

.legal-page {
  background-image:
    radial-gradient(1200px 600px at 20% -10%, rgba(0, 86, 179, 0.12), transparent),
    linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.legal-hero {
  min-height: calc(100vh - 78px);
  padding: 4rem 0;
}

.legal-shell {
  max-width: 900px;
  margin: 1rem auto 0;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 86, 179, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.legal-shell h1 {
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.legal-shell h2 {
  margin-top: 2rem;
  font-size: 1.2rem;
}

.legal-shell p,
.legal-shell li {
  color: var(--text-secondary);
}

.legal-shell ul {
  padding-left: 1.25rem;
}

.legal-kicker {
  margin-bottom: 0.25rem;
  color: var(--accent-color) !important;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.legal-updated {
  color: var(--text-muted) !important;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  margin-left: max(0px, calc((100% - 900px) / 2));
}

.bg-primary {
  background: var(--primary-gradient) !important;
}

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

.text-dark {
  color: var(--text-primary) !important;
}

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

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

.search-panel {
  position: relative;
  z-index: 2000;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 !important;
}

body.catastro-map-fullscreen .search-panel {
  position: fixed;
  top: 4rem;
  left: 50%;
  width: min(640px, calc(100vw - 2rem));
  transform: translateX(-50%);
  z-index: 100000;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper #buscar,
.search-input-wrapper .autocomplete {
  padding-right: 2.75rem;
}

.form-control {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
  background-color: var(--bg-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

#buscar::-webkit-search-cancel-button,
#buscar::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

#buscar[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

#buscar.has-value,
.autocomplete.has-value {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.15);
}

#search-help {
  color: var(--text-muted);
}

.btn-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-search-clear:hover {
  color: var(--primary-color);
  background-color: rgba(0, 86, 179, 0.08);
}

.btn-search-clear:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.25);
}

.btn-search-clear.d-none {
  display: none !important;
}

.btn-search-clear:not(.d-none) {
  display: flex !important;
}

.btn-search-clear svg {
  width: 1.125rem;
  height: 1.125rem;
}

.progress {
  background-color: rgba(0, 86, 179, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

.shadow {
  box-shadow: var(--shadow-lg) !important;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.shadow:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl) !important;
}

.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.border-dark {
  border-color: var(--primary-color) !important;
  border-width: 3px !important;
}

.rounded-2 {
  border-radius: var(--radius-lg) !important;
}

#map-shell {
  position: relative;
  z-index: 1;
}

.map-fullscreen-notice {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  z-index: 100001;
  display: none;
  align-items: center;
  gap: 1rem;
  width: min(560px, calc(100% - 2rem));
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 86, 179, 0.18);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  transform: translateX(-50%);
}

.map-fullscreen-notice.is-visible {
  display: flex;
}

.map-fullscreen-notice__text {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.4;
}

.map-fullscreen-notice__button {
  flex: 0 0 auto;
  padding: 0.5rem 0.875rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.map-fullscreen-notice__button:hover,
.map-fullscreen-notice__button:focus {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

#map {
  position: relative;
  width: 100%;
  height: clamp(380px, 58vh, 680px);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#map,
#map .leaflet-container {
  cursor: grab;
}

#map.map-click-target-active,
#map.map-click-target-active .leaflet-container {
  cursor: crosshair;
}

#map .leaflet-dragging,
#map .leaflet-dragging .leaflet-container {
  cursor: grabbing;
}

#map .leaflet-control,
#map .leaflet-control *,
#map .leaflet-marker-icon,
#map .leaflet-popup,
#map .leaflet-popup * {
  cursor: auto;
}

.dropdown-menu {
  z-index: 3000;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.5rem 0;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  font-weight: 400;
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
  background-color: rgba(0, 86, 179, 0.1);
  color: var(--primary-color);
}

.btn-copy-ref {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.btn-copy-ref:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-copy-ref.copied {
  color: var(--success-color);
  border-color: var(--success-color);
}

.btn-copy-ref svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .display-4 {
    font-size: 2.25rem;
  }

  h1,
  .h1 {
    font-size: 2rem;
  }

  .lead {
    font-size: 1rem;
  }

  .hero {
    min-height: auto;
  }

  .map-fullscreen-notice {
    bottom: 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .map-fullscreen-notice__button {
    width: 100%;
  }
}

.fullscreen-icon {
	background-image: url('icon-fullscreen.svg');
	background-size: 26px 52px;
}

.fullscreen-icon.leaflet-fullscreen-on {
	background-position: 0 -26px;
}

.leaflet-touch .fullscreen-icon {
	background-position: 2px 2px;
}

.leaflet-touch .fullscreen-icon.leaflet-fullscreen-on {
	background-position: 2px -24px;
}

/* Safari still needs this vendor-prefix: https://caniuse.com/mdn-css_selectors_fullscreen */
/* stylelint-disable-next-line selector-no-vendor-prefix */
.leaflet-container:-webkit-full-screen {
	width: 100% !important;
	height: 100% !important;
	z-index: 99999;
}

.leaflet-container:fullscreen {
	width: 100% !important;
	height: 100% !important;
	z-index: 99999;
}

.leaflet-pseudo-fullscreen {
	position: fixed !important;
	width: 100% !important;
	height: 100% !important;
	top: 0 !important;
	left: 0 !important;
	z-index: 99999;
}

#map-shell.leaflet-pseudo-fullscreen {
	background: rgba(255, 255, 255, 0.98);
	padding: 16px !important;
	box-sizing: border-box;
	border-color: transparent !important;
	border-width: 0 !important;
}

#map-shell.leaflet-pseudo-fullscreen #map {
	height: 100% !important;
}
