/* Search Widget Styles */

.search-widget {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 20px;
  color: #64748b;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: white;
}

.search-input:focus {
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-loading {
  position: absolute;
  right: 12px;
  width: 20px;
  height: 20px;
}

.search-spinner {
  width: 100%;
  height: 100%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: #f8fafc;
}

.search-result-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}

.search-result-icon {
  flex-shrink: 0;
  color: var(--primary-color, #3b82f6);
  display: flex;
  align-items: center;
}

.search-result-description {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-no-results,
.search-error {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.search-error {
  color: #ef4444;
}

/* Highlight matching text */
.search-result-item mark {
  background-color: #fef3c7;
  color: #92400e;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* Mobile Header Search (Icon Only) */
.header-search-icon {
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-search-icon:hover {
  background-color: #f1f5f9;
}

.header-search-icon svg {
  width: 20px;
  height: 20px;
  color: #64748b;
}

/* Search Modal for Mobile */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  padding-top: 60px;
  animation: fadeIn 0.2s;
}

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

.search-modal-content {
  background: white;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 12px;
  animation: slideDown 0.3s;
}

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

.search-modal .search-results {
  position: relative;
  top: 0;
  margin-top: 12px;
  box-shadow: none;
}

/* Footer Search */
.footer-search-container {
  max-width: 400px;
}

.footer-search-container .search-input {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.footer-search-container .search-input:focus {
  background-color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .search-widget {
    max-width: 100%;
  }

  .search-results {
    max-height: 300px;
  }
}

/* Integration with hamburger menu */
.hamburger-search {
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.hamburger-search .search-widget {
  max-width: 100%;
}

.hamburger-search .search-results {
  position: static;
  margin-top: 12px;
  box-shadow: none;
  border: none;
  border-radius: 0;
  background: transparent;
}

.hamburger-search .search-result-item {
  border-radius: 6px;
  margin-bottom: 4px;
}
