/* Mobile-specific overrides for better usability */

/* Ensure minimum touch target size (44x44px) for mobile */
@media (max-width: 768px) {
  /* Header adjustments */
  header button,
  header a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Fix menu button visibility and spacing */
  #navbar-menu-toggle {
    z-index: 50;
    position: relative;
  }

  /* Ensure dropdown menu is properly positioned */
  #navbar-menu {
    top: 60px; /* Adjust based on header height */
    z-index: 100;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  /* Better spacing for menu items on mobile */
  #navbar-menu ul li a {
    padding: 12px 16px;
    display: block;
    width: 100%;
  }

  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden;
  }

  /* Darkmode toggle - keep original size */
  /* Removed scale transform that was distorting the toggle */

  /* Ensure search page input is usable on mobile */
  #search-input {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
  }

  /* Better spacing for mobile header */
  header > div:first-child {
    gap: 0.25rem;
  }

  /* Hide accessibility text on very small screens */
  @media (max-width: 380px) {
    #accessibility-toggle svg {
      width: 1.25rem;
      height: 1.25rem;
    }
  }
}

/* Ensure proper focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

/* Prevent iOS zoom on form inputs */
input[type="text"],
input[type="search"],
textarea,
select {
  font-size: 16px;
}

/* Fix menu dropdown positioning */
@media (max-width: 768px) {
  nav > div#navbar-menu {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }
}

/* Mobile Search Overlay Styles */
#mobile-search-overlay {
  backdrop-filter: blur(4px);
}

#mobile-search-input {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Ensure search button in overlay is touch-friendly */
#mobile-search-overlay button[type="submit"] {
  min-width: 80px;
  min-height: 36px;
}

/* Animation for overlay appearance */
#mobile-search-overlay:not(.hidden) {
  animation: fadeIn 0.2s ease-in;
}

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

/* Ensure proper z-index layering */
#mobile-search-overlay {
  z-index: 9999;
}