/**
 * Reza Woo Product Search - Frontend Stylesheet
 */

.reza-woo-search-container {
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.reza-woo-search-container.reza-align-left {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.reza-woo-search-container.reza-align-center {
    margin-left: auto !important;
    margin-right: auto !important;
}

.reza-woo-search-container.reza-align-right {
    margin-left: auto !important;
    margin-right: 0 !important;
}

.reza-woo-search-container *,
.reza-woo-search-container *::before,
.reza-woo-search-container *::after {
    box-sizing: border-box;
}

.reza-woo-search-form {
    position: relative;
    width: 100%;
    margin: 0;
}

.reza-search-form-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* Category Select Wrap */
.reza-search-category-wrap {
    flex-shrink: 0;
}

.reza-cat-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%20%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    padding-left: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reza-cat-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Search Input Wrap */
.reza-search-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.reza-search-input-wrap input[type='search'] {
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Clear Button */
.reza-search-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.reza-search-clear-btn:hover {
    color: #374151;
}

/* Spinner */
.reza-search-spinner {
    position: absolute;
    right: 12px;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: reza-spin 0.6s linear infinite;
}

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

/* Search Button */
.reza-search-button-wrap {
    flex-shrink: 0;
}

.reza-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.reza-search-button:active {
    transform: translateY(1px);
}

.reza-search-icon {
    display: inline-block;
    vertical-align: middle;
}

/* Live AJAX Results Dropdown */
.reza-woo-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    max-height: 420px;
    overflow-y: auto;
    padding: 6px 0;
}

.reza-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

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

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

.reza-result-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background-color: #f3f4f6;
}

.reza-result-info {
    flex: 1;
    min-width: 0;
}

.reza-result-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}

.reza-result-sku {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.reza-result-price {
    font-size: 13px;
    font-weight: 700;
    color: #2563eb;
}

.reza-search-result-view-all {
    display: block;
    padding: 12px 16px;
    text-align: center;
    background-color: #f9fafb;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
}

.reza-search-result-view-all:hover {
    background-color: #f3f4f6;
    text-decoration: underline;
}

.reza-search-no-results {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* Responsive Layout Breakpoints */
@media (max-width: 768px) {
    .reza-search-form-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .reza-search-category-wrap,
    .reza-cat-select,
    .reza-search-button-wrap,
    .reza-search-button {
        width: 100% !important;
    }
}
