/**
 * Search Module Styles
 *
 * @package IncuCommunity
 * @since 1.0.0
 */

/* Search Bar Container */
.incuc-search-bar {
    position: relative;
    width: 100%;
}

.incuc-search-bar__form {
    width: 100%;
}

.incuc-search-bar__wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.incuc-search-bar__wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.incuc-search-bar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    color: #9ca3af;
}

.incuc-search-bar__input {
    flex: 1;
    padding: 0.75rem 0.75rem 0.75rem 0;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #1f2937;
    outline: none;
}

.incuc-search-bar__input::placeholder {
    color: #9ca3af;
}

.incuc-search-bar__button {
    padding: 0.75rem 1.25rem;
    border: none;
    background: #3b82f6;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.incuc-search-bar__button:hover {
    background: #2563eb;
}

/* Dropdown */
.incuc-search-bar__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 0.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.incuc-search-bar__dropdown.is-active {
    display: block;
}

/* Loading State */
.incuc-search-bar__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #6b7280;
}

.incuc-search-bar__loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: incuc-spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

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

/* Suggestions */
.incuc-search-bar__suggestions {
    padding: 0.5rem 0;
}

.incuc-search-bar__suggestion {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.incuc-search-bar__suggestion:hover {
    background: #f3f4f6;
}

.incuc-search-bar__suggestion-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.75rem;
}

.incuc-search-bar__suggestion-thumbnail {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    object-fit: cover;
    margin-right: 0.75rem;
}

.incuc-search-bar__suggestion-info {
    flex: 1;
    min-width: 0;
}

.incuc-search-bar__suggestion-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incuc-search-bar__suggestion-type {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: capitalize;
}

/* No Results */
.incuc-search-bar__no-results {
    padding: 1.5rem;
    text-align: center;
    color: #6b7280;
}

/* Results Groups */
.incuc-search-bar__group {
    border-bottom: 1px solid #e5e7eb;
}

.incuc-search-bar__group:last-child {
    border-bottom: none;
}

.incuc-search-bar__group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.incuc-search-bar__group-count {
    font-weight: normal;
}

.incuc-search-bar__view-all {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #3b82f6;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.incuc-search-bar__view-all:hover {
    background: #f3f4f6;
    text-decoration: none;
}

/* Search Results Page */
.incuc-search-results {
    max-width: 800px;
    margin: 0 auto;
}

.incuc-search-results__header {
    margin-bottom: 1.5rem;
}

.incuc-search-results__query {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.incuc-search-results__count {
    color: #6b7280;
}

.incuc-search-results__tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.incuc-search-results__tab {
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease;
}

.incuc-search-results__tab:hover {
    color: #1f2937;
}

.incuc-search-results__tab.is-active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.incuc-search-results__tab-count {
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.incuc-search-results__tab.is-active .incuc-search-results__tab-count {
    background: #dbeafe;
    color: #1d4ed8;
}

.incuc-search-results__list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Result Item */
.incuc-search-result {
    display: flex;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease;
}

.incuc-search-result:hover {
    border-color: #3b82f6;
}

.incuc-search-result__avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
    flex-shrink: 0;
}

.incuc-search-result__avatar--square {
    border-radius: 0.375rem;
}

.incuc-search-result__content {
    flex: 1;
    min-width: 0;
}

.incuc-search-result__name {
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
}

.incuc-search-result__name:hover {
    color: #3b82f6;
}

.incuc-search-result__excerpt {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.incuc-search-result__meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.incuc-search-result__meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Pagination */
.incuc-search-results__pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.incuc-search-results__page {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background: #fff;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.incuc-search-results__page:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.incuc-search-results__page.is-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.incuc-search-results__page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 640px) {
    .incuc-search-results__tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .incuc-search-result {
        flex-direction: column;
    }

    .incuc-search-result__avatar {
        margin-right: 0;
        margin-bottom: 0.75rem;
    }

    .incuc-search-result__meta {
        flex-wrap: wrap;
    }
}
