/* OlaMail as an installed app (olamail_app.php): the page now reaches under the iPhone notch and home bar
   (viewport-fit=cover), so keep the webmail inside the safe area. env() is 0 wherever there is nothing to avoid
   (desktop, Android, iPhone portrait under the status bar), so nothing moves there. */
html body {
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* Elastic's dialogs do not follow body's padding: jQuery UI places them absolutely against the whole screen, and on a
   phone (<= 480px) Elastic stretches them full screen (top:0, height:100%) with a 58px title bar on top and the
   Save / Cancel / OK bar at the bottom. In the installed iPhone app that bottom bar would sit ~34px under the home bar.
   Grow both bars by the safe area instead, so the buttons stay where they were and the extra strip only carries the
   bar's background. Elastic forces height:58px and padding:0 on that bar as important rules, so these must be important
   too. Where env() is 0 (browser tab, Android, desktop) the bars stay exactly 58px. */
@media screen and (max-width: 480px) {
  html body .ui-dialog .ui-dialog-buttonpane {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    height: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
  }
  html body .ui-dialog .ui-dialog-titlebar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(58px + env(safe-area-inset-top, 0px));
  }
}


/* Optional mobile installation control, above Roundcube's bottom navigation.
   Safari's own Share sheet is controlled by iOS, not by this page. */
.olamail-app-install {
  position: fixed;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  padding: 7px;
  border: 1px solid #cfd9e4;
  border-radius: 12px;
  background: #fff;
  color: #172b4d;
  box-shadow: 0 4px 18px rgba(19, 38, 69, .14);
  font-family: system-ui, sans-serif;
  font-size: 13px;
}
.olamail-app-install-button {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: #1d5798;
  color: #fff;
  font: 600 13px/1.3 system-ui, sans-serif;
  cursor: pointer;
}
.olamail-app-install-close {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #52647c;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.olamail-app-install-guide {
  flex-basis: 100%;
  margin: 3px 5px 5px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.olamail-app-install-guide[hidden] { display: none; }
@media (min-width: 769px), (display-mode: standalone) {
  .olamail-app-install { display: none; }
}
