/* Cemetery map UI: side panels, map controls, modals. Loaded after style.css and leaflet. */

@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../../vendor/inter/inter-400.woff2') format('woff2');
}

@font-face {
  font-family: "Inter";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../../vendor/inter/inter-600.woff2') format('woff2');
}

@font-face {
  font-family: "Inter";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../../vendor/inter/inter-700.woff2') format('woff2');
}


:root {
  --c-primary: #1f5f7a;
  --c-primary-dark: #174a5f;
  --c-accent: #b08d57;
  --c-text: #1d2a33;
  --c-muted: #6b7782;
  --c-border: #dde3e8;
  --c-surface: #ffffff;
  --c-canvas: #f4f6f8;
  --c-surface-2: #f6f8fa;
  --c-hover: #eef4f7;
  --c-selected: #dbeefa;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(16, 32, 45, 0.18);
  --panel-width: 340px;
  --panel-wide-width: min(560px, calc(100vw - 96px));
  --font: "Inter", "Helvetica Neue", Arial, sans-serif;
}


body {
  font-family: var(--font);
  color: var(--c-text);
  margin: 0;
  background: var(--c-canvas);
}

/* the cemetery page is one screen on any device: the map fills it and the panels scroll inside themselves.
   Fixed (not just overflow hidden) because iOS Safari still drags the whole page otherwise. */
html,
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ---- side panels ---------------------------------------------------- */

.panel {
  position: fixed;
  top: 12px;
  bottom: 12px;
  left: 64px; /* clears the Leaflet toolbar in the top-left corner */
  width: var(--panel-width);
  display: none;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 1000;
}

.panel.is-open {
  display: flex;
  animation: panel-in 0.2s ease-out;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal.is-open > * {
  animation: modal-in 0.18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .panel.is-open,
  .modal.is-open > * {
    animation: none;
  }
}


/* the left panels (search and grave details) share one width */
.panel-wide {
  width: var(--panel-wide-width);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
}

.panel-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.panel-close {
  border: 0;
  background: none;
  padding: 4px 6px;
  color: var(--c-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover,
.panel-close:focus {
  color: var(--c-text);
}

.panel-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* hidden from people; bots tend to fill it in */
.prijedlog-web {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
}

/* the button that opens the suggestion form: outlined, like the other secondary actions */
.prijedlog-gumb {
  border: 1px solid var(--c-primary);
  border-radius: 6px;
  background: var(--c-surface);
  color: var(--c-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
}

.prijedlog-gumb:hover,
.prijedlog-gumb:focus {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

/* map toolbar: one white group with the icon buttons */
.karta-traka {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
}

/* .leaflet-bar sets overflow: hidden later in this file; this keeps the toolbar open for the language options */
.karta-traka.leaflet-bar {
  overflow: visible;
}

/* overflow is visible so the language options can open to the right: round the outer corners here */
.karta-traka > :first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.karta-traka > :last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.karta-jezici {
  position: relative;
}

.karta-jezici-opcije {
  position: absolute;
  top: 0;
  left: 100%;
  display: none;
  box-shadow: var(--shadow);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

.karta-jezici.is-open .karta-jezici-opcije {
  display: flex;
}

.karta-jezici-opcije a {
  border-left: 1px solid #e6ebef;
  border-bottom: 0;
}

.karta-jezici-opcije a.is-aktivan {
  background: #f0f5f8;
}

.karta-traka a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-bottom: 1px solid #e6ebef;
  color: var(--c-primary);
  font-size: 18px;
  background: var(--c-surface);
}

.karta-traka a:last-child {
  border-bottom: 0;
}

/* hint on the map while the suggestion waits for a grave to be clicked */
.karta-poruka {
  display: none;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow);
  color: var(--c-primary-dark);
  font-weight: 600;
}

.karta-poruka.is-visible {
  display: block;
}

/* keyboard focus is always visible */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* help dialog */
.pomoc-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.pomoc-tekst {
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.pomoc-tekst p {
  margin: 0 0 10px;
}

/* language button in the map toolbar: text instead of an icon */
.leaflet-touch .karta-traka a.karta-traka-tekst {
  font-size: 13px;
  font-weight: 700;
}

/* map toolbar: larger buttons in the app's colours */
.leaflet-touch .leaflet-bar a,
.leaflet-touch .karta-traka a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 18px;
  color: var(--c-primary);
}

.leaflet-bar a:hover,
.easy-button-button:hover {
  background: #eef4f7;
  color: var(--c-primary-dark);
}

/* contact line in the bottom left corner, under the legend */
.kontakt-kontrola {
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow);
  color: var(--c-muted);
  font-size: 12px;
}

.kontakt-kontrola a {
  color: var(--c-primary);
  font-weight: 600;
}

/* suggested changes: a modal card */
.prijedlog-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.prijedlog-form {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.prijedlog-intro {
  color: var(--c-muted);
  font-size: 13px;
}

.prijedlog-mreza {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.prijedlog-poruka {
  min-height: 20px;
  font-weight: 600;
  color: var(--c-primary);
}

.prijedlog-poruka.is-error {
  color: #c0392b;
}

/* tabs of the side panel: search and grave details */
.panel-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--c-border);
}

.panel-tab {
  transition: color 0.15s, border-color 0.15s;
  flex: 1;
  padding: 12px 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--c-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.panel-tab.is-hidden {
  display: none;
}

.panel-tab:hover {
  color: var(--c-text);
}

.panel-tab.is-active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}

.panel-tabs .panel-close {
  margin-right: 8px;
}

.panel-section {
  display: none;
  position: relative;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.panel-section.is-active {
  display: flex;
}

/* neighbour hotspots are only shown for a scene opened from a virtual walk point */
.bez-hotspota .link-hotspot {
  display: none !important;
}

/* hotspots to the neighbouring 360 photos: a small arrow that stays out of the way */
.link-hotspot-icon {
  width: 36px;
  height: 36px;
  cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s;
}

.link-hotspot-icon:hover {
  transform: scale(1.12);
}

/* tables: quieter header, faint row lines, the app's hover and selection colours */
.ag-theme-alpine.myGrid {
  --ag-background-color: var(--c-surface);
  --ag-foreground-color: var(--c-text);
  --ag-header-background-color: var(--c-surface-2);
  --ag-header-foreground-color: var(--c-text);
  --ag-odd-row-background-color: var(--c-surface-2);
  --ag-row-hover-color: var(--c-hover);
  --ag-selected-row-background-color: var(--c-selected);
  --ag-row-border-color: var(--c-border);
  --ag-border-color: var(--c-border);
  --ag-font-family: var(--font);
}

/* the 360 viewer fills its tab; the toggle button sits on top of it */
#pano {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #000;
}

/* the brand block at the top of the search panel */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

.brand img {
  height: 40px;
  width: auto;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.lang-switch {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.lang-switch a {
  color: var(--c-muted);
  text-decoration: none;
  padding: 1px 4px;
  border-radius: 4px;
}

.lang-switch a:hover,
.lang-switch a.is-aktivan {
  color: var(--c-text, #222);
  background: rgba(0, 0, 0, 0.06);
}

/* search list: one grid that fills the panel */
#pokojnici-grid-search {
  flex: 1;
  min-height: 0;
}

/* grave details: summary on top, the two tables share the rest */
.detail-summary {
  display: flex;
  flex-wrap: wrap; /* when the card is too narrow for text and photos side by side, the photos move under the text */
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
}

.detail-info {
  flex: 1 1 160px;
  min-width: 0;
}

.detail-line {
  margin: 0 0 4px;
  font-size: 14px;
}

.detail-line:empty {
  display: none;
}

.detail-actions {
  margin-top: 8px;
}

.detail-images {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

#usm-image {
  display: none;
}

#pokojnici-grid {
  min-height: 0;
  flex: 2 1 0;
}

.myGrid {
  width: 100%;
  height: 100%;
}

/* the theme class sets the same variable on this element, so match it with higher specificity */
.ag-theme-alpine.myGrid {
  --ag-font-size: 12px;
}

/* public clients of the grave in view (visitors who are not logged in) */
.komitenti-javno {
  padding: 12px 16px;
  overflow-y: auto;
  font-size: 14px;
}

.komitent-javno {
  margin: 0 0 10px;
}

/* ---- 360 panel ------------------------------------------------------- */

#360container {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ---- map controls ---------------------------------------------------- */

.leaflet-bar {
  border: 0 !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.leaflet-bar a {
  color: var(--c-primary);
  background: var(--c-surface);
}

.leaflet-bar a:hover {
  color: var(--c-primary-dark);
}

.map-legend {
  max-height: 40vh;
  overflow-y: auto;
  padding: 8px 10px;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.map-legend-naslov {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.map-legend-naslov::after {
  content: '\25BE';
  float: right;
}

.map-legend.is-zatvoreno .map-legend-naslov::after {
  content: '\25B8';
}

.map-legend.is-zatvoreno .map-legend-sadrzaj {
  display: none;
}

.map-legend-title {
  margin-bottom: 6px;
  font-weight: 600;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.map-legend-tocka {
  width: 14px;
  height: 14px;
  border: 2px solid #1f5f7a;
  border-radius: 50%;
  background: var(--c-surface);
}

.map-legend-swatch.map-legend-odabrano {
  border: 3px dashed red;
  background: var(--c-surface);
}

.map-legend-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}

/* ---- buttons ------------------------------------------------------- */

.btn-primary {
  background-color: var(--c-primary);
  border-color: var(--c-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
}

/* the USM thumbnail keeps its proportions: the box is fixed, the photo is cropped to fill it */
.usm-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* photo modal: previous and next arrows over the picture */
.modal-photo {
  position: relative;
  background: var(--c-surface);
}

.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  color: var(--c-primary);
  font-size: 16px;
  cursor: pointer;
}

.photo-prev {
  left: 10px;
}

.photo-next {
  right: 10px;
}

.photo-count {
  padding: 8px;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 13px;
  text-align: center;
}

/* ---- modals ---------------------------------------------------------- */

.modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 32, 45, 0.5);
}

.modal.is-open {
  display: flex;
  overflow-y: auto; /* bootstrap sets overflow: hidden; a tall dialog must still reach its title */
}

.modal-card {
  margin: auto; /* centred when it fits, starts at the top when it does not */
  position: relative;
  width: min(420px, 100%);
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

/* bootstrap's clearfix pseudo-elements would become flex items and push the title off-centre */
.modal-header::before,
.modal-header::after {
  content: none;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 16px;
}

.modal-body .form-group {
  margin-bottom: 12px;
}

.modal-body .form-control {
  height: 40px;
}

.modal-error {
  display: block;
  min-height: 18px;
  margin-bottom: 8px;
  color: #c0392b;
  font-weight: 600;
}

.modal-card-image {
  width: min(900px, 100%);
  max-height: calc(100vh - 32px);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

.modal-card-image img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 170px); /* header, counter and the modal padding stay inside the window */
  object-fit: contain;
  border-radius: 0 0 var(--radius) var(--radius);
}




/* ---- mobile: panels become centred cards, like the help and suggestion forms ---- */

@media (max-width: 500px) {
  .panel {
    top: 0;
    bottom: 0;
    left: 16px;
    right: 16px;
    margin: auto; /* top and bottom are both set, so auto margins centre the panel vertically */
    width: auto;
    height: 70vh; /* a fixed height, so the list and the forms fill the card instead of shrinking to their content */
    border-radius: var(--radius);
  }

  /* the company logo is wide: keep it to part of the card so the cemetery name and languages stay visible */
  .brand {
    min-width: 0;
  }

  .brand img {
    flex-shrink: 1;
    max-width: 45%;
    height: auto;
    max-height: 40px;
  }

  .brand > div {
    min-width: 0;
  }

  /* on a narrow card the summary stacks: text first, photos under it, so they do not cover the text */
  .detail-summary {
    flex-direction: column;
  }

  /* the grave details scroll inside the card as a whole; the burial table keeps a readable height */
  #tab-detaljno {
    overflow-y: auto;
  }

  #pokojnici-grid {
    flex: none;
    height: 240px;
  }
}

/* phones in landscape are short, not narrow: the same scrolling details apply there */
@media (max-height: 500px) {
  #tab-detaljno {
    overflow-y: auto;
  }

  #pokojnici-grid {
    flex: none;
    height: 240px;
  }
}

/* ---- map labels (set per cemetery in page.html) ---------------------- */

.polje-label {
  background: none;
  border: none;
  box-shadow: none;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
}

.grave-label span {
  font-size: 10px;
  color: #000;
  white-space: nowrap;
  text-shadow: 1px 0 #fff, -1px 0 #fff, 0 1px #fff, 0 -1px #fff, 1px 1px #fff, -1px -1px #fff, 1px -1px #fff, -1px 1px #fff;
}

.hide-oznake .grave-label {
  display: none;
}

/* ---- ag-grid ---------------------------------------------------------- */

.ag-header-cell-text {
  width: 100%;
  text-align: center;
}

.ag-cell-value {
  text-align: center;
}

@media only screen and (max-width: 480px) {
  .ag-header-cell,
  .ag-cell {
    padding: 0 !important;
  }

  .ag-cell-value {
    font-size: 11px !important;
  }

  .ag-floating-filter-body {
    min-width: 80%;
    left: 10%;
  }
}
