/* Search Modal Styles - Optimized UI */
#search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#search-overlay.active {
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: searchFadeIn 0.15s ease-out;
}

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

@keyframes searchSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#search-overlay .search-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 12px;
  width: 90%;
  max-width: 750px;
  max-height: 75vh;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 165, 0, 0.1),
    0 0 40px rgba(255, 165, 0, 0.05);
  animation: searchSlideDown 0.2s ease-out;
}

#search-overlay .search-header {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 165, 0, 0.15);
  background: rgba(255, 165, 0, 0.02);
}

#search-overlay .search-icon {
  margin-right: 1rem;
  color: #f59e0b;
  flex-shrink: 0;
  opacity: 0.9;
}

#search-overlay .search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 1.15rem;
  outline: none;
  font-family: inherit;
  font-weight: 400;
  letter-spacing: 0.01em;
}

#search-overlay .search-input::placeholder {
  color: #f59e0b;
  opacity: 0.5;
}

#search-overlay .search-shortcut {
  font-size: 0.7rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 165, 0, 0.15);
  color: #f59e0b;
  border-radius: 6px;
  margin-left: 0.75rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 165, 0, 0.2);
  font-family: inherit;
  letter-spacing: 0.05em;
}

#search-overlay .search-results {
  max-height: calc(75vh - 70px);
  overflow-y: auto;
  padding: 0.75rem;
}

#search-overlay .search-result-item {
  padding: 1.15rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  text-decoration: none;
  display: block;
}

#search-overlay .search-result-item:hover,
#search-overlay .search-result-item.selected {
  background: rgba(255, 165, 0, 0.08);
  border-color: rgba(255, 165, 0, 0.2);
  transform: translateX(2px);
}

#search-overlay .search-result-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 0.35rem;
  line-height: 1.4;
  display: inline;
}

#search-overlay .search-result-date {
  font-size: 0.7rem;
  color: #f59e0b;
  opacity: 0.6;
  margin-left: 0.75rem;
  font-weight: 400;
}

#search-overlay .search-result-content {
  font-size: 0.875rem;
  color: #f1f5f9;
  opacity: 0.75;
  line-height: 1.6;
  margin-top: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#search-overlay .search-result-tags {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

#search-overlay .search-tag {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 165, 0, 0.12);
  color: #f59e0b;
  border-radius: 4px;
  border: 1px solid rgba(255, 165, 0, 0.15);
  font-weight: 500;
  letter-spacing: 0.02em;
}

#search-overlay .search-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: #f59e0b;
  opacity: 0.6;
  font-size: 0.95rem;
}

#search-overlay .search-loading {
  padding: 3rem 2rem;
  text-align: center;
  color: #f59e0b;
  opacity: 0.8;
  font-size: 0.95rem;
}

/* Search trigger button in header - Optimized */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  background: rgba(255, 165, 0, 0.05);
  border: 1px solid rgba(255, 165, 0, 0.25);
  color: #f59e0b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  margin-left: 1rem;
}

.search-trigger:hover {
  background: rgba(255, 165, 0, 0.12);
  border-color: rgba(255, 165, 0, 0.4);
  box-shadow: 0 0 15px rgba(255, 165, 0, 0.15);
}

.search-trigger kbd {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  background: rgba(255, 165, 0, 0.15);
  color: #f59e0b;
  border-radius: 4px;
  border: 1px solid rgba(255, 165, 0, 0.25);
  font-family: inherit;
  letter-spacing: 0.05em;
}

/* Scrollbar styling - Optimized */
#search-overlay .search-results::-webkit-scrollbar {
  width: 8px;
}

#search-overlay .search-results::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.5rem 0;
}

#search-overlay .search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 165, 0, 0.3);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#search-overlay .search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 165, 0, 0.5);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Mobile responsive styles */
@media (max-width: 684px) {
  .search-trigger {
    padding: 0.4rem 0.6rem;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    gap: 0.4rem;
    border-width: 1.5px;
  }

  .search-trigger kbd {
    display: none;
  }

  .search-trigger svg {
    width: 16px;
    height: 16px;
  }

  #search-overlay.active {
    padding-top: 5vh;
    align-items: stretch;
  }

  #search-overlay .search-modal {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  #search-overlay .search-header {
    padding: 1rem 1.25rem;
  }

  #search-overlay .search-input {
    font-size: 1rem;
  }

  #search-overlay .search-shortcut {
    display: none;
  }

  #search-overlay .search-results {
    max-height: calc(95vh - 65px);
    padding: 0.5rem;
  }

  #search-overlay .search-result-item {
    padding: 1rem;
    margin-bottom: 0.4rem;
  }

  #search-overlay .search-result-item:hover,
  #search-overlay .search-result-item.selected {
    transform: none;
  }

  #search-overlay .search-result-title {
    font-size: 0.95rem;
  }

  #search-overlay .search-result-date {
    font-size: 0.65rem;
  }

  #search-overlay .search-result-content {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
  }

  #search-overlay .search-tag {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .search-trigger {
    padding: 0.35rem 0.5rem;
    margin-left: 0.3rem;
    border-width: 1px;
  }

  .search-trigger svg {
    width: 15px;
    height: 15px;
  }

  #search-overlay .search-header {
    padding: 0.9rem 1rem;
  }

  #search-overlay .search-results {
    padding: 0.4rem;
  }

  #search-overlay .search-result-item {
    padding: 0.9rem;
  }
}
