/* Search Modal Styles */

/* Search Button */
.search-button {
  display: inline-flex;
  align-items: center;
  background-color: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 15px;
  padding: 8px 15px;
  margin-left: 15px;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-button:hover {
  background-color: #f0f0f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-button i {
  margin-right: 6px;
}

html.dark .search-button {
  background-color: #3b3d42;
  border-color: #4a4c51;
  color: #a9a9b3;
}

html.dark .search-button:hover {
  background-color: #4a4c51;
}

.post-footer-breadcrumb {
  display: flex;
  align-items: center;
}

@media (max-width: 480px) {
  .search-button span {
    display: none;
  }
  
  .search-button {
    padding: 8px 10px;
  }
  
  .search-button i {
    margin-right: 0;
  }
}

/* Body class when modal is open */
body.search-modal-open {
  overflow: hidden;
}

/* Modal container */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5vh;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-modal[aria-hidden="false"] {
  opacity: 1;
}

/* When modal is shown with display: flex */
.search-modal[style*="flex"] {
  animation: fadeIn 0.2s ease;
}

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

/* Backdrop (dark overlay) */
.search-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

/* Light/dark mode specific colors */
html:not(.dark) .search-modal-backdrop {
  background-color: rgba(0, 0, 0, 0.6);
}

html.dark .search-modal-backdrop {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Modal content container */
.search-modal-container {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background-color: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: modalSlideDown 0.25s ease;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

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

/* Dark mode styling */
html.dark .search-modal-container {
  background-color: #292a2d;
  border: 1px solid #3b3d42;
}

/* Header area with search input */
.search-modal-header {
  display: flex;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #eaeaea;
}

html.dark .search-modal-header {
  border-bottom: 1px solid #3b3d42;
}

.search-modal-icon {
  color: #717171;
  margin-right: 10px;
}

html.dark .search-modal-icon {
  color: #a9a9b3;
}

/* Search input styling */
#search-modal-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: #333;
  padding: 8px 0;
}

html.dark #search-modal-input {
  color: #a9a9b3;
}

#search-modal-input::placeholder {
  color: #aaa;
}

html.dark #search-modal-input::placeholder {
  color: #666;
}

/* Close button */
#search-modal-close {
  background: #f1f1f1;
  border: none;
  border-radius: 8px;
  color: #888;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  margin-left: 10px;
}

html.dark #search-modal-close {
  background: #3b3d42;
  color: #a9a9b3;
}

#search-modal-close:hover {
  background: #e5e5e5;
}

html.dark #search-modal-close:hover {
  background: #4a4c51;
}

/* Results area */
.search-modal-results {
  overflow-y: auto;
  padding: 0;
  flex: 1;
  max-height: calc(80vh - 65px); /* Subtract header height */
}

/* Default message states */
.search-modal-info,
.search-modal-empty,
.search-modal-error {
  padding: 30px;
  text-align: center;
  color: #888;
  font-style: italic;
}

html.dark .search-modal-info,
html.dark .search-modal-empty,
html.dark .search-modal-error {
  color: #666;
}

.search-modal-error {
  color: #e25c5c;
}

/* Search result items */
.search-result-item {
  display: block;
  padding: 15px 20px;
  border-bottom: 1px solid #eaeaea;
  transition: background-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}

html.dark .search-result-item {
  border-bottom: 1px solid #3b3d42;
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: #f9f9f9;
}

html.dark .search-result-item:hover,
html.dark .search-result-item.selected {
  background-color: #333;
}

/* Enhanced styling for keyboard selected item */
.search-result-item.selected {
  background-color: #e8f4fd;
  border-left: 3px solid #2196f3;
  padding-left: 17px; /* Compensate for border */
}

html.dark .search-result-item.selected {
  background-color: #1a365d;
  border-left: 3px solid #63b3ed;
}

.search-result-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

html.dark .search-result-title {
  color: #fff;
}

.search-result-content {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

html.dark .search-result-content {
  color: #a9a9b3;
}

.search-result-tags {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

html.dark .search-result-tags {
  color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .search-modal-container {
    width: 95%;
  }
  
  .search-modal {
    padding-top: 10px;
  }
  
  .search-result-content {
    -webkit-line-clamp: 1;
  }
}