/* ===== UX IMPROVEMENTS FOR SEARCH PAGE ===== */

/* Improvement #1: Unified Search Bar */
.unified-search-container {
  margin-bottom: 32px;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 4px 4px 4px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-input-wrapper:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.search-icon-left {
  font-size: 20px;
  margin-right: 12px;
  opacity: 0.5;
}

.unified-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 8px 8px; /* Fix #1 - reduced height by 2px */
  background: transparent;
  color: #1f2937;
}

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

.unified-search-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 8px 24px; /* Fix #1, #2 - reduced to match input height */
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.unified-search-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.unified-search-button svg {
  transition: transform 0.2s ease;
}

.unified-search-button:hover svg {
  transform: translateX(2px);
}

/* Improvement #2, #3, #4: Clean 2-Row Grid with Soft Chips */
.popular-roles-section {
  margin-top: 24px; /* Reduced for compact layout */
  margin-bottom: 24px;
  background: linear-gradient(to bottom, white, #f9fafb); /* Fix #10 - subtle gradient */
  padding: 16px 20px; /* Reduced padding for compact layout */
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #e5e7eb;
}

.section-header {
  margin-bottom: 16px; /* Reduced for compact layout */
  text-align: center;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px; /* Reduced for compact layout */
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 4px 0;
}

.title-icon {
  font-size: 16px; /* Reduced for compact layout */
}

.section-subtitle {
  font-size: 12px; /* Reduced for compact layout */
  color: #6b7280;
  margin: 0 auto;
  max-width: 280px;
  line-height: 1.3;
}

.roles-grid-container {
  display: flex;
  flex-direction: column;
  gap: 16px; /* Reduced for compact layout */
}

.roles-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.roles-row:hover {
  background: #f9fafb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.row-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  min-width: 140px;
  text-align: left;
  padding-top: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  align-self: center;
}

.roles-row-items {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  flex: 1 !important;
  align-items: center !important;
  justify-content: flex-start !important;
  grid-template-columns: none !important;
  width: auto !important;
}

/* Soft Card-like Chips (Improvement #3) */
.role-chip {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #f9fafb !important;
  color: #374151 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
  box-sizing: border-box !important;
}

.role-chip:hover {
  background: #f3f4f6; /* Fix #7 - hover state */
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Fix #7 - more noticeable shadow */
}

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

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

.role-chip.selected:hover {
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5) !important;
  transform: translateY(-2px);
}

.role-chip.selected .chip-text {
  color: white !important;
}

.chip-text {
  font-size: 12px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  text-align: center !important;
}

/* Dropdown List */
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
}

.dropdown-list.show {
  display: block;
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid #f3f4f6;
}

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

.dropdown-item:hover {
  background: #f9fafb;
}

.dropdown-item.selected {
  background: #ede9fe;
  color: #667eea;
  font-weight: 500;
}

/* Selected Roles Display */
.selected-roles-revamped {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.selected-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ede9fe;
  color: #667eea;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.remove-role {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.remove-role:hover {
  opacity: 1;
}

/* Desktop - Override mobile.css */
@media (min-width: 769px) {
  .roles-row-items {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: wrap !important;
  }
  
  .role-chip {
    width: auto !important;
    box-shadow: none !important;
  }
}

/* Responsive Design - Fix #9 */
@media (max-width: 768px) {
  .unified-search-button span {
    display: none;
  }
  
  .unified-search-button {
    padding: 12px 16px;
  }
  
  .popular-roles-section {
    padding: 16px;
    margin-top: 32px;
  }
  
  .roles-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 8px;
  }
  
  .row-label {
    min-width: auto;
    text-align: left;
    padding-right: 0;
    border-right: none;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    width: 100%;
    font-size: 14px;
    font-weight: 700;
  }
  
  .section-subtitle {
    padding-left: 0;
  }
  
  .roles-row-items {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .role-chip {
    font-size: 13px;
    padding: 10px 16px;
    min-width: 160px;
    flex-shrink: 0;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .search-input-wrapper {
    background: #1f2937;
    border-color: #374151;
  }
  
  .unified-search-input {
    color: #f9fafb;
  }
  
  .unified-search-input::placeholder {
    color: #6b7280;
  }
  
  .section-title {
    color: #f9fafb;
  }
  
  .section-subtitle {
    color: #9ca3af;
  }
  
  .row-label {
    color: #9ca3af;
    border-color: #374151;
  }
  
  .role-chip {
    background: #374151;
    color: #e5e7eb;
  }
  
  .role-chip:hover {
    background: #4b5563;
  }
  
  .dropdown-list {
    background: #1f2937;
    border-color: #374151;
  }
  
  .dropdown-item {
    border-color: #374151;
  }
  
  .dropdown-item:hover {
    background: #374151;
  }
}

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

/* Tablets (1024px and below) */
@media (max-width: 1024px) {
  .search-input-wrapper {
    padding: 12px 16px;
  }
  
  .unified-search-button {
    padding: 10px 20px;
  }
}

/* Mobile phones (768px and below) - Enhanced */
@media (max-width: 768px) {
  .search-input-wrapper {
    padding: 10px 14px;
    flex-direction: column;
    gap: 10px;
  }
  
  .search-input-wrapper input {
    font-size: 16px; /* Prevents iOS zoom */
    padding: 10px;
  }
  
  .unified-search-button {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }
  
  .unified-search-button span {
    display: inline; /* Show text on mobile */
  }
  
  .search-filters-compact {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .filter-chip {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .search-suggestions {
    padding: 12px;
  }
  
  .suggestion-item {
    padding: 10px;
    font-size: 14px;
  }
  
  .empty-state {
    padding: 30px 16px;
  }
  
  .empty-state-title {
    font-size: 1.25rem;
  }
  
  .empty-state-description {
    font-size: 0.9rem;
  }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
  .search-input-wrapper {
    padding: 8px 12px;
  }
  
  .search-input-wrapper input {
    padding: 8px;
    font-size: 16px;
  }
  
  .unified-search-button {
    padding: 10px;
    font-size: 14px;
  }
  
  .filter-chip {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
  
  .suggestion-item {
    padding: 8px;
    font-size: 13px;
  }
  
  .empty-state {
    padding: 20px 12px;
  }
  
  .empty-state-title {
    font-size: 1.1rem;
  }
  
  .empty-state-description {
    font-size: 0.85rem;
    max-width: 100%;
  }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .search-input-wrapper {
    flex-direction: row;
  }
  
  .unified-search-button {
    width: auto;
  }
}


/* Hide mobile filter button on desktop */
@media (min-width: 769px) {
  .mobile-filter-btn,
  .mobile-filter-overlay,
  .mobile-filter-panel {
    display: none !important;
  }
}





/* Hide the banner-style active filters indicator (the blue box between controls and jobs) */
#activeFiltersIndicator {
  display: none !important;
}

/* Mobile version - hide the banner */
#mobileActiveFiltersIndicator {
  display: none !important;
}

/* Allow active filters to show in the sidebar - remove any hiding rules */
.filters-sidebar .active-filters-section,
.active-filters-section {
  display: block;
}

.active-filters-section:empty {
  display: none;
}


/* Fix overlapping border issue */
.jobs-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.job-card:first-child {
  margin-top: 0 !important;
}


/* ===================================
   ACTIVE FILTERS INDICATOR (Desktop)
   =================================== */
.active-filters-indicator {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #0ea5e9;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: none; /* Hidden by default, shown when filters are active */
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 10 !important;
}

.active-filters-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-filter-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1.5px solid #0ea5e9;
  border-radius: 8px;
  padding: 8px 10px 8px 12px;
  font-size: 0.875rem;
  color: #0c4a6e;
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.12);
  transition: all 0.2s ease;
  width: 100%;
}

.active-filter-tag:hover {
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
  transform: translateX(2px);
  border-color: #0284c7;
}

.active-filter-tag span {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.active-filter-tag strong {
  color: #0369a1;
  font-weight: 600;
  white-space: nowrap;
}

.active-filter-tag .remove-filter {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  min-width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  padding: 0;
  margin-left: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.active-filter-tag .remove-filter:hover {
  background: #dc2626;
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.active-filter-tag .remove-filter:active {
  transform: scale(1.05);
}

/* Mobile adjustments for active filters */
@media (max-width: 768px) {
  .active-filters-indicator {
    padding: 12px 14px;
    margin: 16px 16px 20px 16px;
    border-radius: 12px;
  }
  
  .active-filter-tag {
    font-size: 0.8125rem;
    padding: 7px 8px 7px 10px;
  }
  
  .active-filter-tag .remove-filter {
    width: 20px;
    height: 20px;
    min-width: 20px;
    font-size: 14px;
  }
}


/* Mobile-only active filters indicator - hide on desktop */
.mobile-only {
  display: none !important;
}

/* Ensure mobile indicator is hidden on desktop */
#mobileActiveFiltersIndicator {
  display: none !important;
}

@media (max-width: 768px) {
  /* Show mobile indicator only in content area on mobile */
  #mobileActiveFiltersIndicator {
    display: block !important;
  }
  
  .content-area .mobile-only {
    display: block !important;
  }
  
  /* Completely hide and collapse active filter indicators inside the filter sidebar/modal on mobile */
  .filters-sidebar .active-filters-indicator,
  .mobile-filter-panel .active-filters-indicator,
  aside .active-filters-indicator,
  .filters-sidebar #activeFiltersIndicator,
  .mobile-filter-panel #activeFiltersIndicator {
    display: none !important;
    visibility: hidden !important;
    max-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  /* Also hide the duplicate Filters header in mobile modal */
  .mobile-filter-panel .filters-header:first-of-type {
    display: none !important;
  }
}


/* ===================================
   SEARCH SPACING IMPROVEMENTS
   =================================== */

/* Add gap between search input and button */
.search-input-wrapper {
  gap: 12px !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .search-input-wrapper {
    gap: 8px !important;
  }
}


/* ===================================
   POPULAR ROLES - CLEAN BOXED LAYOUT
   =================================== */

.popular-roles-section {
  background: white !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 16px !important;
  padding: 28px 32px !important;
  margin-bottom: 28px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.section-header {
  text-align: left !important;
  margin-bottom: 24px !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

.section-title {
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  color: #667eea !important;
  margin: 0 0 4px 0 !important;
  letter-spacing: -0.01em !important;
}

.section-subtitle {
  font-size: 0.875rem !important;
  color: #6b7280 !important;
  margin: 0 0 20px 0 !important;
  font-weight: 400 !important;
}

.roles-grid-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 24px !important;
}

.roles-row {
  display: flex !important;
  align-items: flex-start !important;
  gap: 16px !important;
}

.row-label {
  font-weight: 600 !important;
  font-size: 0.9375rem !important;
  color: #374151 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  min-width: 140px !important;
  padding-top: 8px !important;
  flex-shrink: 0 !important;
}

.roles-row-items {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  flex: 1 !important;
}

.role-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 16px !important;
  background: white !important;
  color: #374151 !important;
  border-radius: 24px !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: 1.5px solid #e5e7eb !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.role-chip:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
  border-color: #667eea !important;
  color: #667eea !important;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
  .popular-roles-section {
    padding: 20px 16px !important;
    margin-bottom: 20px !important;
  }
  
  .section-title {
    font-size: 1.25rem !important;
  }
  
  .section-subtitle {
    font-size: 0.875rem !important;
  }
  
  .roles-row {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .row-label {
    min-width: auto !important;
    padding-top: 0 !important;
  }
  
  .roles-row-items {
    gap: 8px !important;
  }
  
  .role-chip {
    font-size: 0.8125rem !important;
    padding: 6px 12px !important;
  }
}


/* ============================================
   v397: Mobile Tabs + Border Fix + Banner Visibility
   ============================================ */

/* Mobile Category Tabs - Extra Compact */
.role-category-tabs {
  display: none; /* Hidden on desktop */
  gap: 4px;
  margin-bottom: 10px;
}

.category-tab {
  flex: 1;
  padding: 6px 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.category-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

/* Fix: Border cutoff on top pills */
.roles-row-items {
  padding-top: 4px !important; /* Add padding to prevent border cutoff */
}

/* Fix: Better visibility for selected role tags in banner */
.selected-role-tag {
  background: #667eea !important; /* Solid color instead of gradient */
  color: white !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3) !important;
}

.selected-role-tag .role-name {
  color: white !important;
  font-weight: 600 !important;
}

.selected-role-tag .remove-role {
  background: rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  font-weight: 700 !important;
  font-size: 18px !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: 8px !important;
  border: 2px solid rgba(255, 255, 255, 0.5) !important;
  transition: all 0.2s !important;
}

.selected-role-tag .remove-role:hover {
  background: rgba(255, 255, 255, 0.5) !important;
  border-color: white !important;
  transform: scale(1.1) !important;
}

/* Mobile: Show tabs and hide non-active categories */
@media (max-width: 768px) {
  .role-category-tabs {
    display: flex !important;
  }
  
  /* Hide row labels on mobile (since we have tabs) */
  .row-label {
    display: none !important;
  }
  
  /* CRITICAL: Hide all rows by default on mobile */
  .roles-row {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  /* Show only engineering row by default */
  .roles-row[data-category="engineering"] {
    display: flex !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  /* When product tab is active, hide engineering and show product */
  .roles-grid-container.show-product .roles-row[data-category="engineering"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  
  .roles-grid-container.show-product .roles-row[data-category="product"] {
    display: flex !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  /* Ensure roles section is compact */
  .popular-roles-section {
    padding: 14px !important;
    margin-bottom: 16px !important;
  }
  
  .section-header {
    margin-bottom: 10px !important;
  }
  
  .roles-grid-container {
    gap: 0 !important;
  }
}

