/* =========================================================
   CEMETERY GRAVE FINDER
   Premium Minimalist Fixed/Desktop UI
   Enhanced Grave Cells
   No Map Cell Gaps
   Smooth Floating Gold Selection Pointer
========================================================= */


/* =========================================================
   DESIGN TOKENS
========================================================= */

:root {
  --primary: #163526;
  --primary-dark: #234936;
  --primary-deep: #0f281d;
  --primary-light: #e8f0e9;
  --primary-soft: #f3f7f3;

  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #f8faf8;

  --border: #b0a184;
  --border-dark: #918263;

  --text: #26352c;
  --text-soft: #5d6a61;
  --muted: #7c877f;

  /* Selection */
  --selection-gold: #d6a928;
  --selection-gold-light: #f4d66a;
  --selection-gold-dark: #a77b12;

  /* Map */
  --grass: #879d78;
  --grass-dark: #718964;

  --path: #b0a184;
  --path-dark: #918263;

  --road: #555b56;
  --wall: #8b8d88;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 15px;
  --radius-xl: 20px;

  --shadow-xs: 0 2px 8px rgba(25, 48, 34, 0.05);
  --shadow-sm: 0 6px 20px rgba(25, 48, 34, 0.07);
  --shadow: 0 14px 40px rgba(25, 48, 34, 0.09);
  --shadow-lg: 0 28px 80px rgba(20, 40, 27, 0.2);

  --content-width: 1800px;
  --header-height: 88px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}


/* =========================================================
   RESET
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;

  color: var(--text);

  font-family: "Cinzel", serif;

  line-height: 1.5;

  background:
    radial-gradient(
      circle at 8% 0%,
      rgba(126, 165, 135, 0.08),
      transparent 28%
    ),
    radial-gradient(
      circle at 92% 20%,
      rgba(143, 190, 151, 0.05),
      transparent 25%
    ),
    var(--bg);

  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

::selection {
  color: #fff;
  background: var(--primary);
}


/* =========================================================
   SHARED CONTAINERS
========================================================= */

.header-inner,
.container,
.footer-content {
  width: min(calc(100% - 48px), var(--content-width));
  margin-inline: auto;
}


/* =========================================================
   MAIN
========================================================= */

.container {
  padding: var(--space-7) 0 var(--space-8);
}


/* =========================================================
   MAP CARD
========================================================= */

.map-card {
  position: relative;

  overflow: hidden;

  padding: 19px;

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  background:
    linear-gradient(
      180deg,
      #fbfdfb,
      #f5f8f5
    );

  box-shadow: var(--shadow);
}


/* =========================================================
   MAP HEADER
========================================================= */

.map-header {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  align-items: center;

  gap: 22px;

  padding: 2px 2px 16px;
}

.map-header-info {
  min-width: 0;
}

.eyebrow {
  display: block;

  color: #718676;

  font-size: 8px;
  font-weight: 850;

  text-transform: uppercase;

  letter-spacing: 1.2px;
}

.map-header h2 {
  margin-top: 4px;

  color: var(--text);

  font-size: 19px;
  font-weight: 800;

  line-height: 1.2;

  letter-spacing: -0.35px;
}

.map-header p {
  margin-top: 5px;

  color: var(--muted);

  font-size: 10px;
}


/* =========================================================
   MAP LEGEND
========================================================= */

.map-header-legend {
  display: flex;
  align-items: center;

  gap: 13px;

  min-width: 0;
}

.legend-title {
  flex: 0 0 auto;

  color: var(--text);

  font-size: 9px;
  font-weight: 850;

  text-transform: uppercase;

  letter-spacing: 0.7px;
}

.legend-items {
  display: flex;
  align-items: center;

  gap: 11px;

  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;

  gap: 6px;

  color: var(--text-soft);

  font-size: 8px;
}

.legend-color {
  width: 10px;
  height: 10px;

  flex: 0 0 10px;

  border: 1px solid rgba(0, 0, 0, 0.08);

  border-radius: 3px;
}

.legend-color.pathway {
  background: var(--path);
}

.legend-color.road {
  background: var(--road);
}

.legend-color.grave {
  background: linear-gradient(145deg, #f5f1e8, #e9e3d5);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.legend-tip {
  margin-left: auto;

  padding-left: 10px;

  border-left: 1px solid var(--border);

  color: var(--muted);

  font-size: 7px;

  white-space: nowrap;
}


/* =========================================================
   MAP VIEWPORT
========================================================= */

.map-scroll {
  width: 100%;

  overflow: hidden;
  overflow-y: visible;

  border: 1px solid #b0a184;

  border-radius: 12px;

  background: var(--grass-dark);

  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.map-stage {
  width: 100%;

  padding: 0;

  overflow: visible;

  transform-origin: top left;
}


/* =========================================================
   CEMETERY MAP
   ZERO CELL GAPS
========================================================= */

.cemetery-map {
  width: 100%;
  min-width: 0;

  table-layout: fixed;

  border-collapse: collapse;
  border-spacing: 0;

  padding: 0;
  margin: 0;

  background:
    radial-gradient(
      circle at 15% 20%,
      rgba(255, 255, 255, 0.12) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 70% 65%,
      rgba(176, 161, 132, 0.11) 0 2px,
      transparent 3px
    ),
    #879d78;

  background-size:
    48px 48px,
    64px 64px,
    auto;

  box-shadow:
    inset 0 0 0 2px rgba(176, 161, 132, 0.12),
    0 10px 28px rgba(22, 53, 38, 0.14);
}

.cemetery-map tbody,
.cemetery-map tr {
  margin: 0;
  padding: 0;
}

.cemetery-map td {
  position: relative;

  width: auto;
  min-width: 0;

  height: 52px;

  padding: 0;
  margin: 0;

  text-align: center;
  vertical-align: middle;

  border: 0;
}


/* =========================================================
   GRAVE GROUP CELL
========================================================= */

.grave-group-cell {
  position: relative;

  padding: 0 !important;
  margin: 0 !important;

  background: transparent;

  border: 0;
}


/* =========================================================
   PREMIUM GRAVE CELL
========================================================= */

.grave {
  position: relative;

  width: 100%;
  height: 100%;

  min-width: 0;
  min-height: 100%;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  padding: 3px;

  appearance: none;
  -webkit-appearance: none;

  color: #314338;

  border: 1px solid rgba(74, 91, 75, 0.18);

  border-radius: 5px;

  background:
    linear-gradient(
      145deg,
      #f5f1e8,
      #e9e3d5
    );

  box-shadow:
    0 2px 5px rgba(42, 55, 43, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);

  cursor: pointer;

  overflow: visible;

  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    border-color 0.2s ease,
    filter 0.2s ease;
}


/* =========================================================
   GRAVE TOP HIGHLIGHT
========================================================= */

.grave::before {
  content: "";

  position: absolute;

  top: 0;
  left: 8%;
  right: 8%;

  height: 1px;

  background: rgba(255, 255, 255, 0.85);

  border-radius: 999px;

  pointer-events: none;

  z-index: 1;
}


/* =========================================================
   GRAVE SYMBOL
========================================================= */

.grave .grave-symbol {
  position: absolute;

  top: 3px;
  left: 50%;

  transform: translateX(-50%);

  color: rgba(66, 82, 68, 0.42);

  font-size: 11px;

  line-height: 1;

  pointer-events: none;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.grave:not(.selected)::after {
  content: "✦";

  position: absolute;

  top: 3px;
  left: 50%;

  transform: translateX(-50%);

  color: rgba(66, 82, 68, 0.42);

  font-size: 11px;

  line-height: 1;

  pointer-events: none;

  z-index: 2;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}


/* =========================================================
   GRAVE HOVER
========================================================= */

.grave:hover {
  z-index: 20;

  transform: translateY(-2px);

  border-color:
    rgba(47, 86, 61, 0.35);

  filter: brightness(1.03);

  box-shadow:
    0 6px 14px rgba(42, 55, 43, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.grave:hover::after {
  color: rgba(45, 104, 77, 0.72);

  transform:
    translateX(-50%)
    translateY(-1px);
}


/* =========================================================
   GRAVE FOCUS
========================================================= */

.grave:focus-visible {
  z-index: 50;

  outline:
    3px solid
    rgba(49, 95, 67, 0.35);

  outline-offset: 2px;

  box-shadow:
    0 0 0 3px rgba(49, 95, 67, 0.12),
    0 7px 18px rgba(42, 55, 43, 0.16);
}


/* =========================================================
   SELECTED GRAVE
========================================================= */

.grave.selected {
  z-index: 30;

  transform: translateY(-2px);

  border-color: #d6a928;

  box-shadow:
    0 0 0 3px rgba(214, 169, 40, 0.15),
    0 7px 18px rgba(22, 53, 38, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);

  background:
    linear-gradient(
      145deg,
      #faf6e9,
      #eee8d8
    );
}


/* =========================================================
   SELECTED GOLD POINTER
========================================================= */

.grave.selected::after {
  /* content: "▼"; */

  position: absolute;

  left: 50%;

  bottom: calc(100% + 5px);

  transform:
    translateX(-50%)
    translateY(0);

  color: var(--selection-gold);

  font-size: 15px;
  font-weight: 900;

  line-height: 1;

  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75),
    0 2px 4px rgba(120, 86, 10, 0.22);

  pointer-events: none;

  z-index: 100;

  filter:
    drop-shadow(
      0 2px 2px
      rgba(120, 86, 10, 0.14)
    );

  animation:
    selectedPointerBounce
    1.25s
    cubic-bezier(0.45, 0, 0.55, 1)
    infinite;
}


/* =========================================================
   SMOOTH POINTER BOUNCE
========================================================= */

@keyframes selectedPointerBounce {
  0%,
  100% {
    transform:
      translateX(-50%)
      translateY(0);
  }

  25% {
    transform:
      translateX(-50%)
      translateY(-4px);
  }

  50% {
    transform:
      translateX(-50%)
      translateY(0);
  }

  72% {
    transform:
      translateX(-50%)
      translateY(2px);
  }

  86% {
    transform:
      translateX(-50%)
      translateY(0);
  }
}


/* =========================================================
   POINTER GLOW
========================================================= */

.grave.selected::before {
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.95),
      transparent
    );
}


/* =========================================================
   HIDDEN GRAVE
========================================================= */

.grave.hidden {
  display: none;
}

/* =========================================================
   SEARCH STYLES
========================================================= */

.grave.search-match {
  border-color: var(--selection-gold);
  box-shadow: 0 0 0 2px rgba(214, 169, 40, 0.3);
}

.grave.search-no-match {
  opacity: 0.3;
  filter: grayscale(50%);
}

.filtered-out {
  opacity: 0.1;
  pointer-events: none;
}


/* =========================================================
   STATUS
========================================================= */

.grave.occupied,
.grave.available,
.grave.reserved {
  background:
    linear-gradient(
      145deg,
      #f5f1e8,
      #e9e3d5
    );

  color: #314338;

  border-color:
    rgba(74, 91, 75, 0.18);
}


/* =========================================================
   STATUS DOT
========================================================= */

.status-dot {
  position: relative;

  display: block;

  width: 9px;
  height: 9px;

  margin:
    0 auto 4px;

  border-radius: 50%;

  flex-shrink: 0;

  border: 2px solid rgba(255, 255, 255, 0.75);

  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.18);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}


/* =========================================================
   OCCUPIED — GREEN
========================================================= */

.status-dot.status-occupied {
  background: #163526;

  box-shadow:
    0 0 0 3px rgba(22, 53, 38, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   AVAILABLE — GOLD
========================================================= */

.status-dot.status-available {
  background: #d5a63b;

  box-shadow:
    0 0 0 3px rgba(213, 166, 59, 0.13),
    0 1px 3px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   RESERVED — PURPLE
========================================================= */

.status-dot.status-reserved {
  background: #8564b8;

  box-shadow:
    0 0 0 3px rgba(133, 100, 184, 0.13),
    0 1px 3px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   DOT HOVER
========================================================= */

.grave:hover .status-dot {
  transform: scale(1.12);
}


/* =========================================================
   GRAVE NUMBER
========================================================= */

.grave-number {
  position: relative;
  z-index: 3;

  max-width: 92%;

  color: #294334;

  font-weight: 800;

  font-size: 0.82rem;

  line-height: 1.1;

  letter-spacing: -0.01em;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}


/* =========================================================
   GRAVE NAME / STATUS LABEL
========================================================= */

.grave-name {
  position: relative;
  z-index: 3;

  max-width: 88%;

  margin-top: 3px;

  color: #6b756d;

  font-size: 0.58rem;

  font-weight: 700;

  line-height: 1;

  text-transform: uppercase;

  letter-spacing: 0.04em;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}


/* =========================================================
   LAYER COUNT
========================================================= */

.layer-count {
  position: absolute;

  top: 4px;
  right: 4px;

  min-width: 18px;
  height: 18px;

  padding: 0 4px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  background: #d6a928;

  color: white;

  font-size: 0.55rem;

  font-weight: 800;

  line-height: 1;

  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.15);

  z-index: 10;
}


/* =========================================================
   PHYSICAL GRAVE GROUP
========================================================= */

.grave.grave-group {
  width: 100%;
  height: 100%;

  min-height: 100%;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;
}

.grave.grave-group .grave-number {
  font-size: 1.15em;

  font-weight: 750;
}


/* =========================================================
   PHYSICAL GRAVE SIZE
========================================================= */

.physical-grave-size {
  position: absolute;

  bottom: 4px;
  right: 4px;

  min-width: 17px;
  height: 17px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0 3px;

  border-radius: 5px;

  background:
    rgba(49, 95, 67, 0.09);

  color: #52705c;

  font-size: 0.52rem;

  font-weight: 800;

  z-index: 10;

  cursor: help;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.physical-grave-size:hover {
  background:
    rgba(214, 169, 40, 0.15);

  color: #d6a928;

  transform: scale(1.05);
}

/* Custom tooltip styling */
.physical-grave-size::before {
  content: attr(data-title);

  position: absolute;

  bottom: calc(100% + 8px);
  right: 0;

  min-width: 140px;
  max-width: 200px;

  padding: 8px 10px;

  background: rgba(22, 53, 38, 0.95);

  color: #f5f8f5;

  font-size: 0.65rem;

  font-weight: 600;

  line-height: 1.4;

  text-align: left;

  border-radius: 6px;

  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);

  white-space: normal;

  word-wrap: break-word;

  opacity: 0;

  visibility: hidden;

  transform: translateY(4px);

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;

  z-index: 1000;

  pointer-events: none;
}

.physical-grave-size:hover::before {
  opacity: 1;

  visibility: visible;

  transform: translateY(0);
}

/* Tooltip arrow */
.physical-grave-size::after {
  content: "";

  position: absolute;

  bottom: calc(100% + 2px);
  right: 8px;

  width: 0;
  height: 0;

  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(22, 53, 38, 0.95);

  opacity: 0;

  visibility: hidden;

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;

  z-index: 1000;

  pointer-events: none;
}

.physical-grave-size:hover::after {
  opacity: 1;

  visibility: visible;
}

/* Hide physical grave size indicators when toggle is off */
body.hide-grave-size .physical-grave-size {
  display: none;
}

/* Hide layer count when toggle is off */
body.hide-grave-size .layer-count {
  display: none;
}


/* =========================================================
   BOUNDARY GRAVES
========================================================= */

.grave[data-id^="BOUNDARY-"] {
  border-color: #aab8a4;

  background:
    linear-gradient(
      145deg,
      #e0e6dc,
      #c8d3c3
    );
}

.grave[data-id^="BOUNDARY-"] .grave-number {
  color: #596757;
}

.grave[data-id^="BOUNDARY-"] .grave-name {
  color: #778176;

  font-size: 7px;
}


/* =========================================================
   CIRCULAR PATHWAY
========================================================= */

.circle-path {
  position: relative;

  padding: 0 !important;
  margin: 0;

  background: #aa9979;

  overflow: visible !important;
}

.circle-path::before {
  content: "";

  position: absolute;

  width: 100%;
  aspect-ratio: 1 / 1;

  top: 50%;
  left: 50%;

  transform:
    translate(-50%, -50%);

  border-radius: 50%;

  background:
    radial-gradient(
      circle at 35% 30%,
      #c1ad87,
      #a79777 65%,
      #918263 100%
    );

  border: 3px solid #8b795b;

  box-shadow:
    0 0 0 3px rgba(221, 204, 167, 0.35),
    inset 0 2px 5px rgba(255, 255, 255, 0.18),
    inset 0 -4px 7px rgba(60, 48, 32, 0.18);

  z-index: 10;

  pointer-events: none;
}


/* =========================================================
   PATHWAY
========================================================= */

.path {
  position: relative;
  
  background-color: #aa9979;

  background-image:
    radial-gradient(
      ellipse 45% 30% at 15% 25%,
      rgba(91, 73, 48, 0.13),
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 35% at 78% 20%,
      rgba(207, 190, 151, 0.15),
      transparent 72%
    ),
    radial-gradient(
      ellipse 55% 40% at 35% 75%,
      rgba(78, 63, 43, 0.1),
      transparent 70%
    ),
    radial-gradient(
      ellipse 45% 35% at 90% 80%,
      rgba(220, 202, 164, 0.1),
      transparent 70%
    ),
    linear-gradient(
      165deg,
      rgba(82, 66, 45, 0.08) 0%,
      transparent 12%,
      rgba(224, 207, 171, 0.06) 24%,
      rgba(104, 84, 55, 0.08) 38%,
      transparent 52%,
      rgba(219, 200, 160, 0.06) 67%,
      rgba(85, 67, 44, 0.07) 82%,
      transparent 100%
    ),
    linear-gradient(
      90deg,
      #a59474 0%,
      #b0a080 18%,
      #a79777 37%,
      #b5a584 55%,
      #a39473 73%,
      #ad9d7d 100%
    );
}

/* =========================================================
   FLOATING TEXT FOR STREET LABELS
========================================================= */

.floating-text {
  position: absolute;
  
  top: 50%;
  left: 50%;
  
  transform: translate(-50%, -50%);
  
  color: rgba(255, 255, 255, 0.85);
  
  /* font-family: "Cinzel", serif; */
  font-size: 14px;
  font-weight: 800;
  
  text-transform: uppercase;
  letter-spacing: 2px;
  
  white-space: nowrap;
  
  pointer-events: none;
  
  z-index: 10;
  
  text-shadow:
    0 2px 4px rgba(255, 255, 255, 0.6),
    0 -1px 2px rgba(0, 0, 0, 0.3);
}

.floating-text-vertical {
  transform: translate(-50%, -50%) rotate(-90deg);
}


/* =========================================================
   WALL
========================================================= */

.wall {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 2px,
      transparent 2px,
      transparent 6px
    ),
    #8f908c;

  border: 1px solid #686965;

  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.2),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2);
}


/* =========================================================
   ROAD
========================================================= */

.road-h,
.road-v {
  position: relative;

  background:
    linear-gradient(
      180deg,
      #4c514d 0%,
      #5a5f5a 40%,
      #656a65 50%,
      #5a5f5a 60%,
      #4c514d 100%
    );

  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.road-h::before,
.road-v::before {
  content: "";

  position: absolute;

  inset: 0;

  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1.5px
    );

  background-size: 10px 10px;

  opacity: 0.5;
}

/* Horizontal road - horizontal yellow line */
.road-h::after {
  content: "";

  position: absolute;

  top: 50%;

  left: 10%;
  right: 10%;

  height: 2px;

  transform: translateY(-50%);

  background:
    repeating-linear-gradient(
      90deg,
      #ffd700 0 15px,
      transparent 15px 30px
    );

  box-shadow:
    0 0 2px rgba(255, 215, 0, 0.3);

  opacity: 0.8;
}

/* Vertical road - vertical yellow line */
.road-v::after {
  content: "";

  position: absolute;

  left: 50%;

  top: 10%;
  bottom: 10%;

  width: 2px;

  transform: translateX(-50%);

  background:
    repeating-linear-gradient(
      180deg,
      #ffd700 0 15px,
      transparent 15px 30px
    );

  box-shadow:
    0 0 2px rgba(255, 215, 0, 0.3);

  opacity: 0.8;
}

/* Road corners - no yellow lines */
.road-c {
  position: relative;

  background:
    linear-gradient(
      180deg,
      #4c514d 0%,
      #5a5f5a 40%,
      #656a65 50%,
      #5a5f5a 60%,
      #4c514d 100%
    );

  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.road-c::before {
  content: "";

  position: absolute;

  inset: 0;

  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1.5px
    );

  background-size: 10px 10px;

  opacity: 0.5;
}

/* Road corners don't have yellow lines - no ::after pseudo-element */

.road-corner-tl {
  border-top-left-radius: 16px;
}

.road-corner-tr {
  border-top-right-radius: 16px;
}

.road-corner-bl {
  border-bottom-left-radius: 16px;
}

.road-corner-br {
  border-bottom-right-radius: 16px;
}


/* =========================================================
   MAP FOOTER
========================================================= */

.map-footer {
  min-height: 34px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 13px 2px 2px;
}

.map-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-note {
  min-width: 0;

  display: flex;
  align-items: center;

  gap: 7px;

  color: var(--muted);

  font-size: 9px;
}

.map-note-icon {
  color: var(--primary);
}

.map-count {
  flex-shrink: 0;

  color: var(--text-soft);

  font-size: 9px;
  font-weight: 750;
}

.toggle-grave-size-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  padding: 4px 8px;

  border: 1px solid var(--border);

  border-radius: 6px;

  background: var(--surface);

  color: var(--text-soft);

  font-size: 8px;
  font-weight: 600;

  cursor: pointer;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.toggle-grave-size-btn:hover {
  background: var(--surface-soft);

  border-color: var(--border-dark);

  color: var(--text);
}

.toggle-grave-size-btn:active {
  background: var(--primary-soft);
}

.toggle-grave-size-btn[aria-pressed="false"] {
  opacity: 0.5;
}

.toggle-grave-size-btn i {
  width: 12px;
  height: 12px;
}


/* =========================================================
   NO RESULTS
========================================================= */

.no-results {
  display: none;

  padding: 50px 20px 40px;

  text-align: center;

  color: var(--muted);
}

.no-results.show {
  display: block;
}

.empty-icon {
  width: 56px;
  height: 56px;

  margin: 0 auto 14px;

  display: grid;
  place-items: center;

  border-radius: 16px;

  background: var(--primary-light);

  font-size: 24px;
}

.no-results strong {
  display: block;

  color: var(--text);

  font-size: 14px;
}

.no-results p {
  margin-top: 5px;

  font-size: 10px;
}

.no-results button {
  margin-top: 15px;

  padding: 9px 15px;

  color: #fff;

  border-radius: 9px;

  background: var(--primary);

  font-size: 9px;
  font-weight: 700;
}


/* =========================================================
   MODAL
========================================================= */

.modal-overlay {
  position: fixed;

  inset: 0;

  z-index: 1000;

  display: none;

  align-items: flex-start;
  justify-content: flex-end;

  padding: 20px;

  background: rgba(10, 25, 17, 0.28);
}

.modal-overlay.show {
  display: flex;
}

.modal {
  width: 540px;
  max-width: 100%;

  max-height: calc(100vh - 40px);

  overflow: hidden;

  border: 1px solid var(--border);

  border-radius: var(--radius-lg);

  background: #fff;

  box-shadow: var(--shadow-lg);

  animation:
    modalIn
    0.22s
    var(--ease);
}

.record-modal {
  width: 400px;
  max-width: 100%;
}

@keyframes modalIn {
  from {
    opacity: 0;

    transform:
      translateY(-10px)
      translateX(10px)
      scale(0.98);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      translateX(0)
      scale(1);
  }
}


/* =========================================================
   MODAL HEADER
========================================================= */

.modal-header {
  position: relative;

  min-height: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 15px 17px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      #163526,
      #234936
    );
}

.modal-header::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 2px;

  background:
    linear-gradient(
      90deg,
      transparent,
      #f4d66a,
      transparent
    );
}

.modal-eyebrow {
  display: block;

  margin-bottom: 4px;

  color: rgba(255, 255, 255, 0.55);

  font-size: 8px;
  font-weight: 800;

  letter-spacing: 1.2px;
}

.modal-header h2 {
  font-size: 17px;

  line-height: 1.2;

  letter-spacing: -0.3px;
}

.close {
  width: 35px;
  height: 35px;

  flex: 0 0 35px;

  display: grid;
  place-items: center;

  color: #fff;

  border: 1px solid rgba(255, 255, 255, 0.12);

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.1);

  font-size: 22px;

  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.close:hover {
  background: rgba(255, 255, 255, 0.2);

  transform: rotate(90deg);
}


/* =========================================================
   MODAL BODY
========================================================= */

.modal-body {
  max-height: calc(100vh - 112px);

  padding: 20px;

  overflow-y: auto;

  overscroll-behavior: contain;
}

.modal-body::-webkit-scrollbar {
  width: 7px;
}

.modal-body::-webkit-scrollbar-thumb {
  border-radius: 10px;

  background: #cad4cc;
}

/* =========================================================
   GRAVE INFO SECTION
========================================================= */

.layer-location {
  display: flex;
  align-items: center;

  gap: 12px;

  padding: 13px;

  margin-bottom: 12px;

  border: 1px solid var(--border);

  border-radius: 12px;

  background:
    linear-gradient(
      135deg,
      var(--primary-soft),
      var(--primary-light)
    );
}

.grave-location-icon {
  width: 43px;
  height: 43px;

  flex: 0 0 43px;

  display: grid;
  place-items: center;

  border-radius: 10px;

  color: var(--primary);

  background: var(--surface);

  font-size: 20px;
}

.layer-location strong {
  display: block;

  color: var(--primary-dark);

  font-size: 14px;
}

.layer-location span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 9px;
}


/* =========================================================
   LAYER LOCATION
========================================================= */

.layer-location {
  display: flex;
  align-items: center;

  gap: 12px;

  padding: 13px;

  margin-bottom: 12px;

  border: 1px solid #d5e2d7;

  border-radius: 12px;

  background:
    linear-gradient(
      135deg,
      #f1f7f2,
      #e7f0e9
    );
}

.grave-location-icon {
  width: 43px;
  height: 43px;

  flex: 0 0 43px;

  display: grid;
  place-items: center;

  border-radius: 10px;

  color: var(--primary);

  background: #fff;

  font-size: 20px;
}

.layer-location strong {
  display: block;

  color: var(--primary-dark);

  font-size: 14px;
}

.layer-location span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 9px;
}


/* =========================================================
   INSTRUCTION
========================================================= */

.instruction-card {
  display: flex;
  align-items: flex-start;

  gap: 8px;

  padding: 10px 11px;

  margin-bottom: 15px;

  border: 1px dashed #d5dfd7;

  border-radius: 9px;

  background: #f8faf8;
}

.instruction-icon {
  color: var(--primary);
}

.instruction-card p {
  color: var(--muted);

  font-size: 9px;

  line-height: 1.5;
}


/* =========================================================
   LAYERS LIST
========================================================= */

.layers-list {
  display: flex;
  flex-direction: column;

  gap: 8px;
}

.grave-layer {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 10px;

  padding: 9px;

  text-align: left;

  color: inherit;

  border: 1px solid #dfe6df;

  border-radius: 11px;

  background: #fff;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.grave-layer:hover {
  border-color: #d6a928;

  background: #fbfdfb;

  box-shadow:
    0 7px 20px rgba(214, 169, 40, 0.12);

  transform: translateX(3px);
}

.layer-number {
  width: 48px;
  height: 48px;

  flex: 0 0 48px;

  display: grid;
  place-items: center;

  border-radius: 10px;

  color: #d6a928;

  font-size: 9px;
  font-weight: 850;
}

.layer-info {
  min-width: 0;

  flex: 1;
}

.layer-info strong {
  display: block;

  color: var(--text);

  font-size: 11px;
  font-weight: 750;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.layer-info span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 9px;
  
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-arrow {
  width: 29px;
  height: 29px;

  flex: 0 0 29px;

  display: grid;
  place-items: center;

  color: #b0a184;

  border-radius: 50%;

  background: #f1f5f1;

  font-size: 17px;
}


/* =========================================================
   EMPTY LAYER
========================================================= */

.no-layers {
  padding: 34px 20px;

  text-align: center;

  color: var(--muted);

  border: 1px dashed #ccd7ce;

  border-radius: 13px;

  background: #f7f9f7;
}

.no-layers-icon {
  margin-bottom: 7px;

  font-size: 28px;
}

.no-layers strong {
  display: block;

  color: var(--text);

  font-size: 12px;
}

.no-layers p {
  margin-top: 4px;

  font-size: 9px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-state p {
  color: var(--muted);
  font-size: 14px;
}




/* =========================================================
   GRAVE INFO SECTION
========================================================= */

.grave-info-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grave-label-section,
.grave-positions-section {
  padding: 16px;

  border: 1px solid #e1e8e2;

  border-radius: 9px;

  background:
    linear-gradient(
      180deg,
      #fbfdfb,
      #f8faf8
    );
}

.grave-label-section label,
.grave-positions-section label {
  display: block;

  margin-bottom: 8px;

  color: #7d8880;

  font-size: 11px;
  font-weight: 700;

  text-transform: uppercase;

  letter-spacing: 0.6px;
}

.grave-label-section strong,
.grave-positions-section strong {
  display: block;

  color: #29362e;

  font-size: 14px;
  font-weight: 650;

  line-height: 1.45;
}

.positions-list {
  color: #29362e;

  font-size: 13px;
  font-weight: 500;

  line-height: 1.6;
}


/* =========================================================
   STATUS BADGE
========================================================= */

.status-badge {
  display: inline-flex;
  align-items: center;

  gap: 5px;

  margin-top: 6px;

  padding: 4px 8px;

  border-radius: 20px;

  font-size: 7px;
  font-weight: 850;

  text-transform: uppercase;

  letter-spacing: 0.5px;
}

.status-badge::before {
  content: "";

  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: currentColor;

  opacity: 0.75;
}

.status-occupied {
  color: #37623f;

  background: #dcebdd;
}

.status-available {
  color: #3e7449;

  background: #e8f4ea;
}

.status-reserved {
  color: #765e00;

  background: #fff0b7;
}

/* =========================================================
   ACCESSIBILITY
========================================================= */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(214, 169, 40, 0.28);

  outline-offset: 2px;
}

/* =========================================================
   GRAVE NAVIGATION ROUTE
========================================================= */

.map-stage {
    position: relative;
}


/* SVG sits above the map but does not block clicks */

.route-svg {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;

    z-index: 20;

    overflow: visible;

    opacity: 0;

    transition: opacity 0.25s ease;
}

.route-svg.show {
    opacity: 1;
}


/* Main route */

.route-path {
    fill: none;

    stroke: #d6a928;
    stroke-width: 5;

    stroke-linecap: round;
    stroke-linejoin: round;

    filter:
        drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}


/* Dark outline behind route */

.route-shadow {
    fill: none;

    stroke: rgba(22, 53, 38, 0.45);
    stroke-width: 9;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Route points */

.route-point {
    stroke: white;
    stroke-width: 3;

    filter:
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}


/* Entrance */

.route-start {
    fill: #163526;
}


/* Destination */

.route-end {
    fill: #d6a928;
}


/* A / B labels */

.route-label {
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    font-size: 12px;
    font-weight: 900;

    text-anchor: middle;
    dominant-baseline: central;

    fill: #ffffff;

    paint-order: stroke;
    stroke: #163526;
    stroke-width: 4px;
    stroke-linejoin: round;
}





/* =========================================================
   RESPONSIVE DESIGN
   TABLET (768px and below)
========================================================= */

@media (max-width: 768px) {
  /* MAP HEADER - Stack vertically on tablet */
  .map-header {
    grid-template-columns: 1fr;
    
    gap: 16px;
    
    padding: 2px 2px 14px;
  }
  
  .map-header-legend {
    flex-wrap: wrap;
    
    gap: 10px;
  }
  
  .legend-tip {
    margin-left: 0;
    
    padding-left: 0;
    
    border-left: none;
    
    border-top: 1px solid var(--border);
    
    padding-top: 8px;
    
    margin-top: 8px;
    
    width: 100%;
    
    white-space: normal;
  }
  
  /* MAP - Scale to fit on tablet */
  .map-scroll {
    overflow: hidden;
  }

  .map-stage {
    min-width: 1040px; /* Maintain original map size */
    transform-origin: top left;
  }

  .cemetery-map {
    width: 1040px;
    min-width: 1040px;
  }
}


/* =========================================================
   RESPONSIVE DESIGN
   MOBILE (480px and below)
========================================================= */

@media (max-width: 480px) {
  /* MAP HEADER - More compact spacing */
  .map-header {
    gap: 12px;
    
    padding: 2px 2px 12px;
  }
  
  .map-header-info {
    min-width: 0;
  }
  
  .eyebrow {
    font-size: 7px;
  }
  
  .map-header h2 {
    font-size: 16px;
  }
  
  .map-header p {
    font-size: 9px;
  }
  
  /* MAP LEGEND - Stack items vertically if needed */
  .map-header-legend {
    flex-direction: column;
    align-items: flex-start;
    
    gap: 8px;
  }
  
  .legend-title {
    font-size: 8px;
  }
  
  .legend-items {
    gap: 8px;
  }
  
  .legend-item {
    font-size: 7px;
  }
  
  .legend-tip {
    font-size: 6px;
    
    padding-top: 6px;
    
    margin-top: 6px;
  }
  
  /* MAP - Scale to fit on mobile */
  .map-scroll {
    overflow: hidden;
  }

  .map-stage {
    min-width: 1040px; /* Maintain original map size */
    transform-origin: top left;
  }

  .cemetery-map {
    width: 1040px;
    min-width: 1040px;
  }
  
  /* MAP FOOTER - Adjust spacing */
  .map-footer {
    flex-direction: column;
    align-items: flex-start;
    
    gap: 8px;
    
    padding: 10px 2px 2px;
  }
  
  .map-note {
    font-size: 8px;
  }
  
  .map-count {
    font-size: 8px;
  }
}


/* =========================================================
   RESPONSIVE DESIGN
   SMALL MOBILE (360px and below)
========================================================= */

@media (max-width: 360px) {
  /* MAP HEADER - Further optimize for very small screens */
  .map-header h2 {
    font-size: 14px;
  }
  
  .map-header p {
    font-size: 8px;
  }
  
  /* MAP - Still maintain minimum width */
  .map-stage {
    min-width: 1040px;
  }
  
  .cemetery-map {
    width: 1040px;
    min-width: 1040px;
  }
  
  /* GRAVE CELLS - Ensure readability on small screens */
  .grave-number {
    font-size: 0.7rem;
  }
  
  .grave-name {
    font-size: 0.5rem;
  }
}