﻿/*
 * Profile Search Component Styles
 * Используется для страниц подписчиков/подписок
 * Переиспользует CSS переменные из основной темы Craftbox
 */

/* Search Header Section */
.search-header {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

    .search-header h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--text);
    }

/* Search Box Container */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: none;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
}

/* Search Input Field */
.search-input {
    width: 100%;
    max-width: none;
    padding: 12px 42px 12px 44px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .search-input::placeholder {
        color: var(--muted);
    }

    .search-input:focus {
        border-color: var(--brand);
        box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
    }

/* Clear Button */
.search-clear {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .search-clear:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--text);
    }

[data-theme="dark"] .search-clear:hover {
    background: rgba(255, 255, 255, 0.08);
}

.search-clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}

.search-clear svg {
    width: 18px;
    height: 18px;
}

/* Loading Spinner */
.search-loading {
    position: absolute;
    right: 46px;
    display: none;
    width: 20px;
    height: 20px;
}

    .search-loading.visible {
        display: block;
    }

    .search-loading::after {
        content: '';
        display: block;
        width: 16px;
        height: 16px;
        border: 2px solid var(--border);
        border-top-color: var(--brand);
        border-radius: 50%;
        animation: search-spin 0.6s linear infinite;
    }

@keyframes search-spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Results Message */
.no-results {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
    display: none;
}

    .no-results.visible {
        display: block;
    }

    .no-results svg {
        width: 48px;
        height: 48px;
        margin: 0 auto 16px;
        opacity: 0.3;
    }

    .no-results p {
        margin: 0;
        font-size: 16px;
    }

/* Profile Row Modifications */
.profile-row.hidden {
    display: none;
}

/* Highlight для найденного текста */
.name mark,
.bio mark {
    background: rgba(0, 113, 227, 0.2);
    color: var(--brand);
    padding: 1px 2px;
    border-radius: 3px;
}

[data-theme="dark"] .name mark,
[data-theme="dark"] .bio mark {
    background: rgba(0, 113, 227, 0.3);
}

/* Responsive Design */
@media (max-width: 640px) {
    .search-header {
        padding: 16px 0;
    }

    .search-input {
        font-size: 16px; /* Предотвращает zoom на iOS */
        padding: 11px 42px 11px 44px;
    }

    .no-results {
        padding: 40px 16px;
    }
}

/* Accessibility */
.search-input:focus-visible {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}

/* Prevent iOS zoom on focus */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input[type="text"],
    input[type="search"] {
        font-size: 16px;
    }
}
