/**
 * Search Functionality Styles for SpeedRead Theme
 * Professional search interface with advanced filtering
 */

/* Search Header */
.search-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 3rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.search-header::before {
  content: '';
}

.search-header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.search-query {
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.search-query-text {
    font-size: 1.3rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.15);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    display: inline-block;
    backdrop-filter: blur(15px);
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.2);
    margin-top: 1rem;
}

.search-query-text strong {
    color: #fde047;
    font-weight: 700;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Professional Pagination Styling */
.pagination {
    margin: 3rem 0;
    text-align: center;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-numbers .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    padding: 0.75rem 1rem;
    background: white;
    color: #667eea;
    text-decoration: none;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-numbers .page-numbers:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.page-numbers .page-numbers.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.page-numbers .page-numbers.prev,
.page-numbers .page-numbers.next {
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #475569;
}

.page-numbers .page-numbers.prev:hover,
.page-numbers .page-numbers.next:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.page-numbers .page-numbers.dots {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: default;
    box-shadow: none;
}

.page-numbers .page-numbers.dots:hover {
    background: transparent;
    color: #94a3b8;
    transform: none;
    box-shadow: none;
}

/* Professional Search Form */
.search-form-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.search-form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.search-form-simple {
    width: 100%;
}

.search-input-group {
    display: flex;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 60px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: relative;
}

.search-input-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.search-input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
    transform: translateY(-3px);
}

.search-input-group:focus-within::before {
    opacity: 1;
}

.search-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    outline: none;
    color: #2d3748;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.search-field::placeholder {
    color: #718096;
    font-weight: 400;
    transition: color 0.3s ease;
}

.search-field:focus::placeholder {
    color: #a0aec0;
}

.search-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 1.25rem 2.5rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.search-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.search-submit:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.search-submit:hover::before {
    left: 100%;
}

.search-submit:active {
    transform: scale(0.98);
}

/* Search Results Grid */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
    padding: 0;
}

/* Enhanced Search Results Layout */
.search-results-container {
    background: #f8fafc;
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.search-results-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
    pointer-events: none;
}

.search-results-container {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

/* Search Results Info */
.search-results-info {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.search-results-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.search-results-info h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin: 0 0 1rem 0;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-results-count {
    color: #64748b;
    font-size: 1.1rem;
    margin: 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.search-results-count strong {
    color: #667eea;
    font-weight: 700;
    font-size: 1.2rem;
}

/* No Search Results */
.no-search-results {
  text-align: center;
  padding: 4rem 2rem;
}

.no-results-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.no-search-results h2 {
  font-size: 2rem;
  color: #1e293b;
  margin-bottom: 1rem;
}

.no-search-results p {
  font-size: 1.1rem;
  color: #64748b;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Search Suggestions */
.search-suggestions {
  background: #f8fafc;
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.search-suggestions h3 {
  color: #1e293b;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.search-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-suggestions li {
  padding: 0.5rem 0;
  color: #64748b;
  position: relative;
  padding-left: 1.5rem;
}

.search-suggestions li::before {
  content: '•';
  color: #667eea;
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Popular Books Fallback */
.popular-books-fallback {
  margin-top: 3rem;
}

.popular-books-fallback h3 {
  font-size: 1.5rem;
  color: #1e293b;
  margin-bottom: 2rem;
  text-align: center;
}

/* Search Autocomplete (for future enhancement) */
.search-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-suggestion-item {
  padding: 1rem 1.5rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s;
}

.search-suggestion-item:hover,
.search-suggestion-item.highlighted {
  background: #f8fafc;
}

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

/* Loading State */
.search-loading {
  text-align: center;
  padding: 3rem 2rem;
}

.search-loading::before {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .search-header {
    padding: 2rem 0;
  }
  
  .search-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
  }
  
  .search-query,
  .search-query-text {
    font-size: 1.1rem;
    padding: 0.6rem 1rem;
  }
  
  .search-container {
    padding: 0 1rem;
  }
  
  .page-numbers .page-numbers {
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .search-field {
    padding: 1rem;
    font-size: 1rem;
    min-height: 44px; /* Touch-friendly */
  }
  
  .search-submit {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    min-height: 44px; /* Touch-friendly */
  }
}

@media (max-width: 480px) {
  .search-header {
    padding: 1.5rem 0;
  }
  
  .search-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
  }
  
  .search-query,
  .search-query-text {
    font-size: 1rem;
    padding: 0.5rem 0.8rem;
    margin-top: 0.8rem;
  }
  
  .search-container {
    padding: 0 0.8rem;
  }
  
  .page-numbers {
    gap: 0.3rem;
  }
  
  .page-numbers .page-numbers {
    min-width: 36px;
    height: 36px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
  
  .search-field {
    padding: 0.8rem;
    font-size: 0.9rem;
  }
  
  .search-submit {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 320px) {
  .search-header h1 {
    font-size: 1.5rem;
  }
  
  .search-query,
  .search-query-text {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
  }
  
  .search-container {
    padding: 0 0.5rem;
  }
  
  .page-numbers .page-numbers {
    min-width: 32px;
    height: 32px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .search-field {
    padding: 0.7rem;
    font-size: 0.85rem;
  }
  
  .search-submit {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
  }
}

/* Search Highlighting */
.search-highlight {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1em 0.2em;
  border-radius: 3px;
  font-weight: 600;
}

/* Advanced Filters Expanded State */
.search-filters.filters-expanded {
  background: #f8fafc;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .search-header h1 {
    font-size: 2rem;
  }
  
  .search-header p {
    font-size: 1rem;
  }
  
  .search-container {
    padding: 1rem 0.75rem;
  }
  
  .search-form-container {
    padding: 1.5rem;
  }
  
  .search-input-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .search-field-advanced {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  .search-submit-advanced {
    width: 100%;
    justify-content: center;
  }
  
  .search-filters {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .filter-toggle {
    order: -1;
    margin-bottom: 1rem;
  }
  
  .no-results-icon {
    font-size: 4rem;
  }
  
  .no-search-results h2 {
    font-size: 1.5rem;
  }
  
  .search-suggestions {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .search-header {
    padding: 2rem 0;
  }
  
  .search-header h1 {
    font-size: 1.75rem;
  }
  
  .search-form-container {
    padding: 1rem;
  }
  
  .search-field-advanced {
    font-size: 0.95rem;
  }
  
  .filter-group select {
    font-size: 0.9rem;
  }
  
  .no-search-results {
    padding: 3rem 1rem;
  }
  
  /* Mobile Pagination */
  .pagination {
    margin: 2rem 0;
  }
  
  .page-numbers {
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .page-numbers .page-numbers {
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .page-numbers .page-numbers.prev,
  .page-numbers .page-numbers.next {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Print Styles */
@media print {
  .search-form-container,
  .search-filters,
  .filter-toggle {
    display: none;
  }
  
  .search-header {
    background: none;
    color: black;
  }
  
  .search-results-info {
    background: none;
    border: 1px solid #ccc;
  }
}
