/* ========== СТРАНИЦА ПОИСКА ========== */

.search-page {
    min-height: calc(100vh - 72px);
    background: var(--body-bg);
    padding-bottom: 3rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Заголовок */
.search-header {
    padding: 2rem 0 1.5rem;
}

.search-title-section {
    margin-bottom: 1.5rem;
}

.search-title-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.search-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Поисковая форма */
.search-form-container {
    position: relative;
}

.search-form {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 3rem;
    background: var(--post-bg);
    border: 2px solid var(--input-border);
    border-radius: 16px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1),
                0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Кнопка очистки поиска */
.search-clear {
    position: absolute;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    z-index: 2;
}

.search-clear svg {
    width: 18px;
    height: 18px;
}

.search-clear:hover {
    background: var(--error-color);
    color: white;
    transform: scale(1.1) rotate(90deg);
}

.search-clear:active {
    transform: scale(0.95);
}

/* Подсказки поиска */
.search-suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--post-border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--sidebar-bg);
}

.suggestion-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.suggestion-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--button-primary-bg));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    text-decoration: none;
}

.suggestion-info {
    flex: 1;
    min-width: 0;
}

.suggestion-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-type {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--sidebar-bg);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Фильтры */
.search-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--post-bg);
    border: 2px solid var(--post-border);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tab:hover {
    background: var(--sidebar-bg);
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
}

.filter-tab svg {
    width: 18px;
    height: 18px;
}

.filter-count {
    padding: 0.125rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.filter-tab.active .filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Сортировка */
.sort-dropdown {
    position: relative;
}

.sort-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--post-bg);
    border: 2px solid var(--post-border);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-button:hover {
    background: var(--sidebar-bg);
    border-color: var(--accent-color);
}

.sort-button.active {
    border-color: var(--accent-color);
}

.sort-button svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.sort-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

.sort-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 100;
    overflow: hidden;
    display: none;
    animation: slideDown 0.2s ease;
}

.sort-menu.show {
    display: block;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    text-align: left;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sort-option:hover {
    background: var(--sidebar-bg);
}

.sort-option.active {
    background: var(--sidebar-bg);
    color: var(--accent-color);
}

.sort-option svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Результаты поиска */
.search-results-section {
    margin-top: 1.5rem;
}

.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--post-border);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-loading span {
    font-size: 0.9375rem;
}

/* Пустое состояние и "ничего не найдено" */
.search-empty,
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
}

.search-empty svg,
.search-no-results svg {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    padding: 2rem;
    background: var(--sidebar-bg);
    border-radius: 50%;
    color: var(--text-secondary);
    opacity: 0.5;
}

.search-no-results svg {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    color: var(--error-color);
    opacity: 0.6;
}

.search-empty h3,
.search-no-results h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.search-empty p,
.search-no-results p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 400px;
}

/* Результаты */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Карточка результата */
.result-card {
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) minmax(220px, auto);
    align-items: start;
    gap: 1rem;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.result-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    text-decoration: none;
    align-self: start;
}

.result-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.result-avatar:hover {
    transform: scale(1.05);
}

.result-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--button-primary-bg));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.result-avatar-placeholder:hover {
    transform: scale(1.05);
    text-decoration: none;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #44b700;
    border: 3px solid var(--post-bg);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(68, 183, 0, 0.5);
}

.verified-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid var(--post-bg);
}

.verified-badge svg {
    width: 12px;
    height: 12px;
}

.result-info {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.result-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-name:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.result-name svg {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.result-username {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.result-meta-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.result-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.result-type {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--sidebar-bg);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.result-type.community-public {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
}

.result-type.community-private {
    background: rgba(255, 193, 7, 0.1);
    color: #f59e0b;
}

.result-type.community-closed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.result-bio {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
}

/* Действия */
.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    min-width: 220px;
}

.result-action-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    text-decoration: none;
    min-height: 44px;
}

.result-action-btn:hover {
    text-decoration: none;
}

a.result-action-btn {
    text-decoration: none !important;
}

a.result-action-btn:hover {
    text-decoration: none !important;
}

.result-action-btn svg {
    width: 16px;
    height: 16px;
}

.result-action-btn.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--button-primary-bg));
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
}

.result-action-btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.35);
}

.result-action-btn.btn-secondary {
    background: var(--sidebar-bg);
    border: 1px solid var(--post-border);
    color: var(--text-primary);
}

.result-action-btn.btn-secondary:hover {
    background: var(--input-bg);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.result-action-btn.btn-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.result-action-btn.btn-success:hover {
    background: rgba(34, 197, 94, 0.2);
}

.result-action-btn.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-action-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.result-action-btn.btn-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.result-action-btn.btn-warning:hover {
    background: rgba(251, 191, 36, 0.2);
}

.result-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Загрузить еще */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.load-more-container .btn {
    min-width: 200px;
}

/* Адаптивность */
@media (max-width: 1100px) {
    .result-card {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .result-actions {
        grid-column: 2;
        justify-content: flex-start;
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .search-header {
        padding: 1.5rem 0 1rem;
    }

    .search-title-section h1 {
        font-size: 1.5rem;
    }

    .search-input {
        padding: 0.75rem 2.5rem;
        font-size: 0.9375rem;
    }

    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: none;
    }

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
    }

    .filter-sort {
        width: 100%;
    }

    .sort-button {
        width: 100%;
        justify-content: space-between;
    }

    .sort-menu {
        left: 0;
        right: 0;
    }

    .result-card {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .result-avatar-wrapper {
        align-self: center;
    }

    .result-info {
        text-align: center;
        width: 100%;
    }

    .result-name {
        justify-content: center;
    }

    .result-meta {
        justify-content: center;
    }

    .result-actions {
        width: 100%;
        flex-direction: column;
    }

    .result-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .search-title-section h1 {
        font-size: 1.25rem;
    }

    .search-subtitle {
        font-size: 0.875rem;
    }

    .result-avatar,
    .result-avatar-placeholder {
        width: 50px;
        height: 50px;
    }

    .result-card {
        padding: 1rem;
    }
}
