/* WPP Drive Search Frontend Styles */

.wpp-drive-search-container {
  max-width: 800px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Search Form */
.wpp-drive-search-form {
  margin-bottom: 2rem;
}

.search-input-group {
  position: relative;
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}

#wpp-drive-search-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

#wpp-drive-search-input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.search-button {
  padding: 12px 24px;
  background: #0073aa;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-button:hover {
  background: #005a87;
}

/* Search suggestions feature removed */

/* Search Filters */
.search-filters {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-top: 1rem;
}

.search-filters h4 {
  margin: 0 0 1rem 0;
  color: #333;
}

.filter-group {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group label {
  font-weight: 600;
  min-width: 100px;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.toggle-filters-btn {
  background: #666;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.toggle-filters-btn:hover {
  background: #555;
}

/* Loading Indicator */
.search-loading {
  text-align: center;
  padding: 2rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

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

.search-stats {
  padding: 1rem;
  background: #f0f8ff;
  border-left: 4px solid #0073aa;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: #333;
  border-radius: 0 4px 4px 0;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-result-item {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.search-result-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.result-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.result-title a {
  color: #0073aa;
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-meta {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #666;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Hide empty result-meta divs */
.result-meta:empty {
  display: none;
}

.file-size {
  background: #e3f2fd;
  padding: 2px 8px;
  border-radius: 12px;
}

.result-excerpt {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #555;
}

.result-excerpt mark {
  background-color: #ffeb3b; /* Bright yellow highlighting */
  color: #333;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.view-button {
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  background: #0073aa;
  color: white;
}

.view-button:hover {
  background: #005a87;
  color: white;
}

/* Pagination */
.search-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 1rem;
}

.pagination-link {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: white;
  color: #0073aa;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination-link:hover {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
}

.pagination-link.current {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  background: #f9f9f9;
  border-radius: 8px;
}

.no-results h3 {
  margin: 0 0 1rem 0;
  color: #666;
}

.no-results p {
  margin: 0;
  color: #888;
}

/* Search Message */
.search-message {
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
  margin: 1rem 0;
  font-weight: 600;
}

.search-message-info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.search-message-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.search-message-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

/* Loading States */
.search-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
  .wpp-drive-search-container {
    padding: 0 1rem;
  }

  .search-input-group {
    flex-direction: column;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group label {
    min-width: auto;
  }

  .result-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .result-actions {
    flex-direction: column;
  }

  .search-pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  #wpp-drive-search-input,
  .search-button {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .search-result-item {
    padding: 1rem;
  }

  .result-title {
    font-size: 1.1rem;
  }
}

/* Focus management - suggestions removed */

/* Better visual feedback for interactions */
.view-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Smooth transitions */
.search-result-item,
.pagination-link {
  transition: all 0.3s ease;
}

/* Highlighting for search terms */
.wpp-drive-search-results .result-excerpt mark {
  background-color: #ffeb3b; /* Bright yellow highlighting */
  color: #333;
  padding: 2px 4px;
  border-radius: 3px;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Page number tags */
.result-meta .page-tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.page-tags-label {
  color: #666;
  margin-right: 3px;
  font-weight: 500;
}

.page-tag {
  background-color: #f0f0f0;
  color: #333;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #ddd;
  margin-bottom: 5px; /* For vertical spacing when wrapped */
}
