/**
 * Shine GPL - Modern Live AJAX Search Styles
 *
 * Strict Compliance:
 * - Dynamic Theme Color Tokens (Shine GPL Settings)
 * - Zero Emojis (Pure Vector SVG)
 * - 120Hz GPU-Accelerated Cubic-Bezier Animations
 */

/* ==========================================================================
   1. Search Input Container Modifications
   ========================================================================== */
.shine-header-search-wrap,
.shine-mobile-search-box {
    position: relative !important;
}

.shine-header-search-form {
    position: relative !important;
}

/* Spinner & Clear Button Wrapper inside Input */
.shine-ajax-search-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Rotating SVG Loading Spinner */
.shine-ajax-spinner {
    display: none;
    width: 18px;
    height: 18px;
    color: var(--shine-primary, #10B981);
    animation: shine-search-spin 0.75s linear infinite;
    transform: translateZ(0);
}

.shine-header-search-form.is-searching .shine-ajax-spinner {
    display: block;
}

@keyframes shine-search-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Hide native browser search cancel button in WebKit/Blink */
.shine-hdr-search-input::-webkit-search-cancel-button,
.shine-hdr-search-input::-webkit-search-decoration,
.shine-hdr-search-input::-webkit-search-results-button,
.shine-hdr-search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

/* Quick Clear "X" Button */
.shine-ajax-clear-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--shine-primary-10, rgba(16, 185, 129, 0.10));
    color: var(--shine-secondary, #64748b);
    border: 1px solid var(--shine-primary-20, rgba(16, 185, 129, 0.20));
    padding: 0;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.shine-ajax-clear-btn:hover {
    color: var(--shine-primary, #10B981);
    background: var(--shine-primary-20, rgba(16, 185, 129, 0.20));
    border-color: var(--shine-primary, #10B981);
    transform: scale(1.08);
}

.shine-header-search-form.has-input .shine-ajax-clear-btn {
    display: flex;
}

/* ==========================================================================
   2. Floating Live Search Results Dropdown
   ========================================================================== */
.shine-ajax-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--shine-white, #ffffff);
    border: 1px solid var(--shine-primary-20, rgba(16, 185, 129, 0.20));
    border-radius: 16px;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.16), 0 0 0 1px var(--shine-primary-12, rgba(16, 185, 129, 0.12));
    z-index: 999999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.985);
    transform-origin: top center;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.shine-ajax-results-dropdown.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Dropdown Header Bar */
.shine-ajax-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--shine-primary-5, rgba(16, 185, 129, 0.05));
    border-bottom: 1px solid var(--shine-primary-10, rgba(16, 185, 129, 0.10));
}

.shine-ajax-header-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--shine-secondary, #64748b);
    display: flex;
    align-items: center;
    gap: 6px;
}

.shine-ajax-header-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--shine-primary-15, rgba(16, 185, 129, 0.15));
    color: var(--shine-primary, #10B981);
    padding: 2px 7px;
    border-radius: 999px;
}

/* Results Scroll List */
.shine-ajax-results-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

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

.shine-ajax-results-list::-webkit-scrollbar-track {
    background: transparent;
}

.shine-ajax-results-list::-webkit-scrollbar-thumb {
    background: var(--shine-primary-20, rgba(16, 185, 129, 0.20));
    border-radius: 999px;
}

/* Individual Result Row */
.shine-ajax-item-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    text-decoration: none !important;
    color: inherit;
    transition: background 0.15s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 3px solid transparent;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.shine-ajax-item-link:hover,
.shine-ajax-item-link.is-selected {
    background: var(--shine-primary-8, rgba(16, 185, 129, 0.08));
    border-left-color: var(--shine-primary, #10B981);
}

.shine-ajax-item-link:hover .shine-ajax-item-arrow,
.shine-ajax-item-link.is-selected .shine-ajax-item-arrow {
    transform: translateX(3px);
    color: var(--shine-primary, #10B981);
}

/* Result Thumbnail */
.shine-ajax-thumb-wrap {
    width: 54px;
    height: 34px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--shine-primary-10, rgba(16, 185, 129, 0.10));
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shine-ajax-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shine-ajax-thumb-fallback {
    color: var(--shine-primary, #10B981);
    opacity: 0.7;
}

/* Result Details */
.shine-ajax-item-info {
    flex: 1;
    min-width: 0;
}

.shine-ajax-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--shine-black, #0f172a);
    line-height: 1.35;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Keyword Match Highlight */
.shine-ajax-hl {
    background: var(--shine-primary-15, rgba(16, 185, 129, 0.15)) !important;
    color: var(--shine-primary, #10B981) !important;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 3px;
}

/* Meta Badges Row */
.shine-ajax-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--shine-secondary, #64748b);
}

.shine-ajax-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--shine-primary-8, rgba(16, 185, 129, 0.08));
    color: var(--shine-primary, #10B981);
}

.shine-ajax-badge.is-theme {
    background: var(--shine-primary-8, rgba(16, 185, 129, 0.08));
    color: var(--shine-primary, #10B981);
}

.shine-ajax-badge.is-plugin {
    background: var(--shine-primary-10, rgba(16, 185, 129, 0.10));
    color: var(--shine-primary, #10B981);
}

.shine-ajax-version {
    font-weight: 600;
    color: var(--shine-secondary, #64748b);
}

.shine-ajax-updated {
    font-size: 10.5px;
    color: var(--shine-secondary, #64748b);
}

/* Right Badge / Price & Arrow */
.shine-ajax-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.shine-ajax-price-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--shine-primary-10, rgba(16, 185, 129, 0.10));
    color: var(--shine-primary, #10B981);
    border: 1px solid var(--shine-primary-20, rgba(16, 185, 129, 0.20));
}

.shine-ajax-price-pill.is-vip {
    background: var(--shine-primary-15, rgba(16, 185, 129, 0.15));
    color: var(--shine-primary, #10B981);
    border-color: var(--shine-primary-30, rgba(16, 185, 129, 0.30));
}

.shine-ajax-item-arrow {
    color: var(--shine-secondary, #94a3b8);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dropdown Footer: View All Link */
.shine-ajax-dropdown-footer {
    border-top: 1px solid var(--shine-primary-10, rgba(16, 185, 129, 0.10));
}

.shine-ajax-view-all-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--shine-primary-5, rgba(16, 185, 129, 0.05));
    color: var(--shine-primary, #10B981) !important;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none !important;
    transition: background 0.15s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
}

.shine-ajax-view-all-link:hover {
    background: var(--shine-primary-12, rgba(16, 185, 129, 0.12));
    color: var(--shine-link-hover, #059669) !important;
}

.shine-ajax-view-all-link svg {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.shine-ajax-view-all-link:hover svg {
    transform: translateX(4px);
}

/* Empty State */
.shine-ajax-empty-state {
    padding: 32px 20px;
    text-align: center;
}

.shine-ajax-empty-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 12px auto;
    color: var(--shine-secondary, #94a3b8);
    opacity: 0.6;
}

.shine-ajax-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--shine-black, #0f172a);
    margin: 0 0 6px 0;
}

.shine-ajax-empty-subtitle {
    font-size: 12px;
    color: var(--shine-secondary, #64748b);
    margin: 0;
}

/* ==========================================================================
   3. Mobile Drawer Responsive Adjustments
   ========================================================================== */
@media (max-width: 900px) {
    .shine-mobile-search-box .shine-ajax-results-dropdown {
        top: calc(100% + 6px);
        max-height: 360px;
    }

    .shine-ajax-item-link {
        padding: 9px 12px;
        gap: 10px;
    }

    .shine-ajax-thumb-wrap {
        width: 48px;
        height: 30px;
    }

    .shine-ajax-item-title {
        font-size: 13px;
    }
}
