/**
 * Search Autocomplete Styles
 */

/* Autocomplete dropdown */
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 1000;
  margin-top: -1px;
}

.dropdown-list.active {
  max-height: 400px;
  opacity: 1;
  overflow-y: auto;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f3f4f6;
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #f9fafb;
}

.autocomplete-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.autocomplete-text {
  flex: 1;
  font-size: 14px;
  color: #111827;
}

.autocomplete-text strong {
  color: #2563eb;
  font-weight: 600;
}

.autocomplete-type {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  background: #f3f4f6;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Search input wrapper positioning */
.unified-search-container {
  position: relative;
}

.search-input-wrapper {
  position: relative;
  z-index: 1;
}

/* Enhanced Popular Roles Section */
.popular-roles-section {
  margin-top: 32px;
}

.section-header {
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px 0;
}

.title-icon {
  font-size: 24px;
}

.section-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.roles-grid-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.roles-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.row-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 100px;
  padding-top: 10px;
  flex-shrink: 0;
}

.roles-row-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.role-chip:hover {
  background: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.role-chip:active {
  transform: translateY(0);
}

.chip-text {
  line-height: 1;
  text-align: center;
}

/* Category Icons */
.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  margin-right: 8px;
}

.category-icon.engineering {
  background: #dbeafe;
}

.category-icon.product {
  background: #fce7f3;
}

.category-icon.design {
  background: #fef3c7;
}

.category-icon.marketing {
  background: #d1fae5;
}

.category-icon.sales {
  background: #e0e7ff;
}

.category-icon.data {
  background: #fce7f3;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .roles-row {
    flex-direction: column;
    gap: 8px;
  }
  
  .row-label {
    min-width: auto;
    padding-top: 0;
    font-size: 12px;
  }
  
  .roles-row-items {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
  }
  
  .roles-row-items::-webkit-scrollbar {
    height: 6px;
  }
  
  .roles-row-items::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }
  
  .roles-row-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }
  
  .roles-row-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  
  .role-chip {
    flex-shrink: 0;
  }
  
  .section-title {
    font-size: 18px;
  }
  
  .title-icon {
    font-size: 20px;
  }
  
  .section-subtitle {
    font-size: 13px;
  }
  
  .autocomplete-item {
    padding: 10px 12px;
  }
  
  .autocomplete-text {
    font-size: 13px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .dropdown-list {
    background: #1f2937;
    border-color: #374151;
  }
  
  .autocomplete-item {
    border-bottom-color: #374151;
  }
  
  .autocomplete-item:hover,
  .autocomplete-item.active {
    background-color: #374151;
  }
  
  .autocomplete-text {
    color: #f9fafb;
  }
  
  .autocomplete-type {
    background: #374151;
    color: #9ca3af;
  }
  
  .section-title {
    color: #f9fafb;
  }
  
  .section-subtitle {
    color: #9ca3af;
  }
  
  .row-label {
    color: #9ca3af;
  }
  
  .role-chip {
    background: #1f2937;
    border-color: #374151;
    color: #d1d5db;
  }
  
  .role-chip:hover {
    background: #374151;
    border-color: #3b82f6;
    color: #60a5fa;
  }
}

/* Loading state for autocomplete */
.autocomplete-loading {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

.autocomplete-loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* No results state */
.autocomplete-no-results {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

/* Accessibility improvements */
.autocomplete-item:focus {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* Smooth scroll for mobile */
@media (max-width: 768px) {
  .roles-row-items {
    scroll-behavior: smooth;
  }
}

/* ============================================
   COMPREHENSIVE RESPONSIVE DESIGN - SEARCH AUTOCOMPLETE
   ============================================ */

/* Tablets (1024px and below) */
@media (max-width: 1024px) {
  .dropdown-list {
    max-width: 95%;
  }
  
  .roles-row-items {
    gap: 8px;
  }
  
  .role-pill {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}

/* Mobile phones (768px and below) - Enhanced */
@media (max-width: 768px) {
  .dropdown-list {
    max-width: 100%;
    left: 0;
    right: 0;
    border-radius: 8px;
  }
  
  .dropdown-item {
    padding: 12px;
    font-size: 14px;
  }
  
  .dropdown-item-main {
    font-size: 14px;
  }
  
  .dropdown-item-sub {
    font-size: 12px;
  }
  
  .roles-row {
    padding: 12px;
  }
  
  .roles-row-title {
    font-size: 0.85rem;
  }
  
  .roles-row-items {
    gap: 6px;
  }
  
  .role-pill {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .dropdown-section-title {
    font-size: 0.75rem;
    padding: 8px 12px;
  }
  
  .no-results {
    padding: 20px 12px;
    font-size: 0.9rem;
  }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
  .dropdown-list {
    border-radius: 6px;
  }
  
  .dropdown-item {
    padding: 10px;
  }
  
  .dropdown-item-main {
    font-size: 13px;
  }
  
  .dropdown-item-sub {
    font-size: 11px;
  }
  
  .roles-row {
    padding: 10px;
  }
  
  .roles-row-title {
    font-size: 0.8rem;
  }
  
  .role-pill {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
  
  .no-results {
    padding: 16px 10px;
    font-size: 0.85rem;
  }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
  .dropdown-item {
    min-height: 44px; /* iOS touch target size */
  }
  
  .role-pill {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
}
