/* Search Filters Component */
.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    margin-top: 1em;
    max-height: 15vh;
    overflow-y:  scroll;
}

.tag, .category {
    white-space: nowrap;
    padding: 0.6em 1.2em;
    background: var(--gradient-blue);
    color: var(--gray-text);
    border-radius: 2em;
    cursor: pointer;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}


.popular-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black 80%, transparent);
}

.regular-filters {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to bottom, black 60%, transparent);
}


.popular-filters .tags-grid, .regular-filters .tags-grid  {
    max-width: 90vw;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.8em;
    padding-bottom: 0.5em;
    scrollbar-width: none;
}

.available-tags-container, 
.regular-filters, 
.selected-tags-container,
.search-results-container {
  transition: 
    opacity 1s ease-out, 
    max-height 1s ease-out,
    transform 1s ease-out;
    will-change: opacity, max-height, transform;
}

.popular-label {
    display: flex;
    align-items: center;
    gap: 0.3em;
    color: var(--color-primary);
    font-weight: 500;
    margin-right: 0.5em;
}

/* Regular filters - limited to 3 lines */
.regular-filters .tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    max-height: 10em;
}

.regular-filters.expanded .tags-grid {
    max-height: none;
}

.available-tags-container.transitioning {
    transition: all 1s ease;
}


#searchButton.disabled, 
#resetSearch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.selected-tags-container:has(.tag) #resetSearch {
    /* Style when tags exist */
    opacity: 1;
    cursor: pointer;
}
.selected-tags-container:not(:has(.tag)) #resetSearch {
    /* Style when no tags */
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}


/* Show More button */
.more-btn {
    background: var(--blue-gradient-2);
    color: white !important;
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 0.6em 1.2em;
    order: 999;
}

/* Selected tags styling */
.selected-tag {
    color: darkblue !important;
    font-weight: bold;
    border: 1px solid darkblue !important;
    position: relative;
    padding-right: 1.8em !important;
}

.selected-tag::after {
    content: '×';
    position: absolute;
    right: 0.7em;
    font-weight: bold;
}

.selected-tag:hover {
    transform: scale(1) !important;
    opacity: 0.9;
}

/* Dropdown styling */
.tag-dropdown {
    position: absolute;
    background: white;
    border-radius: 0.5em;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.3em;
    z-index: 100;
    min-width: 150px;
    width: auto;
    max-height: 300px;
    overflow-y: auto;
}

.tag-option {
    cursor: pointer;
    padding: 5px;
    border-radius: 0.5em;
}

.tag-option:hover {
    background: darkblue;
    color: white;
}

/* Hide scrollbar but keep functionality */
.popular-filters::-webkit-scrollbar, .regular-filters::-webkit-scrollbar {
    height: 4px;
}
.popular-filters::-webkit-scrollbar-thumb, .regular-filters::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 2px;
}

.tag:hover, .category:hover {
    transform: scale(1.05);
}

.add-tag-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 4px;
  }
  
  .new-tag-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  
  .save-tag-btn,
  .cancel-tag-btn {
    padding:.25em;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
  }

  .save-tag-btn {
    background-color: var(--color-success);
    color: white;
  }

  .cancel-tag-btn {
    background-color: var(--color-error);
    color: white;
  }

  
  .save-tag-btn:hover, .cancel-tag-btn:hover {
    color: darkblue;
  }
  



/* Search Results */

.avatar-fallback {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #3f51b5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
}

#searchResultsContainer {
    margin-top: 2em;
    width: 100%;
}

.result-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    border-radius: 0.8em;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
}

.result-item h4 {
    margin-bottom: 0.5em;
    color: var(--color-primary);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.result-profile {
    display: flex;
    align-items: center;
    gap: 1em;
    width: 70%;
}

.profile-container {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-icon {
  font-size: 24px;
  color: #666;
}


.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.school-logos {
    display: flex;
    gap: 0.5em;
    width: 30%;
    justify-content: flex-end;
}

.school-logo {
    height: 30px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
}

.result-snippet {
    color: var(--dark-gray-text);
    line-height: 1.5;
    margin-top: 0.5em;
}

.no-results {
    color: var(--gray-text);
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2em;
}

.error-state, .no-results {
    text-align: center;
    padding: 2em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

.error-state .material-icons {
    color: #d32f2f;
    font-size: 3em;
}

.no-results .material-icons {
    color: var(--gray-light);
    font-size: 3em;
}

.university-tag {
    background: var(--color-primary-light);
    color: white;
    padding: 0.3em 0.8em;
    border-radius: 1em;
    font-size: 0.8em;
    margin-right: 0.5em;
}

.result-program {
    font-size: 0.9em;
    color: var(--color-primary);
    margin-top: 0.5em;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.8em;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}