/**
 * Smart Search Styles - Premium UI/UX
 * Glassmorphism + Modern animations
 */

/* Inline Search Container */
.inline-search-container {
    width: 100%;
    margin-top: 1.25rem;
}

.smart-search {
    position: relative;
    max-width: 100%;
    margin: 0;
    padding: 0;
    z-index: 100;
}

/* Search Input Wrapper - Premium Glass Effect */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(20, 20, 25, 0.9) 0%, rgba(15, 15, 20, 0.95) 100%);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-input-wrapper:hover {
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.35),
        0 0 20px rgba(0, 255, 136, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.search-input-wrapper:focus-within {
    border-color: var(--green-bright);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(0, 255, 136, 0.15),
        0 0 60px rgba(0, 255, 136, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    color: var(--text-dim);
    pointer-events: none;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.search-input-wrapper:hover .search-icon {
    opacity: 0.8;
}

.search-input-wrapper:focus-within .search-icon {
    color: var(--green-bright);
    opacity: 1;
    transform: scale(1.05);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1rem 1rem 3.25rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    outline: none;
    letter-spacing: 0.02em;
}

.search-input::placeholder {
    color: var(--text-dim);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.search-input:focus::placeholder {
    opacity: 0.4;
}

.search-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 0.5rem;
    margin-right: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    pointer-events: none;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within .search-kbd {
    opacity: 0;
}

/* Search Results Dropdown - Premium Glass */
.search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(18, 18, 24, 0.98) 0%, rgba(12, 12, 16, 0.99) 100%);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 16px;
    max-height: 420px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(24px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 255, 136, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Custom Scrollbar */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.search-results::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--green-dim) 0%, transparent 100%);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--green-bright);
}

/* Search Sections */
.search-section {
    padding: 0.75rem 0;
}

.search-section:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--green-bright);
    font-family: var(--font-mono);
    opacity: 0.8;
}

/* Result Items - Premium Hover */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 2px solid transparent;
    margin: 0 0.5rem;
    border-radius: 10px;
}

.search-result-item:hover {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.1) 0%, rgba(0, 255, 136, 0.02) 100%);
    border-left-color: var(--green-bright);
    transform: translateX(4px);
}

.search-result-item.selected {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 255, 136, 0.03) 100%);
    border-left-color: var(--green-bright);
}

.result-icon {
    font-size: 1.5rem;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.search-result-item:hover .result-icon {
    background: rgba(0, 255, 136, 0.1);
    transform: scale(1.05);
}

.result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.result-title mark {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.4) 0%, rgba(0, 255, 136, 0.2) 100%);
    color: var(--green-bright);
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-weight: 600;
}

.result-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Result Type Badges - Premium */
.result-type {
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tag-type {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2) 0%, rgba(0, 255, 136, 0.1) 100%);
    color: var(--green-bright);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.category-type {
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.2) 0%, rgba(255, 200, 0, 0.1) 100%);
    color: #ffc800;
    border: 1px solid rgba(255, 200, 0, 0.3);
}

.post-type {
    background: linear-gradient(135deg, rgba(100, 150, 255, 0.2) 0%, rgba(100, 150, 255, 0.1) 100%);
    color: #6496ff;
    border: 1px solid rgba(100, 150, 255, 0.3);
}

/* Empty State */
.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    filter: grayscale(0.5);
}

.empty-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.empty-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .smart-search {
        margin: 0.75rem 0 1rem;
        padding: 0 0.75rem;
    }

    .search-input-wrapper {
        border-radius: 14px;
    }

    .search-input {
        font-size: 16px;
        /* Prevents iOS zoom */
        padding: 0.875rem 1rem 0.875rem 3rem;
    }

    .search-icon {
        left: 1rem;
    }

    .search-kbd {
        display: none;
    }

    .search-results {
        max-height: 65vh;
        border-radius: 14px;
    }

    .search-result-item {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .result-icon {
        min-width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }

    .result-title {
        font-size: 0.85rem;
    }

    .result-meta {
        display: none;
    }

    .result-type {
        padding: 0.25rem 0.5rem;
        font-size: 0.55rem;
    }
}

/* Animations */
@keyframes searchGlow {

    0%,
    100% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 30px rgba(0, 255, 136, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(0, 255, 136, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
}

.search-input-wrapper:focus-within {
    animation: searchGlow 2.5s ease-in-out infinite;
}

/* Stagger animation for results */
.search-result-item {
    animation: slideIn 0.2s ease forwards;
    opacity: 0;
}

.search-result-item:nth-child(1) {
    animation-delay: 0.02s;
}

.search-result-item:nth-child(2) {
    animation-delay: 0.04s;
}

.search-result-item:nth-child(3) {
    animation-delay: 0.06s;
}

.search-result-item:nth-child(4) {
    animation-delay: 0.08s;
}

.search-result-item:nth-child(5) {
    animation-delay: 0.10s;
}

.search-result-item:nth-child(6) {
    animation-delay: 0.12s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}