/* ============= MOBILE NAVIGATION - RIGHT ALIGNED SEARCH (Corrected) ============= */

/* Mobile navigation container adjustments */
.mobile-nav-container {
  transition: all 0.3s ease;
}

.mobile-nav-container.search-expanded {
  padding-bottom: 1rem;
}

/* Mobile navigation buttons - flexbox layout for right alignment */
.mobile-nav-buttons {
  margin-bottom: 0;
  transition: margin-bottom 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 100%;
  min-height: 2.875rem; /* Match nav height */
}

.mobile-nav-container.search-expanded .mobile-nav-buttons {
  margin-bottom: 1rem;
}

/* Mobile nav buttons - full height styling */
.mobile-nav-search,
.mobile-nav-menu {
  display: flex;
  align-items: stretch;
  margin: 0;
}

.mobile-nav-search button,
.mobile-nav-menu button {
  height: 100%;
  min-height: 2.875rem;
  padding: 0 1rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border-radius: 0;
  background: var(--nav-bg-color);
  color: var(--nav-color);
}

/* Menu button - stays on left */
.mobile-nav-menu {
  order: 1;
}

/* Search button - moves to right */
.mobile-nav-search {
  order: 2;
  margin-left: auto;
}

/* Search button active state */
.mobile-nav-search.search-active button {
  background: var(--primary-color);
  color: var(--primary-color-text);
}

.mobile-nav-search.search-active button:hover,
.mobile-nav-search.search-active button:focus {
  background: var(--primary-color-hover);
  color: var(--primary-color-text);
}

/* Menu button hover states */
.mobile-nav-menu button:hover,
.mobile-nav-menu button:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-color);
}

/* Search button hover states (when not active) */
.mobile-nav-search:not(.search-active) button:hover,
.mobile-nav-search:not(.search-active) button:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-color);
}

/* Hide menu button when search is active */
.mobile-nav-menu.search-hidden {
  display: none;
}

/* Mobile inline search container */
.mobile-inline-search {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.mobile-inline-search.show {
  max-height: 200px; /* Adjust based on your search form height */
  opacity: 1;
  padding: 1rem;
}

/* Mobile search form styling */
.mobile-inline-search .nav-search-mobile-wrapper {
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: var(--white);
}

.mobile-inline-search .site-search-input {
  border: none;
  box-shadow: none;
  background: var(--white);
  color: var(--black);
  font-size: 1rem;
  padding: 0.875rem 1rem;
  min-height: auto;
}

/*
  START: NEWLY ADDED STYLES
*/
.mobile-inline-search .nav-search-mobile-wrapper .k-input {
  padding: 0;
}
/*
  END: NEWLY ADDED STYLES
*/

.mobile-inline-search .site-search-input::placeholder {
  color: var(--gray-text);
  font-size: 0.9rem;
}

.mobile-inline-search .input-group-button button {
  background: var(--primary-color);
  color: var(--primary-color-text);
  border: none;
  padding: 0.875rem 1rem;
  font-size: 1.1rem;
  transition: background-color 0.2s ease;
}

.mobile-inline-search .input-group-button button:hover,
.mobile-inline-search .input-group-button button:focus {
  background: var(--primary-color-hover);
  color: var(--primary-color-text);
}

/* Navigation section adjustments */
nav#main-nav {
  background: var(--nav-bg-color);
  color: var(--nav-color);
  /*margin-bottom: 2rem;*/
  transition: min-height 0.3s ease;
}

nav#main-nav.search-expanded {
  min-height: auto;
}

/* Mobile autocomplete dropdown styling */
.mobile-inline-search .k-animation-container {
  z-index: 1000;
}

.mobile-inline-search .k-list-container {
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  background: var(--white);
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.mobile-inline-search .k-list-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.9rem;
  transition: background-color 0.15s ease;
}

.mobile-inline-search .k-list-item:last-child {
  border-bottom: none;
}

.mobile-inline-search .k-list-item:hover,
.mobile-inline-search .k-list-item.k-state-focused {
  background: var(--x-light-gray);
  color: var(--black);
}

.mobile-inline-search .k-list-item.k-state-selected {
  background: var(--primary-color);
  color: var(--primary-color-text);
}

/* Mobile search result item styling */
.mobile-inline-search .site-search-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 0.85rem;
}

.mobile-inline-search .site-search-opt img {
  height: 32px;
  max-width: 50px;
  object-fit: contain;
  flex-shrink: 0;
}

.mobile-inline-search .site-search-opt span {
  flex: 1;
  word-break: break-word;
  line-height: 1.3;
}

/* Touch-friendly button sizing for mobile */
@media screen and (max-width: 39.99875em) {
  .mobile-nav-search button,
  .mobile-nav-menu button {
    min-height: 44px;
    padding: 0 1rem;
  }
  
  .mobile-inline-search .input-group-button button {
    min-height: 44px;
    min-width: 44px;
  }
  
  .mobile-inline-search .site-search-input {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Ensure search is hidden for medium+ screens */
@media screen and (min-width: 40.0625em) {
  .mobile-inline-search {
    display: none !important;
  }
  
  .mobile-nav-container {
    display: none !important;
  }
}

/* Animation refinements */
@media (prefers-reduced-motion: reduce) {
  .mobile-nav-container,
  .mobile-nav-buttons,
  .mobile-inline-search,
  .mobile-nav-search button,
  .mobile-nav-menu button,
  nav#main-nav {
    transition: none;
  }
}

/* Focus states for accessibility */
.mobile-nav-search button:focus,
.mobile-nav-menu button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.mobile-inline-search .site-search-input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

/* Close button for search - Red with white text on all states */
/*.nav-search-toggle*/

.mobile-nav-container.search-expanded .nav-search-toggle:hover,
.mobile-nav-container.search-expanded .nav-search-toggle:active,
.mobile-nav-container.search-expanded .nav-search-toggle:focus {
  background: var(--button-bg-color); 
  color: white;
  border: none;
  outline: none;
}
mobile-nav-container.search-expanded #acSiteSearchMobile-container{
  margin-left:0;
  margin-right:0;
}
/*
  END: NEWLY ADDED STYLES
*/

/* Visual feedback during expansion */
.mobile-nav-container.search-expanding .mobile-inline-search {
  border-top: 1px solid var(--light-gray);
  margin-top: 0.5rem;
}

.mobile-nav-container.search-expanded .mobile-inline-search {
  border-top: 1px solid var(--light-gray);
  margin-top: 0.5rem;
}
.nav-search-mobile-wrapper #acSiteSearchMobile:focus{
  border:none;
  outline:none;
}
#mobile-inline-search{
  border:none;
}
.mobile-inline-search .nav-search-mobile-wrapper {
  position: relative;
}

.mobile-inline-search .k-animation-container {
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box;
}

.mobile-inline-search .k-list-container {
  width: 100% !important;
  box-sizing: border-box;
}

.mobile-inline-search .k-list-item-text {
  width: auto !important;
}


/* ============= KENDO MOBILE POPUP WIDTH AND TEXT WRAPPING FIX ============= */

/* 1. Establish a positioning context for the popup. */
.mobile-inline-search .nav-search-mobile-wrapper {
  position: relative;
  /* Ensure this wrapper takes up available width */
  width: 100%;
}

/* 2. Force the popup container to match the wrapper's width and position it correctly. */
.mobile-inline-search .k-animation-container {
  /* Ensure it's absolutely positioned relative to .nav-search-mobile-wrapper */
  position: absolute !important;
  width: 100% !important; /* Forces it to be 100% of the parent's width */
  left: 0 !important;      /* Aligns to the left edge of the parent */
  right: 0 !important;     /* Aligns to the right edge of the parent */
  box-sizing: border-box;  /* Includes padding and border in the 100% width */
  /* Margin-top might be needed if it attaches directly below the input field,
     adjust as necessary to prevent overlap with the input's border. */
  margin-top: 2px !important; /* Adjust if it's too close/far from the input */
}

/* 3. Ensure the list inside the container also respects the new width. */
.mobile-inline-search .k-list-container {
  width: 100% !important;
  box-sizing: border-box;
}

/* 4. Ensure individual list items and their text elements behave correctly within the new width. */
.mobile-inline-search .k-list-item {
  width: 100% !important; /* Make sure each item takes full width */
  box-sizing: border-box;
  display: flex; /* Use flexbox to control item content more easily */
  align-items: center; /* Vertically center image and text */
}

.mobile-inline-search .k-list-item-text {
  /* This is the crucial override for text wrapping.
     The `width: auto` with flex-grow: 1 will make it take available space.
     The `!important` is often necessary for Kendo's inline styles. */
  width: auto !important;
  flex-grow: 1; /* Allows text to take up remaining space after image */
  white-space: normal !important; /* Crucial for allowing text to wrap */
  word-break: break-word; /* Ensures long words break and don't overflow */
  padding-left: 10px; /* Add some spacing if needed between image and text */
}

/* If the image within the list item has issues, ensure it shrinks/fits */
.mobile-inline-search .site-search-opt img {
  flex-shrink: 0; /* Prevent image from shrinking too much if text is long */
  max-width: 50px; /* Keep consistent with your existing styling */
  height: 32px;
  object-fit: contain;
}

/* The parent of site-search-opt might need flex for alignment */
.mobile-inline-search .site-search-opt {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between image and text */
    width: 100%; /* Ensure it spans the full width of the list item */
}

#acSiteSearchMobile-list .k-list-item-text {
  display: flex;
  line-height: 1;
  width: 300px;
}
#acSiteSearchMobile-list .site-search-opt span {
    /* flex: 1; */
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    font-size: 0.875rem;
}