#pgf-top-bar {
  background-color: var(--pgf-color-primary);
  padding: 6px 0;
  width: 100%;

  .pgf-container {
    padding-inline: 16px;
  }

  .pgf-inner {
    width: 100%;
    max-width: var(--content-width, 1140px);
    margin: 0 auto;
  }

  .pgf-top-bar__content {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .pgf-location-info {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    column-gap: 8px;
    color: var(--pgf-color-white);
    font-size: 12px;
    line-height: 14px;
  }

  .pgf-location-info__wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--pgf-color-white);

    svg {
      flex-shrink: 0;
    }
  }

  .pgf-location-button {
    font-size: 12px;
    line-height: 14px;
    text-transform: initial;
    font-weight: 400;
    text-align: left;

    &:hover {
      text-decoration: underline;
    }
  }
}

html.pgf-modal-open {
  overflow: hidden;
}

/* Overlay styles */
.pgf-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2147483641;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  will-change: opacity;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
}

/* Popup styles for desktop */
#pgf-popup {
  &.pgf-popup {
    display: none;
    position: absolute;
    background-color: var(--pgf-color-white, #ffffff);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 2147483642;
    width: 360px;

    &::before {
      content: "";
      position: absolute;
      top: -8px;
      right: 16px;
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-bottom: 8px solid var(--pgf-color-white, #ffffff);
      z-index: 2001;
    }
  }

  .pgf-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
  }

  .pgf-popup-header h3 {
    margin: 0;
    font-size: 20px;
    line-height: 30px;
    color: var(--pgf-color-title);
  }

  .pgf-popup-body {
    padding: 20px;
  }
}

/* Drawer styles for mobile */
#pgf-drawer {
  &.pgf-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--pgf-color-white, #ffffff);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
    z-index: 2147483642;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.17, 0.89, 0.45, 1); /* Easing function for smoother animation */
    will-change: transform; /* Hint browser to optimize for transform changes */
    -webkit-backface-visibility: hidden; /* Prevent flickering on some devices */
    backface-visibility: hidden;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    transform: translateZ(0);
    touch-action: none; /* Improve touch handling */
    max-height: 95vh;
    max-height: 95dvh; /* Limit height */
    overflow-y: auto; /* Allow scrolling if content is too tall */
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
  }

  .pgf-drawer.pgf-active {
    transform: translateY(0);
  }

  .pgf-drawer-handle {
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .pgf-drawer-handle-bar {
    width: 66px;
    height: 2px;
    background-color: #d9d9d9;
    border-radius: 3px;
    pointer-events: none;
  }

  .pgf-drawer-content {
    padding: 0 16px 16px;
    touch-action: pan-y;
  }

  .pgf-drawer-content h3 {
    margin-top: 8px;
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 24px;
    text-align: left;
    color: var(--pgf-color-title);
  }

  input,
  button {
    touch-action: manipulation;
    cursor: auto;
  }
}

/* Form styles */
#pgf-location-form {
  gap: 24px;
}

#pgf-mobile-location-form {
  gap: 16px;
}

#pgf-location-form,
#pgf-mobile-location-form {
  & {
    display: flex;
    flex-direction: column;
  }

  label {
    font-size: 14px;
    line-height: 21px;
    font-weight: 400;
    color: var(--pgf-color-title);
  }

  .pgf-input {
    padding: 8px 12px;
    padding-left: 34px; /* Add space for geo icon */
    border: 1px solid var(--pgf-color-border-input);
    background-color: var(--pgf-color-white);
    border-radius: 6px;
    font-size: 16px;
    line-height: 21px;
    height: unset;
  }
  .pgf-input:focus {
    box-shadow: none;
    outline: 2px solid var(--pgf-color-border-input);
    outline-offset: -2px;
  }

  .pgf-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .pgf-input-button {
    position: absolute;
    left: 8px;
    top: 11px;
    color: var(--pgf-color-title);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;

    /* &:focus {
      color: var(--pgf-color-title);
    }

    &:hover {
      color: var(--pgf-color-title);
    } */
  }

  .pgf-input-group {
    position: relative;
  }

  .pgf-input.pgf-input--error {
    border-color: var(--pgf-color-error);
    box-shadow: none;
  }

  .pgf-selectize-dropdown--mobile {
    position: relative;
  }

  .pgf-selectize-dropdown--mobile .selectize-dropdown-content {
    --_drawer-min-height: 250px;
    --_margin-height: 58px;
    --_dropdown-max-height: 300px;
    --_dropdown-min-height: 78px;
    height: clamp(
      var(--_dropdown-min-height),
      calc(100vh - var(--_drawer-min-height) - var(--_margin-height)),
      var(--_dropdown-max-height)
    ); /* interactive-widget=resizes-content added to the viewport */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: auto;
  }

  .pgf-form-error {
    color: var(--pgf-color-error);
    font-size: 12px;
    line-height: 18px;
    margin-top: 0;
    margin-bottom: 0;
    display: block;
    margin-top: 4px;
  }

  .pgf-button-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .pgf-submit-button {
    background-color: var(--pgf-color-primary);
    color: var(--pgf-color-white);
    border-radius: 10px;
    padding: 11px;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    text-transform: initial;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--pgf-color-primary);
  }

  .pgf-submit-button:disabled {
    background-color: var(--pgf-color-bg-button-primary--disabled);
    border: 1px solid var(--pgf-color-bg-button-primary--disabled);
  }

  .pgf-submit-button:not(:disabled):hover {
    color: var(--pgf-color-secondary, #ffbb00);
  }

  .pgf-neutral-button {
    border: none;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    text-transform: initial;
    font-weight: 500;
    transition: all 0.2s ease;
  }

  .pgf-neutral-button:not(:disabled):hover {
    color: var(--pgf-color-black);
  }
}

/* Media queries */
@media (min-width: 768px) {
  #pgf-location-form,
  #pgf-mobile-location-form {
    .pgf-input-button {
      color: #dfdfdf;

      &:focus {
        color: var(--pgf-color-title);
      }

      &:hover {
        color: var(--pgf-color-title);
      }
    }
  }

  #pgf-location-form .pgf-input {
    font-size: 14px;
  }

  #pgf-drawer.pgf-drawer {
    display: none !important; /* Hide drawer on desktop */
  }
}

@media (max-width: 767px) {
  #pgf-popup.pgf-popup {
    display: none !important; /* Hide popup on mobile */
  }
}
