/**
 * Thu Vien Search Styling
 * Additional styles for the search functionality
 */

/* Search Section - Compact styling */
.thu-vien-search {
  background-color: rgb(253, 251, 247);
  box-shadow: 0px 8px 12px -6px rgba(0, 0, 0, 0.04);
  border-radius: 0.25rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.thu-vien-search .search-header {
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 0.5rem;
}

.thu-vien-search .search-header h3 {
  margin: 0;
  color: var(--global-palette1, #0073aa);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
}

/* Search Input Group - Compact styling */
.search-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 13px;
  line-height: 1.4;
  background-color: #fff;
  transition: border-color 0.2s ease;
  font-family: inherit;
  height: 36px;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--global-palette1, #0073aa);
  box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
  background-color: #fff;
}

.search-input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.search-type-select {
  padding: 0.5rem 1.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 13px;
  background-color: #fff;
  color: #374151;
  min-width: 140px;
  transition: border-color 0.2s ease;
  font-family: inherit;
  cursor: pointer;
  height: 36px;
  box-sizing: border-box;
}

.search-type-select:focus {
  outline: none;
  border-color: var(--global-palette1, #0073aa);
  box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.search-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background-color: var(--global-palette1, #0073aa);
  color: white;
  border: none;
  border-radius: 0.25rem;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
  height: 36px;
  box-sizing: border-box;
}

.search-button:hover {
  background-color: var(--global-palette1-hover, #005a87);
}

.search-button:active {
  transform: translateY(0);
}

.search-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.search-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Search Results Info - Compact */
.search-results-info {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #d1d5db;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.search-results-info p {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
}

.search-results-info strong {
  color: var(--global-palette1, #0073aa);
  font-weight: 600;
}

.clear-search {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--global-palette1, #0073aa);
  text-decoration: none;
  font-size: 14px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--global-palette1, #0073aa);
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
  font-weight: 500;
  background-color: transparent;
}

.clear-search:hover {
  background-color: var(--global-palette1, #0073aa);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Loading States */
.search-loading {
  position: relative;
  overflow: hidden;
}

.search-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--global-palette1, #0073aa),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Search Results Styling */
.search-results {
  margin-top: 2rem;
}

.search-results .entry {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
  transition: all 0.2s ease-in-out;
}

.search-results .entry:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.search-results .entry-contributors {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  font-style: italic;
}

.search-results .entry-meta {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
  font-style: italic;
}

.no-results p {
  margin: 0;
  font-size: 1.1rem;
}

/* Error States */
.search-error {
  text-align: center;
  padding: 2rem 1rem;
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  margin-top: 1rem;
}

.search-error p {
  margin: 0;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .search-input {
    min-width: 200px;
  }

  .search-type-select {
    min-width: 150px;
  }
}

@media (max-width: 768px) {
  .thu-vien-search {
    padding: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .search-input-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .search-input,
  .search-type-select,
  .search-button {
    width: 100%;
    min-width: unset;
    height: 34px;
  }

  .search-results-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .search-header h3 {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .thu-vien-search {
    padding: 0.625rem;
    margin-bottom: 1rem;
  }

  .search-input,
  .search-type-select,
  .search-button {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    height: 32px;
  }

  .search-header h3 {
    font-size: 0.9rem;
  }

  .search-results-info p {
    font-size: 12px;
  }

  .clear-search {
    font-size: 12px;
    padding: 0.375rem 0.625rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .search-input,
  .search-type-select {
    border-width: 2px;
    border-color: #000;
  }

  .search-button {
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .search-input,
  .search-type-select,
  .search-button,
  .clear-search {
    transition: none;
  }

  .search-button:hover,
  .clear-search:hover {
    transform: none;
  }

  .search-results .entry:hover {
    transform: none;
  }
}

/* Print styles */
@media print {
  .thu-vien-search {
    display: none;
  }
}
