/* ---------- Dialog ---------- */

.ashp_messagebox {
  --mb-blue: 30, 56, 118;
  --mb-text: #2b3535;

  width: min(480px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;

  font: inherit;
  color: var(--mb-text);
  background: #fff;
  border: 1px solid whitesmoke;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ashp_messagebox[open] {
  display: flex;
  flex-direction: column;
  animation: ashp_mb_in 0.18s ease-out;
}

.ashp_messagebox::backdrop {
  background: rgba(15, 20, 35, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: ashp_mb_backdrop 0.18s ease-out;
}

@keyframes ashp_mb_in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes ashp_mb_backdrop {
  from { opacity: 0; }
  to   { opacity: 1; }
}

html.ashp_mb_open {
  overflow: hidden;            /* Seite dahinter nicht scrollen */
}

/* ---------- Titelleiste ---------- */

.ashp_mb_titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6em;
  min-height: 48px;
  padding-left: 16px;
  color: #3f4903;
  background: #a9c308;
  
}

.ashp_mb_title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.6em 0;
  font-size: 110%;
  text-align: center;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
  overflow-wrap: break-word;
}

.ashp_mb_icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.ashp_mb_icon:empty {
  display: none;
}

.ashp_mb_icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ashp_mb_icon.is-image {
  border-radius: 0;
  box-shadow: none;
}

.ashp_mb_icon.is-error    { background: #c62828; }
.ashp_mb_icon.is-warning  { background: #e0a100; color: #3a2a00; }
.ashp_mb_icon.is-success  { background: #a9c308; color: #1c2600; }
.ashp_mb_icon.is-question { background: #fff; color: rgb(var(--mb-blue)); }
.ashp_mb_icon.is-info {
  background: #5aaee8;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.ashp_mb_close {
  flex: 0 0 auto;
  align-self: stretch;
  width: 48px;
  min-height: 48px;
  padding: 0;
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  opacity: 0.8;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.ashp_mb_close[hidden] {
  display: none;
}

.ashp_mb_close:active {
  background: rgba(255, 255, 255, 0.25);
  opacity: 1;
}

.ashp_mb_close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -6px;
  opacity: 1;
}

@media (hover: hover) {
  .ashp_mb_close:hover {
    background: rgba(255, 255, 255, 0.16);
    opacity: 1;
  }
}

/* ---------- Text ---------- */

.ashp_mb_text {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.ashp_mb_text.is-plain {
  white-space: pre-line;       /* \n im Text wird zum Zeilenumbruch */
}

.ashp_mb_text > :first-child { margin-top: 0; }
.ashp_mb_text > :last-child  { margin-bottom: 0; }

/* ---------- Buttonleiste ---------- */

.ashp_mb_buttons {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  background: #f8faf4;
  border-top: 1px solid #e6eadf;
  margin-top: 25px;
}

.ashp_mb_buttons .ashp_button {
  margin: 0;
}

/* kompakte Buttons (allgemein nutzbar) */
.ashp_button[data-compact="1"] {
  min-width: 90px;
  min-height: 40px;
  padding: 0.45em 1em;
}

@media (pointer: coarse) {
  .ashp_button[data-compact="1"] {
    min-height: 44px;
  }
}

/* ---------- schmale Bildschirme ---------- */

@media (max-width: 480px) {
  .ashp_messagebox {
    width: calc(100vw - 24px);
  }

  .ashp_mb_text {
    padding: 16px;
  }

  .ashp_mb_buttons .ashp_button {
    display: inline-flex;
    flex: 1 1 auto;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ashp_messagebox[open],
  .ashp_messagebox::backdrop {
    animation: none;
  }
  .ashp_mb_close {
    transition: none;
  }
}