/* ===================================
   Fast AJAX Search - Styles
   =================================== */

/* Search Wrapper */
.fast-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Search Form */
.fast-search-form {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width:300px;
}

.fast-search-input {
    width: 100%;
    padding: 14px 50px 14px 20px;
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.fast-search-input::placeholder {
    color: #9ca3af;
}

/* Search Submit Button */
.search-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.search-submit svg {
    width: 20px;
    height: 20px;
}

/* Loading Indicator */
.search-loading {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 100%;
    height: 100%;
}

.spinner .path {
    stroke: #3b82f6;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Search Results Container */
.fast-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid #e5e7eb;
}

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

.fast-search-results::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 0 12px 12px 0;
}

.fast-search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.fast-search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Results Inner */
.search-results-inner {
    padding: 1px;
}

/* Section Title */
.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    padding: 12px 12px 8px;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Search Result Item */
.search-result-item {
    margin: 4px 0;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.search-result-item a {
    display: flex;
    padding: 5px;
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
    gap: 12px;
    border-radius: 8px;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: #f3f4f6;
}

.search-result-item:hover a,
.search-result-item.active a {
    color: inherit;
}

/* Result Image */
.result-image {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Result Content */
.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 13px;
    font-weight: 400;
    margin: 0 0 4px 0;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: arial;
}

.result-excerpt {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 0 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-price {
    font-size: 16px;
    font-weight: 700;
    color: #059669;
    margin-top: 4px;
}

.result-date {
    font-size: 12px;
    color: #9ca3af;
    display: inline-block;
    margin-top: 4px;
}

/* Product Specific Styles */
.product-item .result-title {
    color: #1f2937;
}

/* Post Specific Styles */
.post-item .result-title {
    color: #1f2937;
}

/* No Results */
.no-results {
    padding: 32px 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* Search Error */
.search-error {
    padding: 32px 20px;
    text-align: center;
    color: #ef4444;
    font-size: 14px;
}

/* Section Separator */
.search-section + .search-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .fast-search-wrapper {
        max-width: 100%;
    }
    
    .fast-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 50px 12px 16px;
    }
    
    .fast-search-results {
        max-height: 400px;
    }
    
    .result-image {
        width: 50px;
        height: 50px;
    }
    
    .result-title {
        font-size: 14px;
    }
    
    .result-excerpt {
        font-size: 12px;
    }
    
    .result-price {
        font-size: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .fast-search-input,
    .search-result-item,
    .search-submit {
        transition: none;
    }
    
    .spinner {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .fast-search-input {
        border-width: 3px;
    }
    
    .search-result-item:hover,
    .search-result-item.active {
        background-color: #dbeafe;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .fast-search-input {
        background: #1f2937;
        color: #f9fafb;
        border-color: #374151;
    }
    
    .fast-search-input::placeholder {
        color: #6b7280;
    }
    
    .fast-search-results {
        background: #1f2937;
        border-color: #374151;
    }
    
    .section-title {
        color: #9ca3af;
    }
    
    .result-title {
        color: #f9fafb;
    }
    
    .result-excerpt {
        color: #9ca3af;
    }
    
    .search-result-item:hover,
    .search-result-item.active {
        background-color: #374151;
    }
}
