/* CUSTOM SEARCH WITH GOOGLE */

body.search-results #content {
  background-color: #1e1e1e !important; /* Match search results background */
}
body.search-results #content {
  box-shadow: none !important;
}
/* Container for the search form */
#custom-search-form {
  display: flex;
  align-items: center;
  width: 98%; /* Ensure it fits within the container */
  box-sizing: border-box; /* Include padding and border in the element's total width and height */
  background-color: #1212121f; /* Dark background matching the theme */
  border-radius: 6px; /* Rounded corners */
  margin-bottom: 20px; /* Space below the search form */
  margin-top: 20px; /* Add space at the top of the search form */
  gap: 10px; /* Add space between input and button */
  position: relative;
}

/* Input field styling */
#custom-search-form input[type="text"] {
  background-color: #1e1e1e;
  color: #e0e0e0;
  border: none;
  padding: 12px 15px;
  border-radius: 6px;
  font-size: 1.1em;
  flex: 1;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  position: relative; /* Ensure the hints position is relative to the input */
}

body.search-results #custom-search-form input[type="text"] {
  border: 1px solid #333;
}

/* Button styling */
#custom-search-form button {
  background-color: #333; /* Dark background */
  color: #e0e0e0; /* Light text color */
  border: 1px solid #444; /* Darker border */
  padding: 12px 20px; /* Adjust padding */
  border-radius: 6px; /* Rounded corners */
  font-size: 1.1em; /* Increase button text size for balance */
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease; /* Smooth hover effects */
  flex-shrink: 0; /* Prevent button from shrinking */
}

/* Hover effect for the button */
#custom-search-form button:hover {
  background-color: #555; /* Lighter background on hover */
  color: #ffffff; /* Lighter text on hover */
}

#search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #999; /* Light grey icon */
}

/* Styling unvisited link titles in search results */
.gs-webResult.gs-result a.gs-title:link,
.gs-webResult.gs-result a.gs-title:link b,
.gs-imageResult a.gs-title:link,
.gs-imageResult a.gs-title:link b {
  color: #5387e1 !important; /* Custom link color */
  font-size: 20px !important; /* Increase font size */
  font-weight: bold !important; /* Bold links */
  text-decoration: none !important; /* Remove underlines */
}

/* Hover effect for unvisited link titles */
.gs-webResult.gs-result a.gs-title:link:hover,
.gs-imageResult a.gs-title:link:hover {
  color: #5387e1 !important; /* Lighter blue on hover */
}

/* Styling visited link titles in search results */
.gs-webResult.gs-result a.gs-title:visited,
.gs-webResult.gs-result a.gs-title:visited b,
.gs-imageResult a.gs-title:visited,
.gs-imageResult a.gs-title:visited b {
  color: #5387e1 !important; /* Custom color for visited links */
  font-size: 20px !important; /* Increase font size */
  font-weight: bold !important; /* Bold visited links */
}

/* Hover effect for visited link titles */
.gs-webResult.gs-result a.gs-title:visited:hover,
.gs-imageResult a.gs-title:visited:hover {
  color: #56a1f7 !important; /* Lighter blue on hover for visited links */
  text-decoration: underline !important; /* Add underline on hover */
}

/* Style for spelling corrections and search result titles */
.gsc-control-cse .gs-spelling,
.gsc-control-cse .gs-result .gs-title,
.gsc-control-cse .gs-result .gs-title * {
  font-size: 20px !important; /* Bigger font size */
  color: #ffffff !important; /* White text to fit dark theme */
}

.gsc-control-cse {
  border-color: #1e1e1e !important;
  background-color: #1e1e1e !important;
}

/* Style for links inside search result titles */
.gs-result .gs-title *,
.gsc-cursor-page,
.gs-spelling a {
  color: #7baaf7 !important; /* Link color */
  font-size: 20px !important; /* Increase font size */
  font-weight: normal !important; /* Ensure consistent weight */
}

/* Style for search result title text */
.gs-result .gs-title,
.gs-result .gs-title * {
  color: #ffffff !important; /* White text for readability on dark background */
  text-decoration: none !important; /* No underline for a clean look */
}

/* Enlarge the images and ensure aspect ratio */
.gs-web-image-box .gs-image,
.gs-promotion-image-box .gs-promotion-image {
  border: 1px solid #e2e2e2 !important;
  max-width: 150px !important;
  max-height: 300px !important;
  width: auto !important;
  height: auto !important;
  object-fit: cover !important;
}

/* Ensure the text doesn't overlap the image */
.gs-webResult:not(.gs-no-results-result):not(.gs-error-result) .gs-snippet,
.gs-fileFormatType {
  color: #5f6a73 !important;
  margin-left: 170px !important; /* Ensure text starts after the image */
  display: block !important; /* Ensure proper text wrapping */
}

/* Ensure the container adjusts correctly */
.gs-webResult {
  display: flex !important;
  align-items: flex-start !important; /* Align image and text at the top */
  flex-wrap: wrap !important;
}

.gsc-webResult.gsc-result,
.gsc-results .gsc-imageResult {
  border-color: #262525 !important;
  background-color: #1e1e1e !important;
}

/* Override Google Custom Search results background color */
.gsc-results {
  background-color: #1e1e1e !important; /* Dark background */
  color: #e0e0e0 !important; /* Light text color */
  padding: 0px; /* Add padding for better spacing */
}

.gsc-above-wrapper-area {
  border-bottom: 1px solid #242323 !important;
  padding: 5px 0 5px 0 !important;
}

/* Style for the results count text (e.g., "About 50 results") */
.gsc-result-info {
  color: #9d9d9d !important;
}

table {
  border-spacing: 2px !important;
  border-color: rgb(34, 33, 33) !important;
}

td,
th {
  padding: 0;
  border: 1px solid #282727;
  padding: 3px;
}

/* Override Google Custom Search button styles */
.gsc-search-button {
  background-color: #333 !important; /* Dark button background */
  color: #e0e0e0 !important; /* Light button text */
  border: 1px solid #444 !important; /* Darker border color */
  padding: 10px 15px; /* Adjust padding */
  border-radius: 4px; /* Rounded corners */
  font-size: 1em; /* Adjust font size */
}

.gsc-search-button:hover {
  background-color: #555 !important; /* Slightly lighter on hover */
  color: #ffffff !important; /* Light text color on hover */
}

.gsc-selected-option-container {
  background-color: rgba(38, 38, 38, 0.253) !important;
  background-image: linear-gradient(top, whiteSmoke, #f1f1f1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  color: #444;
}

/* Style pagination controls */
.gsc-cursor-box {
  text-align: center; /* Center pagination controls */
  padding: 10px; /* Add padding */
}

.gsc-cursor-box .gsc-cursor-page {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1em; /* Adjust font size */
  color: #2f67c1 !important; /* Color for page numbers */
  background-color: transparent !important; /* No background color */
  padding: 5px 10px; /* Add padding around numbers */
  border-radius: 4px; /* Rounded corners */
  margin: 0 5px; /* Space between page numbers */
  transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transitions */
}

.gsc-cursor-box .gsc-cursor-page:hover {
  background-color: #333 !important; /* Dark background on hover */
  color: #ffffff !important; /* Light text color on hover */
}

/* Highlight the current page */
.gsc-cursor-box .gsc-cursor-current {
  background-color: #2f67c1 !important; /* Highlight color for current page */
  color: #ffffff !important; /* Light text color for current page */
  font-weight: bold; /* Bold text for emphasis */
}

/* Style for the current page in Google Custom Search */
.gsc-results .gsc-cursor-box .gsc-cursor-current-page {
  font-weight: bold !important; /* Make the text bold */
  color: #ff5722 !important; /* Change the text color to a distinctive color */
  background-color: #333 !important; /* Add a background color to highlight the current page */
  border-radius: 4px; /* Optional: Add rounded corners */
  padding: 3px 6px; /* Optional: Add some padding around the text */
}

/* Styling the search results header */
#search-header {
  font-size: 1.8em; /* Larger font size */
  font-weight: bold; /* Bold text */
  color: #e0e0e0; /* Light gray color for better contrast on dark background */
  margin-bottom: 0px!; /* Add some space below the header */
  text-align: left; /* Align the text to the left */
  padding: 1px; /* Add some padding for breathing room */
  border-bottom: 2px solid #ff5722; /* Add a subtle border for separation */
}

/* Style for the search query in the header */
#search-header span {
  color: #ff5722; /* Highlight the search query with a different color */
  font-style: italic; /* Optional: Add emphasis to the search query */
}

/* CUSTOM SEARCH FORM SPECIFIC STYLING */
.custom-search-form-shortcode {
  background-color: #25242471 !important;
  width: 97.5% !important;
  margin: 0 auto 15px;
}

.custom-search-form-shortcode #clear-button {
  right: 16px;
}

@media (max-width: 768px) {
  /* Mobile-specific styles for the search form */
  #custom-search-form {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    align-items: stretch; /* Full width */
    width: 100%; /* Ensure it uses the full width */
    margin: 0; /* No extra margin */
    padding: 0; /* Remove padding */
    background-color: #1212121f; /* Same dark background */
  }

  /* Wrapper for input and buttons */
  .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%; /* Full width wrapper */
    padding: 0; /* No extra padding */
    border-radius: 6px; /* Rounded edges */
  }

  /* Search input field */
  #search-input {
    flex: 1; /* Take up all remaining space */
    padding: 12px 40px; /* Space for icons */
    font-size: 16px; /* Larger font size for readability */
    color: #fff;
    border: none; /* Remove border */
    outline: none; /* No outline */
    background-color: transparent;
    box-sizing: border-box; /* Prevent overflow issues */
  }

  #search-icon-index {
    position: absolute;
    right: 345px; /* Ensure it's positioned on the left */
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Vertically center the icon */
    z-index: 10; /* Ensure it's above other elements */
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
  }

  @media screen and (max-width: 600px) {
    #enter-hint {
      display: none !important;
    }

    /* Optionally reset search input padding */
    #page-search-input {
      padding-right: 0 !important;
    }
  }

  /* Clear button styling */
  #clear-button {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--macos-text-muted, #a0a0a0);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
  }

  #clear-button:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--macos-text-light, #e0e0e0);
  }
}

@media (max-width: 768px) {
  /* Improve search result snippet styling for mobile */
  .gs-webResult:not(.gs-no-results-result):not(.gs-error-result) .gs-snippet,
  .gs-fileFormatType {
    color: #5f6a73 !important;
    margin-left: 0 !important; /* Remove fixed left margin */
    display: block !important;
    width: 100%; /* Full width */
    padding: 0 10px; /* Add some horizontal padding */
    box-sizing: border-box; /* Ensure padding doesn't expand width */
    word-wrap: break-word; /* Allow long words to break */
    overflow-wrap: break-word; /* Modern alternative for word-wrap */
  }

  /* Ensure images don't interfere with text on mobile */
  .gs-web-image-box .gs-image,
  .gs-promotion-image-box .gs-promotion-image {
    float: left; /* Float image to the left */
    margin-right: 10px; /* Add space between image and text */
    margin-bottom: 10px; /* Space below image if needed */
    max-width: 100px !important; /* Smaller image on mobile */
    max-height: 100px !important;
  }

  /* Adjust WebResult layout for mobile */
  .gs-webResult {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    padding: 10px !important;
  }
}

/* Container for the search hints */
#search-hints {
  position: absolute;
  z-index: 1000;
  background-color: #1e1e1e;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
  transition: border 0.3s ease; /* Optional: smooth transition for the border */
}

/* When hints are shrgb(149, 149, 149)ply the border */
#search-hints.show-hints {
  border: 1px solid #939191; /* Add a white border when hints are shown */
  border-radius: 6px; /* Keep the same border radius */
}
/* Individual hint items */
.search-hint {
  font-family: "Google Sans", sans-serif;
  display: flex; /* To align icon and text horizontally */
  align-items: center;
  padding: 10px !important;
  cursor: pointer;
  color: #fff; /* Light text color for visibility */
  background: rgb(30, 30, 30); /* Match the background color */
}

/* Search icon inside hints */
.search-hint svg {
  margin-right: 10px; /* Space between icon and text */
  width: 18px;
  height: 18px;
  fill: #ccc; /* Color for the icon */
}

/* Hover effect for hints */
.search-hint:hover {
  background-color: #395f91; /* Slightly lighter background on hover */
}

/* Container for the search input and icon */
.search-input-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  border: 1px solid var(--macos-accent-border, rgba(100, 100, 100, 0.3));
  border-radius: 8px;
  padding: 0 16px;
  transition: border-color 0.3s ease;
  background-color: #1e1e1e;
}
.search-input-wrapper:focus-within {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Desktop-specific styles for the clear button in the custom search form */
.custom-search-form-shortcode .search-input-wrapper #clear-button {
  position: absolute;
  top: 50%;
  right: 8px; /* Position closer to the edge for a better look */
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--macos-text-muted, #a0a0a0);
  cursor: pointer;
  font-size: 22px; /* Slightly larger 'X' */
  width: 47px; /* Increased width for a larger target */
  height: 47px; /* Increased height for a larger target */
  line-height: 47px; /* Vertically center the 'X' */
  text-align: center; /* Horizontally center the 'X' */
  padding: 0; /* Remove padding, sizing is now controlled by width/height */
  border-radius: 50%; /* This will now create a perfect circle */
  transition: all 0.2s ease;
  opacity: 0.7;
  display: none; /* Initially hidden, controlled by JS */
}

.custom-search-form-shortcode .search-input-wrapper #clear-button:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--macos-text-light, #e0e0e0);
}

#search-icon-index {
  cursor: pointer;
  margin-right: 12px;
  width: 24px;
  height: 24px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 0.7;
  stroke: var(--macos-text-muted, #a0a0a0);
  flex-shrink: 0; /* Prevent icon from shrinking */
}

#search-icon-index:hover {
  transform: scale(1.1);
  opacity: 1;
  stroke: var(--macos-text-light, #e0e0e0);
}
#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--macos-text-light, #e0e0e0);
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* Also adding the .widget_search styles */
.widget_search {
  background-color: #2b2b2b;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-family: "Roboto", sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
  position: relative;
}

.widget_search:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.widget_search .wp-block-search__label {
  color: #f5f5f7;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: none;
}

.widget_search .wp-block-search__input {
  flex-grow: 1; /* Ensures input takes up remaining space */
  padding: 12px;
  border-radius: 8px;
  border: none;
  background-color: #3a3a3a;
  color: #f5f5f7;
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.widget_search .wp-block-search__input::placeholder {
  color: #9b9b9b;
}

.widget_search .wp-block-search__input:focus {
  background-color: #4a4a4a;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.widget_search .wp-block-search__button {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background-color: rgba(118, 144, 173, 0.28);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.widget_search .wp-block-search__button:hover {
  background-color: #005bb5;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.widget_search .wp-block-search__button:active {
  transform: translateY(2px);
  box-shadow: none;
}

.widget_search form {
  display: flex;
  flex-direction: row; /* Align input and button side by side */
  align-items: center;
  gap: 8px; /* Space between input and button */
}

.widget_search .wp-block-search__inside-wrapper {
  display: flex;
  width: 100%;
}
.widget_search .wp-block-search__label {
  display: none;
}
/* Modify the subtle loading bar animation to match macOS feel */
@keyframes loading {
  0% {
    width: 0;
  }
  50% {
    width: 50%;
  }
  100% {
    width: 100%;
    opacity: 0;
  }
}

.widget_search::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: #007aff;
  animation: loading 3s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.widget_search:hover::after {
  opacity: 1;
}
