/*--------------------------------------------------------------------------------------------------------------------*/
/*                                   CSS-Datei für die Karten-Apps von Bocholt Maps                                   */
/*  Das Design (Farben, Kopf-/Fußzeile, Kartenknöpfe, Panels, Popups, Darkmode) kommt aus bocholtDesign.css           */
/*  (Kopie von geoportal/apps/main/bocholt.css). Hier stehen nur Ergänzungen für Bocholt Maps.                        */
/*--------------------------------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------------------------------*/
/*Farbschema Bocholt Maps (angelehnt an bocholt.de) – überschreibt die Geoportal-Farben aus bocholtDesign.css          */
/*  Bocholt-Grün #69b022: Streifen, Linien, Unterstreichungen, Markierungen (nicht für kleine Schrift: zu wenig        */
/*  Kontrast zu Weiß); Textgrün #3f7d12: Knöpfe, Links, grüne Schrift (Kontrast 5,1:1). Kopfzeile weiß, Fußzeile grau. */
/*--------------------------------------------------------------------------------------------------------------------*/

:root{
    --bm-gruen: #69b022;
    --fuss-bg: #f2f2f2;
    --headerHeight: 56px;                     /* inkl. 5 px grünem Streifen */

    --headerFooterBackground: #3f7d12;
    --tableRowBackgroundHeader: #3f7d12;
    --cAerialImageArchiveWidget_ButtonBG: #f2f2f2;
    --cAerialImageArchiveWidget_ButtonBG_hover: #dcefc6;

    --accent: #3f7d12;
    --accent-light: #356b0f;                  /* Hover: dunkler, damit weiße Schrift lesbar bleibt */
    --accent-soft: rgba(105, 176, 34, 0.14);
    --page-bg: #f2f2f2;
    --border-soft: rgba(0, 0, 0, 0.12);
    --text-main: #2b2b2b;
    --text-muted: #5f6359;

    --bar-bg: #ffffff;
    --bar-border: rgba(0, 0, 0, 0.1);
    --bar-text: #2b2b2b;
    --bar-muted: #4f5a4a;
    --bar-line: #d6d6d6;
    --bar-hover: rgba(105, 176, 34, 0.14);
    --bar-hover-text: #3f7d12;
    --bar-chip: #ffffff;
    --bar-chip-border: #cfcfcf;
    --bar-chip-text: #2b2b2b;
    --bar-danger: #c62828;
    --bar-danger-soft: rgba(198, 40, 40, 0.1);

    --control-icon: #3a3f37;
    --control-hover: #eef6e6;
    --control-ring: rgba(0, 0, 0, 0.1);
    --panel-inset: #f2f2f2;
    --field-border: #d0d0d0;
}

:root[data-theme="dark"]{
    --fuss-bg: #1a2117;

    --headerFooterBackground: #141a12;
    --tableRowBackground1: #1a2117;
    --tableRowBackground2: #141a12;
    --tableRowBackgroundHeader: #2f5e10;
    --tableHover: #243020;
    --cAerialImageArchiveWidget_ButtonBG: #1a2117;
    --cAerialImageArchiveWidget_ButtonBG_hover: #33521c;

    --accent: #8fd14f;
    --accent-light: #a6dd6d;
    --accent-soft: rgba(143, 209, 79, 0.16);
    --surface: #10150e;
    --page-bg: #11160f;
    --border-soft: rgba(255, 255, 255, 0.14);
    --text-main: #e9eee6;
    --text-muted: #a7b3a2;

    --bar-bg: #141a12;
    --bar-border: rgba(255, 255, 255, 0.12);
    --bar-text: #e9eee6;
    --bar-muted: #a7b3a2;
    --bar-line: rgba(255, 255, 255, 0.16);
    --bar-hover: rgba(143, 209, 79, 0.16);
    --bar-hover-text: #8fd14f;
    --bar-chip: rgba(143, 209, 79, 0.14);
    --bar-chip-border: rgba(255, 255, 255, 0.16);
    --bar-chip-text: #8fd14f;
    --bar-danger: #f08a8a;
    --bar-danger-soft: rgba(240, 138, 138, 0.16);

    --control-bg: #1a2117;
    --control-icon: #dfe7da;
    --control-hover: #243020;
    --control-ring: rgba(255, 255, 255, 0.08);
    --panel-bg: #1a2117;
    --panel-inset: #141a12;
    --field-bg: #141a12;
    --field-border: rgba(255, 255, 255, 0.16);
    --segment-active: #2a3626;
    --on-accent: #141a12;
}

/* Kopfzeile weiß (Darkmode dunkel) mit grünem Streifen wie die Navigationsleiste von bocholt.de; App-Name in Grün */
#headerDiv{
  border-bottom: 5px solid var(--bm-gruen);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#headerDivBereich{
  color: var(--accent);
}

/* Fußzeile hellgrau (Darkmode dunkel) mit grüner Linie oben */
#footerDiv{
  background-color: var(--fuss-bg);
  border-top: 3px solid var(--bm-gruen);
}

/* Überschriften wie auf bocholt.de grün unterstrichen: Popup-Titel und Titel der ausgeklappten Panels */
.gp-popup .gp-titel{
  align-self: flex-start;
  padding-bottom: 3px;
  border-bottom: 3px solid var(--bm-gruen);
}

#viewDiv .esri-expand__content::before{
  margin-bottom: 4px;
  padding-bottom: 8px;
  background: linear-gradient(var(--bm-gruen), var(--bm-gruen)) 16px 100% / 28px 3px no-repeat;
}

/* Druckrahmen und Screenshot-Auswahl in Bocholt-Grün */
#cPlotWidget_plotBox{
  border-color: rgba(105, 176, 34, 0.85);
}

#cPlotWidget_maskDiv{
  background: rgba(105, 176, 34, 0.2);
  border-color: var(--bm-gruen);
}

/* Scrollbalken im Darkmode passend zum dunklen Grün */
:root[data-theme="dark"] *{
  scrollbar-color: #3a4636 #141a12;
}

:root[data-theme="dark"] *::-webkit-scrollbar-track{
  background: #141a12;
}

:root[data-theme="dark"] *::-webkit-scrollbar-thumb{
  background-color: #3a4636;
  border-color: #141a12;
}

:root[data-theme="dark"] *::-webkit-scrollbar-thumb:hover{
  background-color: #4b5a45;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Seitenhöhe: auf Mobilgeräten die tatsächlich sichtbare Höhe (ohne Adressleiste), sonst wird unten abgeschnitten      */
/*--------------------------------------------------------------------------------------------------------------------*/

@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Kartenfenster: ohne Auswahl-Tabelle unten (in bocholtDesign.css sind 2 px dafür abgezogen)                          */
/*--------------------------------------------------------------------------------------------------------------------*/

#viewDiv{
  height: calc(100% - var(--headerHeight) - var(--footerHeight));
}

/* leere Hilfs-Container der alten Oberfläche */
#infoDiv{
  display: none;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Kopfzeile: Impressum als Textverweis, Handbuch als runder Knopf                                                     */
/*--------------------------------------------------------------------------------------------------------------------*/

.kopf-link{
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--bar-muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition);
}

.kopf-link:hover{
  background: var(--bar-hover);
  color: var(--bar-hover-text);
}

.kopf-link:focus-visible{
  outline: 2px solid var(--bar-text);
  outline-offset: 1px;
}

a.kopf-knopf{
  text-decoration: none;
}

/* Logo + "Bocholt Maps" als Verweis zur Startseite (in einigen Apps) */
a#headerDivMarke{
  border-radius: 8px;
  text-decoration: none;
}

a#headerDivMarke:focus-visible{
  outline: 2px solid var(--bar-text);
  outline-offset: 2px;
}

@media (max-width: 440px){
  .kopf-link{ padding: 0 6px; font-size: 12.5px; }
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Fußzeile: nur die Maßstabszahl; die Maßstabsleiste (ScaleBar-Widget im Container #scalebar) wird ausgeblendet       */
/*--------------------------------------------------------------------------------------------------------------------*/

#scalebar{
  display: none;
}

/* Koordinatenformat (ETRS89): nur Anzeige, nicht umschaltbar – kein Pfeil, kein Klick */
#coordShow .esri-coordinate-conversion__select-row{
  padding: 0 11px;
  background-image: none;
  cursor: default;
  pointer-events: none;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Suche: Vorschlagsliste höher (Esri: 300 px), damit bei "Suchen" mehrere Kategorien auf einen Blick sichtbar sind     */
/*--------------------------------------------------------------------------------------------------------------------*/

#viewDiv .esri-search .esri-search__suggestions-menu{
  max-height: min(480px, calc(100vh - 180px));
}

/* Überschrift je Suchquelle (Kategorie) als farbige Leiste; bleibt beim Scrollen oben stehen */
#viewDiv .esri-search .esri-search__suggestions-menu .esri-menu__header{
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 6px 0 4px;
  padding: 7px 10px 7px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background-color: color-mix(in srgb, var(--accent) 14%, var(--panel-bg));   /* deckend, damit beim Scrollen nichts durchscheint */
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 17px;
  letter-spacing: 0.05em;
}

#viewDiv .esri-search .esri-search__suggestions-menu .esri-menu__header:first-child{
  margin-top: 0;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Messen: drei Werkzeugknöpfe im Panel (Strecke, Fläche, Löschen)                                                     */
/*--------------------------------------------------------------------------------------------------------------------*/

#viewDiv .esri-expand__content:has(#topbar)::before { content: "Messen"; }

#topbar {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  background: transparent;
}

#topbar .action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background-color: var(--panel-bg);
  box-shadow: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

#topbar .action-button:hover,
#topbar .action-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  background-color: var(--control-hover);
  color: var(--accent);
}

#topbar .action-button.active {
  border-color: var(--accent);
  background-color: var(--accent);
  color: var(--on-accent);
}

/* Ergebnis der Messung (Esri-Widget unten rechts) im Panel-Stil statt rund */
#viewDiv .esri-ui-corner .esri-distance-measurement-2d.esri-component,
#viewDiv .esri-ui-corner .esri-area-measurement-2d.esri-component {
  overflow: hidden !important;
  border: 1px solid var(--border-soft);
  border-radius: 14px !important;
  background-color: var(--panel-bg);
  box-shadow: var(--shadow-lg) !important;
  color: var(--text-main);
}

#viewDiv .esri-distance-measurement-2d .esri-button,
#viewDiv .esri-area-measurement-2d .esri-button {
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background-color: var(--accent);
  color: var(--on-accent);
  font-family: 'Inter', Arial, sans-serif;
  font-weight: 600;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Ausgeklappte Panels über den übrigen Kartenelementen                                                                */
/*--------------------------------------------------------------------------------------------------------------------*/

.esri-expand__container--expanded {
  z-index: 99 !important;
}

.esri-expand__mask--expanded {
  z-index: 99 !important;
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Popup-Breite: höchstens 440 px, längere Texte (z. B. Beschreibungen) brechen um, statt das Popup breit zu ziehen     */
/*(bocholtDesign.css erlaubt bis 1000 px); auf schmalen Bildschirmen höchstens Fensterbreite abzüglich Rand           */
/*--------------------------------------------------------------------------------------------------------------------*/

#viewDiv .esri-popup__main-container,
#viewDiv .esri-popup__main-container.esri-widget.esri-popup--shadow.esri-popup--is-collapsible {
  width: auto !important;
  min-width: min(300px, calc(100vw - 32px));
  max-width: min(440px, calc(100vw - 32px)) !important;
}

#viewDiv .esri-popup__content {
  overflow-wrap: break-word;
}

/* Popup-Höhe: nie höher als das Kartenfenster (bocholtDesign.css erlaubt 750 px – lange Popups mit Foto verschwanden
   sonst hinter der Kopfzeile); der Inhalt scrollt innerhalb des Popups. 44 px = Abstand unten (Andockposition) + etwa 14 px Luft zur Kopfzeile */
#viewDiv .esri-popup__main-container,
#viewDiv .esri-popup__main-container.esri-widget.esri-popup--shadow.esri-popup--is-collapsible {
  max-height: calc(100vh - var(--headerHeight) - var(--footerHeight) - 44px) !important;
}

@supports (height: 100dvh) {
  #viewDiv .esri-popup__main-container,
  #viewDiv .esri-popup__main-container.esri-widget.esri-popup--shadow.esri-popup--is-collapsible {
    max-height: calc(100dvh - var(--headerHeight) - var(--footerHeight) - 44px) !important;
  }
}

/*--------------------------------------------------------------------------------------------------------------------*/
/*Popup-Karten: Ergänzungen für Bocholt Maps (popupBausteine.js, Klassen "bm-")                                       */
/*--------------------------------------------------------------------------------------------------------------------*/

/* Fotos der Orte vollständig zeigen (nicht beschneiden), höchstens 240 px hoch */
.gp-popup .bm-foto {
  max-height: 240px;
  object-fit: contain;
}

/* Beschreibungstexte: Zeilenumbrüche aus den Daten beibehalten */
.gp-popup .bm-text {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Rechtlicher Hinweis (z. B. Bebauungspläne) oben in der Karte */
.bm-hinweisbox {
  padding: 9px 11px;
  border-left: 4px solid #e0a800;
  border-radius: var(--radius-sm);
  background: var(--gp-warnung-bg);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.45;
}

/* Links in Popup-Zeilen (Telefon, E-Mail, Beschreibung) in Akzentfarbe statt Browser-Blau */
.gp-popup .gp-zeile a,
.gp-popup .bm-text a {
  color: var(--accent);
  text-decoration: none;
}

.gp-popup .gp-zeile a:hover,
.gp-popup .bm-text a:hover {
  text-decoration: underline;
}
