/**
 * RW Search Pro - Styles
 */

/* Container */
.rw-search-pro-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 0 0;
    z-index: 1000;
}

/* Search Wrapper */
.rw-search-wrapper {
    position: relative;
}

/* Search Input Wrapper */
.rw-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search Icon */
.rw-search-icon {
    flex-shrink: 0;
    color: #6b7280;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
}

/* Search Input */
.rw-search-input {
    flex: 1;
    outline: none;
    font-size: 16px;
    padding: 0.8rem 1rem;
    color: #1f2937;
    border-radius: 5px;
    border: 1px solid var(--bs-border-color);
    background: #E5E5E5;
}

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

/* Category Filter */
.rw-search-filter {
    flex-shrink: 0;
    display: none;
}

.rw-category-select {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.rw-category-select:hover {
    background: #f3f4f6;
}

.rw-category-select:focus {
    border-color: #3b82f6;
    background: #ffffff;
}

/* Clear Button */
.rw-clear-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    position: absolute;
    right: 47px;
}

.rw-clear-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Search Results */
.rw-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 600px;
    overflow: hidden;
    z-index: 1001;
    min-width: 500px;
}

@media all and (max-width: 560px) {
    .rw-search-results {
        min-width: 100%;
    }
}

.rw-search-results-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.rw-results-count {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Results List */
.rw-search-results-list {
    max-height: 460px;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.rw-search-results-list::-webkit-scrollbar-track {
    background: #f9fafb;
}

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

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

/* Search Footer */
.rw-search-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.rw-view-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: var(--bs-primary) !important;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.rw-view-all-btn:hover {
    background: #2563eb;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.rw-view-all-btn svg {
    flex-shrink: 0;
}

/* Result Item */
.rw-search-result-item {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.rw-search-result-item:hover {
    background: #f9fafb;
}

.rw-search-result-item:last-child {
    border-bottom: none;
}

.rw-result-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
}

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

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

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

.rw-result-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.rw-result-title mark {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 4px;
    border-radius: 3px;
}

.rw-result-reference {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #6b7280;
    font-family: monospace;
}

.rw-result-category {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #3b82f6;
}

.rw-result-description {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Result Price */
.rw-result-price {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    color: #059669;
    white-space: nowrap;
}

/* Loading */
.rw-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.rw-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: rw-spin 0.8s linear infinite;
}

@keyframes rw-spin {
    to {
        transform: rotate(360deg);
    }
}

.rw-search-loading span {
    font-size: 14px;
    color: #6b7280;
}

/* No Results */
.rw-search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.rw-search-no-results svg {
    color: #d1d5db;
}

.rw-search-no-results p {
    margin: 0;
    font-size: 16px;
    color: #6b7280;
}

/* Overlay */
.rw-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* Responsive */
@media (max-width: 768px) {
    .rw-search-pro-container {
        max-width: 100%;
    }

    .rw-search-input-wrapper {
        flex-wrap: wrap;
    }

    .rw-search-filter {
        order: 3;
        flex-basis: 100%;
        margin-top: 8px;
    }

    .rw-category-select {
        width: 100%;
    }

    .rw-result-price {
        align-self: flex-start;
    }

    .rw-search-results {
        max-height: calc(100vh - 50px);
    }

    .rw-search-results-list {
        max-height: calc(100vh - 180px);
    }
}

@media (max-width: 480px) {
    .rw-search-input-wrapper {
        padding: 0;
    }

    .rw-search-input {
        font-size: 14px;
    }

    .rw-result-link {
        padding: 12px 16px;
    }

    .rw-result-title {
        font-size: 15px;
    }

    .rw-result-price {
        font-size: 16px;
    }
}
