/*
 * Modern Controls Header Design
 * Enhanced styling for category and search page controls
 */

/* ===== MODERN CONTROLS HEADER ===== */
.controls-header-modern,
.search-controls-header-modern {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 20px;
}

.results-title-wrapper,
.results-title-wrapper-modern {
  display: flex;
  align-items: center;
  gap: 16px;
}

.results-icon-modern,
.search-icon-large-modern {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  position: relative;
  flex-shrink: 0;
}

.results-icon-modern::after,
.search-icon-large-modern::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border: 2px solid #3b82f6;
  border-radius: 16px;
  animation: iconPulse 2s infinite;
  opacity: 0.4;
}

@keyframes iconPulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.2; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
}

.results-content,
.results-content-modern {
  flex: 1;
}

.results-content h2,
.results-content-modern h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 800;
  color: #1f2937;
  font-family: var(--font-secondary);
  line-height: 1.2;
}

.results-meta-modern,
.search-meta-modern {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #6b7280;
}

.results-count-modern,
.search-query-modern {
  font-weight: 600;
  color: #374151;
}

.search-query-modern strong {
  color: #3b82f6;
}

.results-separator {
  color: #d1d5db;
  font-weight: 700;
}

.results-views-modern,
.results-rating-modern {
  display: flex;
  align-items: center;
  gap: 4px;
}

.results-rating-modern i {
  color: #fbbf24;
  font-size: 12px;
}

.no-results-text-modern {
  color: #ef4444;
  font-weight: 600;
}

/* ===== CONTROLS ACTIONS ===== */
.controls-actions-modern,
.search-controls-actions-modern {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.view-controls-modern {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-label-modern,
.sort-label-modern {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.view-toggle-modern {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-btn-modern {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
}

.view-btn-modern:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.view-btn-modern.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.view-btn-modern i {
  font-size: 16px;
}

.view-btn-modern span {
  font-size: 12px;
}

/* ===== SORT CONTROLS ===== */
.sort-controls-modern {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select-wrapper-modern {
  position: relative;
}

.sort-select-modern {
  appearance: none;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 40px 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 160px;
}

.sort-select-modern:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.select-arrow-modern {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  transition: transform 0.3s ease;
}

.sort-select-modern:focus + .select-arrow-modern {
  transform: translateY(-50%) rotate(180deg);
}

/* ===== ADVANCED FILTERS ===== */
.advanced-filters-modern,
.search-filters-container-modern {
  margin-top: 24px;
  border-top: 1px solid #e5e7eb;
  padding-top: 24px;
}

.filters-toggle-modern {
  margin-bottom: 20px;
}

.filters-toggle-btn-modern {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  justify-content: space-between;
}

.filters-toggle-btn-modern:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.filters-toggle-btn-modern.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #3b82f6;
}

.filters-toggle-btn-modern .toggle-icon {
  transition: transform 0.3s ease;
}

.filters-toggle-btn-modern.active .toggle-icon {
  transform: rotate(180deg);
}

.filters-content-modern,
.search-filters-content-modern {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  margin-top: 16px;
}

.filters-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.filter-group-modern {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-modern label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.filter-select-modern {
  appearance: none;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 40px 12px 16px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: all 0.3s ease;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
}

.filter-select-modern:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ===== FILTER ACTIONS ===== */
.filters-actions-modern,
.search-filters-actions-modern {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-modern {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary-modern {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
}

.btn-primary-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.btn-secondary-modern {
  background: white;
  color: #6b7280;
  border: 2px solid #e5e7eb;
}

.btn-secondary-modern:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

.btn-modern::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;
}

.btn-modern:hover::before {
  left: 100%;
}

/* ===== ACTIVE FILTERS ===== */
.active-filters-modern {
  margin-top: 20px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}

.active-filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.active-filters-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
}

.clear-all-filters-modern {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-all-filters-modern:hover {
  background: #3b82f6;
  color: white;
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.active-filter-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #3b82f6;
  border-radius: 20px;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 600;
}

.active-filter-tag .remove-filter {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.active-filter-tag .remove-filter:hover {
  background: #3b82f6;
  color: white;
}

/* ===== CATEGORY SEARCH SECTION ===== */
.category-search-section-modern {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.category-search-section-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(59, 130, 246, 0.1) 1px, transparent 0);
  background-size: 20px 20px;
  opacity: 0.3;
}

.category-search-container {
  position: relative;
  z-index: 2;
}

.search-header-modern {
  text-align: center;
  margin-bottom: 24px;
}

.search-header-modern h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  font-family: var(--font-secondary);
}

.search-header-modern p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.category-search-form-modern {
  max-width: 600px;
  margin: 0 auto;
}

.search-input-container-modern {
  position: relative;
  display: flex;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.search-input-container-modern:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 20px rgba(0, 0, 0, 0.08);
}

.search-icon-container-modern {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  color: #9ca3af;
  font-size: 16px;
}

.category-search-input-modern {
  flex: 1;
  padding: 16px 0;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #1f2937;
  outline: none;
}

.category-search-input-modern::placeholder {
  color: #9ca3af;
}

.search-clear-btn-modern {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-clear-btn-modern:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.search-submit-btn-modern {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-submit-btn-modern:hover {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

/* ===== SEARCH SUGGESTIONS ===== */
.category-search-suggestions-modern,
.search-suggestions-section-modern {
  margin-top: 20px;
}

.suggestions-header-modern {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestions-header-modern i {
  color: #f59e0b;
}

.suggestions-tags-modern,
.related-tags-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-tag-modern,
.related-tag-modern {
  padding: 8px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.suggestion-tag-modern:hover,
.related-tag-modern:hover {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ===== SEARCH SUGGESTIONS SECTION ===== */
.suggestions-container-modern {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.related-searches-modern,
.search-tips-modern {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.related-searches-modern h4,
.search-tips-modern h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}

.search-tips-list-modern {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.search-tips-list-modern li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
}

.search-tips-list-modern i {
  color: #f59e0b;
  font-size: 12px;
}

/* ===== RESULTS SUMMARY ===== */
.results-summary-modern {
  margin-bottom: 32px;
}

.summary-stats-modern {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card-modern {
  background: white;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.stat-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon-modern {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-content-modern {
  flex: 1;
}

.stat-number-modern {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label-modern {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .controls-header-modern,
  .search-controls-header-modern {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  
  .controls-actions-modern,
  .search-controls-actions-modern {
    justify-content: space-between;
  }
  
  .filters-grid-modern {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  
  .suggestions-container-modern {
    grid-template-columns: 1fr;
  }
  
  .summary-stats-modern {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 768px) {
  .results-title-wrapper,
  .results-title-wrapper-modern {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .controls-actions-modern,
  .search-controls-actions-modern {
    flex-direction: column;
    gap: 16px;
  }
  
  .view-controls-modern {
    justify-content: center;
  }
  
  .sort-controls-modern {
    justify-content: center;
  }
  
  .filters-actions-modern,
  .search-filters-actions-modern {
    flex-direction: column;
  }
  
  .search-input-container-modern {
    flex-direction: column;
  }
  
  .search-submit-btn-modern {
    justify-content: center;
  }
  
  .results-meta-modern,
  .search-meta-modern {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .results-content h2,
  .results-content-modern h2 {
    font-size: 24px;
  }
  
  .results-icon-modern,
  .search-icon-large-modern {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .view-btn-modern span {
    display: none;
  }
  
  .sort-select-modern {
    min-width: 120px;
  }
  
  .filters-grid-modern {
    grid-template-columns: 1fr;
  }
  
  .summary-stats-modern {
    grid-template-columns: 1fr;
  }
  
  .suggestions-tags-modern,
  .related-tags-modern {
    justify-content: center;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  .results-icon-modern::after,
  .search-icon-large-modern::after {
    animation: none;
  }
  
  .view-btn-modern,
  .btn-modern,
  .stat-card-modern,
  .suggestion-tag-modern,
  .related-tag-modern {
    transition: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== FOCUS STYLES ===== */
.view-btn-modern:focus,
.sort-select-modern:focus,
.filter-select-modern:focus,
.btn-modern:focus,
.filters-toggle-btn-modern:focus,
.suggestion-tag-modern:focus,
.related-tag-modern:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  .results-icon-modern,
  .search-icon-large-modern,
  .stat-icon-modern {
    border: 2px solid #000;
  }
  
  .view-btn-modern.active {
    border: 2px solid #000;
  }
  
  .sort-select-modern,
  .filter-select-modern {
    border: 2px solid #000;
  }
  
  .btn-primary-modern {
    background: #000;
    border: 2px solid #000;
  }
}