/* Text Header Block Styling */
.howis-embedded .data-header-background {
  background-color: #FCF5E3;
  padding: 2% 0; 
}

.howis-embedded .data-header {
  line-height: 1.7em;
  font-family: Lucida, sans-serif;
  width: 80%; /* Adjusted to match the container width */
  /* Center the header content within its background wrapper */
  max-width: 1000px;
  margin: 0 auto;
}

.howis-embedded h2{    
  color: #007ba5;
  font-weight: 800;
  line-height: 1.2em;
  font-size: 44px;
}

.howis-embedded .large-header { display: inline-block; }
.howis-embedded .large-header h2 { display: inline-block; position: relative; margin-bottom: 30px; }
.howis-embedded .large-header h2::after {
  content: "";
  display: block;
  height: 5px;
  background-color: #FFA500;
  margin-top: 10px;
}


.howis-embedded .more-info h3 {
  color: #007ba5; /* Use the same blue color for consistency */
  margin: 20px auto;
  max-width: 1000px; /* Ensure it doesn't stretch too wide */
  width: 80%; /* match data-header width for consistent left alignment */
}

.howis-embedded .more-info-text {
  color: #666666;
  line-height: 1.2em;
  font-family: Lucida, sans-serif;
  /* Center the header content within its background wrapper */
  margin: 0 auto;
}

.howis-embedded .more-info ul {
  color: #007ba5; /* Use the same blue color for consistency */
  margin: 20px auto;
  max-width: 1000px; /* Ensure it doesn't stretch too wide */
  width: 80%; /* match data-header width for consistent left alignment */

}

/* Map Styling */

.howis-embedded .map {
  position: relative !important;
  width: 80%;
  margin: 20px auto;
  max-width: 1000px; /* Ensure it doesn't stretch too wide */
}


.howis-embedded [id$="-map"] {
  position: relative !important;
  overflow: visible; /* allow popups to extend beyond map edges */
  width: 100%;
  height: 900px;
  cursor: pointer; /* show pointing hand over map area */
}

/* Popup Styling */

/* Undo any WordPress defaults for map popups */
.howis-embedded .map-popup, .howis-embedded .pegel-class-example { font-family: Arial, sans-serif; font-size: 14px; line-height: 1.2; }
.howis-embedded .map-popup p, .howis-embedded .pegel-class-example p { margin: 0; line-height: 1.2; }
.howis-embedded .map-popup table, .howis-embedded .pegel-class-example table { border-collapse: collapse; border-spacing: 0; margin: 0;}
.howis-embedded .map-popup th, .howis-embedded .map-popup td, .howis-embedded .pegel-class-example th, .howis-embedded .pegel-class-example td { margin: 0; padding: 2px 6px; line-height: 1.2; }
.howis-embedded .map-popup a, .howis-embedded .pegel-class-example a { display: inline-block; margin: 2px 0 0 0; padding: 0; line-height: 1.2; }
.howis-embedded .map-popup table + a, .howis-embedded .pegel-class-example table  + a { margin-top: 2px;} /* ensure minimal spacing */

/* Popup skin */
.howis-embedded .map-popup, .howis-embedded .pegel-class-example {
  background-color: white;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  width: 300px;
  word-wrap: break-word;
}

/* style specific to the example popups in the Pegel header block */
.howis-embedded .pegel-class-example {
  margin-bottom: 10px;
  position: static;
  display: inline-block; 
  box-sizing: border-box;
}

/* style specific to the popups generated by map clicks. 
   This styling helps to set the position of the popups next to the pointer clicks. */

.howis-embedded .map-popup {
  position: absolute;
  z-index: 1000;
  display: none;
  pointer-events: auto;
}

/* Add close button to popups */
.howis-embedded .popup-close {
  position: absolute;
  top: 5px;
  right: 8px;
  cursor: pointer;
  color: #666;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  user-select: none;
}

.howis-embedded .popup-close:hover {
  color: #000;
}


/* Pegel classifications layout */

.howis-embedded .pegel-classifications {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
  align-items: start;
  justify-items: center;
}

.howis-embedded .pegel-class {
  width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.howis-embedded .pegel-class-caption { width: 100%; margin-top: 8px; }

/* Responsive: collapse grid to 1 column on narrow screens */
@media (max-width: 700px) {
  .howis-embedded .pegel-classifications {
    grid-template-columns: 1fr;
  }
}

/* Mobile/iPhone responsive adjustments */
@media (max-width: 768px) {
  /* Make containers full width on mobile */
  .howis-embedded .data-header,
  .howis-embedded .map,
  .howis-embedded .more-info h3,
  .howis-embedded .more-info ul {
    width: 95%;
    max-width: 100%;
  }
  
  /* Reduce map height on mobile */
  .howis-embedded [id$="-map"] {
    height: 700px;
    min-height: 400px;
  }
  
  /* Scale down heading on mobile */
  .howis-embedded h2 {
    font-size: 28px;
  }
  
  /* Make popups narrower and responsive */
  .howis-embedded .map-popup,
  .howis-embedded .pegel-class-example,
  .howis-embedded #niederschlag-popup {
    width: 90vw;
    max-width: 280px;
    box-sizing: border-box;
  }
  
  /* Adjust popup images for mobile */
  .howis-embedded .map .map-popup .popup-img-hrb {
    width: 70px;
    height: 70px;
  }
  
  /* Make pegel classification cards responsive */
  .howis-embedded .pegel-class {
    width: 90vw;
    max-width: 280px;
  }
  
  /* Ensure popup tables don't overflow */
  .howis-embedded .map .map-popup .popup-table,
  .howis-embedded .pegel-class-example .popup-table {
    font-size: 12px;
  }
  
  .howis-embedded .map .map-popup .popup-table th,
  .howis-embedded .map .map-popup .popup-table td,
  .howis-embedded .pegel-class-example .popup-table th,
  .howis-embedded .pegel-class-example .popup-table td {
    padding: 2px 4px;
  }
}

/* Extra small screens (iPhone SE, small Android phones) */
@media (max-width: 375px) {
  .howis-embedded [id$="-map"] {
    height: 300px;
  }
  
  .howis-embedded h2 {
    font-size: 24px;
  }
  
  .howis-embedded .map-popup,
  .howis-embedded .pegel-class-example {
    width: 95vw;
    max-width: 260px;
  }
}

.howis-embedded .pegel-class-caption-text {
  font-size: 14px;
  line-height: 1.4;
}


/* Popup images: left-aligned and sized */
.howis-embedded .map .map-popup .popup-img {
  display: block;
  margin: 0 !important; /* no auto-centering; override theme defaults */
}
.howis-embedded .map .map-popup .popup-header,
.howis-embedded .pegel-class-example .popup-header {
  display: flex;
  flex-direction: column;
  padding: 10px;
  width: 160px; /* requested fixed width */
  box-sizing: border-box; /* include padding in the width */
}
.howis-embedded .map .map-popup .popup-img-pegel {
  width: 40px;
  height: 30px;
  border: none;
}

/* Niederschlag-specific wider box and header takes whole width */
.howis-embedded #niederschlag-popup {
  width: 300px;
}
.howis-embedded #niederschlag-popup .popup-header {
  display: flex;
  flex-direction: column;
  padding: 10px;
  width: 100%;
  box-sizing: border-box; /* include padding in the width */
}
.howis-embedded #niederschlag-popup .popup-row { width: 100%; justify-content: left; }
/* Flex column helper for HRB card and Pegel nicht-akt */
.howis-embedded .map .map-popup .popup-flex-col {
  display: flex;
  flex-direction: column;
  align-items: center; 
  text-align: center; 
}
.howis-embedded .map .map-popup .popup-img-hrb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  margin-right: 15px;
}
.howis-embedded .popup-title { margin: 0 0 5px 0; 
                               font-size: 14px; 
                               font-weight: bold; }
.howis-embedded .popup-subtitle { margin: 0; 
                                  font-size: 14px; }
/* Ensure example cards use the same small pegelsymbol size */
.howis-embedded .pegel-class-example .popup-img-pegel {
  width: 80px !important;
  height: 30px !important;
  border: none;
  display: block;
  margin: 0 !important;
}


/* New class-based popup structure */
.howis-embedded .map .map-popup .popup-content,
.howis-embedded .pegel-class-example .popup-content { min-width: 220px; }
.howis-embedded .map .map-popup .popup-header-bar,
.howis-embedded .pegel-class-example .popup-header-bar {
  background-color: var(--header-bg, #e3e5e6);
  color: var(--header-fg, #323232);
  font-weight: bold;
  font-size: 14px;
}
.howis-embedded .map .map-popup .popup-row,
.howis-embedded .pegel-class-example .popup-row { display: flex; align-items: center; justify-content: space-between; }
.howis-embedded .map .map-popup .popup-text,
.howis-embedded .pegel-class-example .popup-text { margin: 0 0 5px 0; }

/* Ensure pegel-class-example text aligns left like map popups */
.howis-embedded .pegel-class-example .popup-header,
.howis-embedded .pegel-class-example .popup-text {
  text-align: left;
}
.howis-embedded .map .map-popup .popup-media,
.howis-embedded .pegel-class-example .popup-media { padding: 10px; margin-left: 10px; display: flex; align-items: center; }
.howis-embedded .map .map-popup .popup-table,
.howis-embedded .pegel-class-example .popup-table { border-collapse: collapse; font-size: 14px; }
.howis-embedded .map .map-popup .popup-table thead th,
.howis-embedded .pegel-class-example .popup-table thead th { text-align: left; color: var(--header-fg, #323232); }
.howis-embedded .map .map-popup .popup-table th, 
.howis-embedded .map .map-popup .popup-table td,
.howis-embedded .pegel-class-example .popup-table th,
.howis-embedded .pegel-class-example .popup-table td { padding: 2px 6px; line-height: 1.2; color: var(--body-fg, #323232); }
.howis-embedded .map .map-popup .popup-table--full,
.howis-embedded .pegel-class-example .popup-table--full { width: 100%; }
.howis-embedded .map .map-popup .popup-cell-wrap,
.howis-embedded .pegel-class-example .popup-cell-wrap { white-space: normal; overflow-wrap: break-word; }
.howis-embedded .map .map-popup .popup-link,
.howis-embedded .pegel-class-example .popup-link {
  font-size: 14px;
  text-decoration: underline;
  color: blue;
  display: block;           /* override base inline-block for anchors */
  text-align: center;       /* center the link text */
  margin: 5px auto 0 auto;  /* center the block itself visually */
}


