.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition: all 250ms ease;
}
.search-toggle:hover {
  background: #f1f5f9;
  color: #1a1a1a;
}
body.dark-mode .search-toggle {
  color: #9ca3af;
}
body.dark-mode .search-toggle:hover {
  background: #1a2c30;
  color: #ffffff;
}
.search-toggle i {
  font-size: 1.125rem;
}

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}
.search-modal.is-open {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}
.search-modal.is-open .search-modal-container {
  transform: translateY(0);
}

.search-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.search-modal-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 1rem;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.search-modal-content {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
body.dark-mode .search-modal-content {
  background: #1a2c30;
  border-color: #234348;
}

.search-modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}
body.dark-mode .search-modal-header {
  border-bottom-color: #234348;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.search-input-wrapper .search-icon {
  color: #9ca3af;
  font-size: 1.25rem;
}
body.dark-mode .search-input-wrapper .search-icon {
  color: #6b7280;
}
[dir=rtl] .search-input-wrapper, .rtl .search-input-wrapper {
  flex-direction: row-reverse;
}

.search-input {
  flex: 1;
  padding: 0.5rem 0;
  border: none;
  background: transparent;
  color: #1a1a1a;
  font-size: 1.125rem;
  outline: none;
}
.search-input::placeholder {
  color: #9ca3af;
}
body.dark-mode .search-input {
  color: #ffffff;
}
body.dark-mode .search-input::placeholder {
  color: #6b7280;
}
[dir=rtl] .search-input, .rtl .search-input {
  text-align: right;
}

.search-close-btn {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.625rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #f8f9fa;
  color: #9ca3af;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 250ms ease;
}
.search-close-btn:hover {
  background: #f1f5f9;
  color: #1a1a1a;
}
body.dark-mode .search-close-btn {
  border-color: #234348;
  background: #152629;
  color: #6b7280;
}
body.dark-mode .search-close-btn:hover {
  background: #1a2c30;
  color: #ffffff;
}

.search-modal-body {
  padding: 1.25rem;
}

.search-section {
  margin-bottom: 1.5rem;
}
.search-section:last-of-type {
  margin-bottom: 1rem;
}

.search-section-title {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}
body.dark-mode .search-section-title {
  color: #6b7280;
}
[dir=rtl] .search-section-title, .rtl .search-section-title {
  flex-direction: row-reverse;
}
[dir=rtl] .search-section-title .me-2, .rtl .search-section-title .me-2 {
  margin-right: 0 !important;
  margin-left: 0.5rem !important;
}

.search-suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
}
.search-suggestions li {
  margin-bottom: 0.25rem;
}

.search-suggestion-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: #4b5563;
  text-decoration: none;
  transition: all 250ms ease;
}
.search-suggestion-link:hover {
  background: #f8f9fa;
  color: #1a1a1a;
}
.search-suggestion-link:hover i {
  transform: translateX(4px);
  color: #20d3ee;
}
.search-suggestion-link i {
  color: #9ca3af;
  transition: transform 250ms ease;
}
body.dark-mode .search-suggestion-link {
  color: #9ca3af;
}
body.dark-mode .search-suggestion-link i {
  color: #6b7280;
}
body.dark-mode .search-suggestion-link:hover {
  background: #152629;
  color: #ffffff;
}
[dir=rtl] .search-suggestion-link, .rtl .search-suggestion-link {
  flex-direction: row-reverse;
}
[dir=rtl] .search-suggestion-link i, .rtl .search-suggestion-link i {
  transform: scaleX(-1);
}
[dir=rtl] .search-suggestion-link:hover i, .rtl .search-suggestion-link:hover i {
  transform: scaleX(-1) translateX(4px);
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 50px;
  background: #f8f9fa;
  color: #4b5563;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 250ms ease;
}
.search-tag:hover {
  border-color: #20d3ee;
  background: rgba(32, 211, 238, 0.1);
  color: #20d3ee;
}
body.dark-mode .search-tag {
  border-color: #234348;
  background: #152629;
  color: #9ca3af;
}
body.dark-mode .search-tag:hover {
  border-color: #20d3ee;
  color: #20d3ee;
}

.search-shortcuts {
  display: flex;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}
body.dark-mode .search-shortcuts {
  border-top-color: #234348;
}
[dir=rtl] .search-shortcuts, .rtl .search-shortcuts {
  flex-direction: row-reverse;
}

.search-shortcut {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #9ca3af;
}
.search-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  background: #f8f9fa;
  color: #4b5563;
  font-family: inherit;
  font-size: 0.6875rem;
}
body.dark-mode .search-shortcut {
  color: #6b7280;
}
body.dark-mode .search-shortcut kbd {
  border-color: #234348;
  background: #152629;
  color: #9ca3af;
}
