/**
 * PWA + responsive fixes — no overlap, touch targets, small-screen icon bar.
 */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#page-wrapper {
  overflow-x: hidden;
}

.wrapper.wrapper-content {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Top bar: prevent logo / controls collision */
@media (max-width: 767px) {
  .navbar-fixed-top.white-bg {
    padding-left: 6px;
    padding-right: 6px;
    min-height: 52px;
  }

  .navbar-fixed-top.white-bg > img.logo {
    display: none !important;
  }

  .navbar-header {
    float: left;
    margin-right: 4px;
  }

  .navbar-top-links {
    margin-right: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    max-width: calc(100vw - 56px);
  }

  .navbar-top-links > li > a {
    padding: 12px 8px;
    min-width: 44px;
    min-height: 44px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-top-links .navbar-form {
    display: none !important;
  }

  .nex-pwa-mobile-search {
    display: list-item !important;
  }

  .row.border-bottom {
    margin-left: 0;
    margin-right: 0;
  }

  .wrapper.white-bg.page-heading {
    padding-left: 8px;
    padding-right: 8px;
  }

  .wrapper.white-bg.page-heading h2 {
    font-size: 14px !important;
    line-height: 1.35;
    word-break: break-word;
    margin-top: 12px !important;
  }

  /* Sidebar: full overlay when open on small screens (MetisMenu) */
  body.mini-navbar .navbar-static-side {
    width: 70px;
  }

  .nex-dash-page .ibox-content,
  .nex-dash-page .panel-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Command palette FAB — clear home indicator / thumb */
  #nex-palette-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(12px + env(safe-area-inset-right, 0px)) !important;
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 18px !important;
  }

  #nex-palette-panel {
    max-width: calc(100vw - 20px) !important;
  }

  .sign-in-wrapper,
  .card-sign-in-inner {
    padding-left: 10px;
    padding-right: 10px;
    max-width: 100%;
  }

  .login-brand .logo {
    max-width: min(280px, 85vw);
    height: auto;
  }
}

/* Desktop: hide mobile-only search icon */
@media (min-width: 768px) {
  .nex-pwa-mobile-search {
    display: none !important;
  }
}

/* Icon “balloons”: native title tooltips + focus ring for keyboard */
.nex-pwa-icon-tip[title]:hover,
.nex-pwa-icon-tip[title]:focus {
  outline: 2px solid rgba(92, 10, 24, 0.45);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .nex-pwa-icon-tip {
    position: relative;
  }
}
