/* Custom Product Search Form Styles */
.custom-product-search-wrapper {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Error Message */
.search-error-message {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    color: #856404;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.2);
}

.search-error-message p {
    margin: 0;
    font-size: 16px;
    line-height: 1.8;
}

.search-error-message strong {
    color: #664d03;
}

.search-error-message ul {
    list-style: none;
    padding: 0;
}

.search-error-message li {
    padding: 8px 0;
    color: #664d03;
}

.search-error-message code {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e91e63;
    border: 1px solid #ffd966;
}

.custom-search-form {
    width: 100%;
}

.search-form-fields {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #A2A2A2;
    padding: 15px 20px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    height: 114px;
}

.search-field {
    flex: 1;
    position: relative;
}

.search-field select {
    width: 100%;
    padding: 12px 40px 12px 20px;
    border: 1px solid #F9F9F9;
    border-radius: 6px;
    font-size: 14px;
    background-color: #606060;
    color: #ffffff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
    font-family: inherit;
    direction: rtl;
    text-align: right;
    transition: all 0.3s ease;
}

.search-field select:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-field select:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Custom dropdown arrow */
.search-field::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    pointer-events: none;
}

.search-submit-btn {
    padding: 12px 35px;
    background-color: #FA003F;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.search-submit-btn:active {
    transform: translateY(0);
}

/* Loading Spinner */
.search-loading {
    text-align: center;
    padding: 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search Results Popup */
.search-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.popup-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popupSlideIn 0.4s ease;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: #e91e63;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.popup-close:hover {
    background: #c2185b;
    transform: rotate(90deg);
}

.popup-title {
    text-align: center;
    margin: 0 0 30px 0;
    font-size: 28px;
    color: #333;
    font-weight: bold;
}

.results-container {
    margin-top: 20px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.product-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.product-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f5f5f5;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-item:hover .product-image img {
    transform: scale(1.1);
}

.product-title {
    padding: 15px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: right;
    line-height: 1.4;
}

.product-price {
    padding: 0 15px 15px;
    text-align: right;
    font-size: 18px;
    font-weight: bold;
    color: #e91e63;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

.no-results details {
    margin-top: 20px;
    text-align: right;
    direction: rtl;
}

.no-results summary {
    cursor: pointer;
    color: #667eea;
    font-size: 14px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
    outline: none;
    transition: all 0.3s ease;
}

.no-results summary:hover {
    background: #e8e8e8;
}

.no-results pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    margin-top: 10px;
    border-radius: 5px;
    overflow: auto;
    text-align: left;
    direction: ltr;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    max-height: 300px;
}

/* Body class when popup is open */
body.popup-open {
    overflow: hidden;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .search-form-fields {
        flex-direction: column;
        border-radius: 25px;
        padding: 15px;
    }
    
    .search-field {
        width: 100%;
    }
    
    .search-submit-btn {
        width: 100%;
        padding: 14px 35px;
    }
    
    .popup-content {
        width: 95%;
        max-height: 90vh;
        padding: 20px 15px;
    }
    
    .popup-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-title {
        font-size: 14px;
        padding: 10px;
    }
    
    .product-price {
        font-size: 16px;
        padding: 0 10px 10px;
    }

    .search-form-fields {
        height: 205px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-image {
        height: 220px;
    }
}

/* Custom Scrollbar for Popup */
.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.popup-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

