.biel-search-wrapper {
  position: absolute;
  z-index: var(--biel-search-content-z-index);
  --biel-bot-content-max-width: var(--biel-search-content-max-width);
}

.biel-search-content {
  background-color: var(--biel-search-content-bg-color);
  border: 1px solid var(--biel-search-content-border-color);
  border-radius: var(--biel-search-content-border-radius);
  box-shadow: var(--biel-search-content-box-shadow);
  box-sizing: border-box;
  color: var(--biel-search-content-text-color);
  display: flex;
  flex-direction: column;
  font-family: var(--biel-search-content-font-family);
  left: 50%;
  max-width: 90%;
  max-height: var(--biel-search-content-max-height);
  overflow: hidden;
  padding: 20px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  z-index: var(--biel-search-content-z-index);
  transition: all 0.3s ease-in-out;
  animation: fadeIn 0.3s;
}

/* Mobile - full-screen by default */
@media screen and (max-width: 768px) {
  .biel-search-content {
    width: 100vw;
    max-width: 100vw;
    /* Use small viewport height - excludes dynamic UI bars in Safari */
    height: 100vh; /* Fallback for older browsers */
    height: 100svh; /* Small viewport height - perfect for iOS Safari */
    height: 100dvh; /* Dynamic viewport height - additional fallback */
    max-height: 100vh; /* Fallback for older browsers */
    max-height: 100svh; /* Small viewport height - perfect for iOS Safari */
    height: 100dvh; /* Dynamic viewport height - additional fallback */
    border-radius: 0;
    padding: 20px 5vw;
    /* Add safe area padding for iOS devices */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(5vw, env(safe-area-inset-left));
    padding-right: max(5vw, env(safe-area-inset-right));
    /* Position fixes */
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    /* Ensure content scrolls properly on mobile */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Make body take remaining space when footer is hidden */
  .biel-search-body {
    flex: 1;
    min-height: 0;
  }

  /* Ensure footer doesn't consume flexible height on mobile */
  .biel-search-footer {
    flex: 0 0 auto;
  }
}

.biel-search-body.results {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.biel-search-footer {
  display: flex;
  justify-content: space-between;
  flex: 0 0 auto;
  font-size: 14px;
}

.biel-search-footer__powered-by {
  display: flex;
  align-items: center;
  font-size: 14px;
}

/* Mobile tweak: align powered-by at the bottom */
@media screen and (max-width: 768px) {
  .biel-search-footer__powered-by {
    align-items: flex-end;
  }
}

.biel-search-footer__powered-by a {
  color: var(--biel-header-powered-by-link-color);
  font-weight: 500;
  text-decoration: none;
}

.biel-search-footer__quick-icons-container {
  display: none;
}

.biel-search-footer__quick-icon {
  display: flex;
  align-items: center;
}

.biel-search-footer__quick-icon-command-key {
  display: flex;
  align-items: center;
  border: 1px solid var(--biel-search-footer-command-key-border-color);
  border-radius: 4px;
  margin-left: 4px;
  padding: 2px;
  line-height: 1;
}

@media screen and (min-width: 768px) {

  .biel-search-content {
    max-width: var(--biel-search-content-max-width);
    max-height: var(--biel-search-content-max-height);
  }

  .right {
    bottom: var(--biel-search-content-position-bottom);
    left: initial;
    right: var(--biel-search-content-position-right);
    top: initial;
    transform: initial;
  }

  .biel-search-content.biel-search-content--bottom-left {
    bottom: var(--biel-search-content-position-bottom);
    left: var(--biel-search-content-position-left);
    top: initial;
    transform: initial;
  }

  .biel-search-content.biel-search-content--top-right {
    right: var(--biel-search-content-position-right);
    left: initial;
    top: var(--biel-search-content-position-top);
    transform: initial;
  }

  .biel-search-content.biel-search-content--top-left {
    left: var(--biel-search-content-position-left);
    top: var(--biel-search-content-position-top);
    transform: initial;
  }

  .biel-search-content.biel-search-content--center-left {
    left: 5px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
  }

  .biel-search-content.biel-search-content--center-right {
    left: auto;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
  }

  .biel-search-content.biel-search-content--top-center {
    left: 50%;
    right: auto;
    top: var(--biel-search-content-position-top-center);
    transform: translateX(-50%);
  }

  .biel-search-footer__quick-icons-container {
    display: flex;
    gap: 12px;
  }
}

/* Fullscreen mode - uses triple class specificity to override position variants */
.biel-search-content.biel-search-content.fullscreen {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100svh;
  max-height: 100dvh;
  border-radius: 0;
  padding: 20px 5vw;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(5vw, env(safe-area-inset-left));
  padding-right: max(5vw, env(safe-area-inset-right));
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transform: none;
  transition: all 0.3s ease-in-out;
}

.biel-search-content.fullscreen .biel-search-header {
  flex: 0 0 auto;
}

.biel-search-content.fullscreen .biel-search-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  --biel-search-body-max-height: none;
}

.biel-search-content.fullscreen .biel-search-footer {
  flex: 0 0 auto;
}

@media screen and (min-width: 768px) {
  .biel-search-content.biel-search-content.fullscreen {
    padding: 20px 25vw;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}