/* Family IT Guy Header Search CSS */

/* Search Icon in Header */
.header-search-icon {
  margin-right: 15px;
}

.header-search-icon a {
  color: #fff;
  display: flex;
  align-items: center;
}

.header-search-icon .material-icons {
  font-size: 24px;
}

/* Search Modal */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(29, 37, 45, 0.9); /* Cool Slate with opacity */
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.search-modal.active {
  display: flex;
}

.search-modal-content {
  background-color: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  overflow-x: hidden;
  word-wrap: break-word;
}

.search-modal-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 15px;
}

#close-search-modal {
  background: none;
  border: none;
  cursor: pointer;
  color: #777;
}

#close-search-modal:hover {
  color: #EE2737; /* Warm Red on hover */
}

/* Search Box Styling */
.header-search .ais-SearchBox-form,
#homepage-search .ais-SearchBox-form {
  display: flex;
  background: #f5f7fa;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dde1e8;
}

.header-search .ais-SearchBox-input,
#homepage-search .ais-SearchBox-input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  color: #1D252D;
}

.header-search .ais-SearchBox-input:focus,
#homepage-search .ais-SearchBox-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(238, 39, 55, 0.2); /* Warm Red shadow for focus */
}

.header-search .ais-SearchBox-submit,
.header-search .ais-SearchBox-reset,
#homepage-search .ais-SearchBox-submit,
#homepage-search .ais-SearchBox-reset {
  background: none;
  border: none;
  padding: 0 12px;
  cursor: pointer;
  color: #777;
}

.header-search .ais-SearchBox-submit:hover,
#homepage-search .ais-SearchBox-submit:hover {
  color: #EE2737; /* Warm Red on hover */
}

.header-search .ais-SearchBox-reset:hover,
#homepage-search .ais-SearchBox-reset:hover {
  color: #1D252D; /* Cool Slate on hover */
}

/* Header Search Tags */
.search-modal .search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0 25px 0;
  justify-content: center;
  flex-direction: row; /* Ensure horizontal layout */
}

/* Search tags/suggestions */
.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.search-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}

.search-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Device Setup - Gray/Neutral (spans multiple pillars) */
.search-tag[data-tag="iPhone Setup"] {
  background-color: rgba(29, 37, 45, 0.08);
  color: #1D252D;
  border: 1px solid rgba(29, 37, 45, 0.15);
}

.search-tag[data-tag="iPhone Setup"]:hover {
  background-color: rgba(29, 37, 45, 0.12);
}

/* Block Harmful Content - Red */
.search-tag[data-tag="YouTube"] {
  background-color: rgba(238, 39, 55, 0.1);
  color: #EE2737;
  border: 1px solid rgba(238, 39, 55, 0.2);
}

.search-tag[data-tag="YouTube"]:hover {
  background-color: rgba(238, 39, 55, 0.15);
}

/* Limit Screen Time - Blue */
.search-tag[data-tag="Screen Time"] {
  background-color: rgba(184, 221, 225, 0.25);
  color: #1D252D;
  border: 1px solid rgba(184, 221, 225, 0.5);
}

.search-tag[data-tag="Screen Time"]:hover {
  background-color: rgba(184, 221, 225, 0.35);
}

/* Prevent Stranger Contact - Gold */
.search-tag[data-tag="Social Media"] {
  background-color: rgba(255, 191, 63, 0.15);
  color: #1D252D;
  border: 1px solid rgba(255, 191, 63, 0.3);
}

.search-tag[data-tag="Social Media"]:hover {
  background-color: rgba(255, 191, 63, 0.25);
}

/* Homepage Search */
.homepage-search-container {
  max-width: 700px;
  margin: 0 auto 30px;
}

#homepage-search .ais-SearchBox-form {
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#homepage-search .ais-SearchBox-input {
  padding: 16px 20px;
  font-size: 18px;
}

#homepage-search-results {
  margin-top: 20px;
}

/* Add more spacing between search box and results in the modal */
.header-search-results {
  margin-top: 30px;
}

/* Search Results */
.header-search-results .ais-Hits-list,
#homepage-search-results .ais-Hits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.header-search-results .ais-Hits-item,
#homepage-search-results .ais-Hits-item {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
  border: 1px solid #eaeaea;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  word-wrap: break-word;
}

.header-search-results .ais-Hits-item:hover,
#homepage-search-results .ais-Hits-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #ddd;
}

/* Card link overlay */
.search-result {
  position: relative;
}

.card-link-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: pointer;
}

/* Ensure the title link stays above the overlay */
.search-result-title a,
.search-result-badge {
  position: relative;
  z-index: 2;
}

/* Fade-in animation */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-result-title {
  font-family: 'IBM Plex Serif', serif;
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
}

.search-result-title a {
  color: #1D252D;
  text-decoration: none;
  flex-grow: 1;
  word-break: break-word;
}

.search-result-title a:hover {
  color: #EE2737; /* Warm Red */
}

/* Content type icons - rounded backgrounds */
.content-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px; /* Prevent icon shrinking on mobile */
  background-color: #f5f7fa;
  border-radius: 50%;
  margin-right: 10px;
  font-size: 16px;
}

/* Badges */
.search-result-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
  font-family: 'DM Sans', sans-serif;
}

.new-badge {
  background-color: #EE2737; /* Warm Red */
  color: white;
}

.search-result-description {
  padding: 6px 0 12px 42px;
  line-height: 1.5;
  font-size: 14px;
  color: #666;
  font-family: 'DM Sans', sans-serif;
  word-wrap: break-word;
}

.search-result-metadata {
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
  margin-left: 42px;
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: #777;
  font-family: 'DM Sans', sans-serif;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

/* Pillar tags - moved to metadata section */
.search-result-pillar {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  font-family: 'DM Sans', sans-serif;
}

/* Age groups */
.search-result-ages {
  font-size: 12px;
  color: #777;
}

.pillar-block-harmful-content {
  background-color: #EE2737; /* Warm Red */
}

.pillar-limit-screen-time {
  background-color: #B8DDE1; /* Pale Blue */
  color: #333;
}

.pillar-prevent-stranger-contact {
  background-color: #FFBF3F; /* IT Gold */
  color: #333;
}

/* Highlighted text */
.ais-Highlight-highlighted {
  background-color: rgba(238, 39, 55, 0.2); /* Warm Red with opacity */
  padding: 0 2px;
  border-radius: 2px;
  font-style: normal;
}

/* No results message */
.no-results {
  padding: 15px;
  background-color: #f5f7fa;
  border-radius: 8px;
  text-align: center;
}

.no-results p {
  margin: 5px 0;
}

.no-results a {
  color: #EE2737; /* Warm Red */
  text-decoration: none;
  font-weight: 500;
}

.no-results a:hover {
  text-decoration: underline;
}

/* Modal open state */
body.modal-open {
  overflow: hidden;
}

/* Loading indicator */
.ais-SearchBox-loadingIndicator svg {
  stroke: #EE2737; /* Warm Red */
}

.search-box-loading {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-in-progress .search-box-loading {
  opacity: 1;
}

/* Searching messages */
.searching-message {
  text-align: center;
  padding: 10px;
  color: #777;
  font-style: italic;
  font-size: 14px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Responsive styles */
@media (max-width: 768px) {
  .search-modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  #homepage-search .ais-SearchBox-input {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  .search-result-title {
    font-size: 15px;
  }
  
  .search-result-description {
    font-size: 13px;
    padding-left: 38px;
  }
  
  .search-result-metadata {
    margin-left: 38px;
  }
  
  .content-type-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
}

@media (max-width: 576px) {
  .search-modal-content {
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .header-search .ais-SearchBox-input,
  #homepage-search .ais-SearchBox-input {
    padding: 10px 14px;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .header-search-results .ais-Hits-item,
  #homepage-search-results .ais-Hits-item {
    padding: 12px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .search-result-title {
    font-size: 14px;
  }
  
  .search-result-description {
    font-size: 12px;
    line-height: 1.4;
    padding: 4px 0 10px 32px;
  }
  
  .search-result-metadata {
    margin-left: 32px;
    padding-top: 10px;
    gap: 10px;
    font-size: 11px;
    flex-wrap: wrap;
  }
  
  /* Handle long pillar names on small screens */
  .search-result-metadata .search-result-pillar {
    margin-bottom: 5px; /* Add space if it wraps to next line */
    max-width: 100%; /* Ensure pillar label can wrap properly */
  }
  
  .content-type-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    margin-right: 8px;
    font-size: 14px;
  }
  
  .search-result-badge {
    padding: 2px 6px;
    font-size: 9px;
  }
  
  .search-result-pillar {
    padding: 2px 6px;
    font-size: 10px;
    white-space: normal; /* Allow text to wrap */
    word-break: normal; /* Use normal word breaking rules */
  }
}

/* Extra small devices (iPhone SE, etc) */
@media (max-width: 375px) {
  .search-modal-content {
    padding: 10px;
  }
  
  .header-search-results .ais-Hits-item,
  #homepage-search-results .ais-Hits-item {
    padding: 10px;
  }
  
  .search-result-description {
    padding-left: 30px;
  }
  
  .search-result-metadata {
    margin-left: 30px;
  }
}