/* Enhanced Persian Header Search Styles */
.search-box {
    position: relative;
    display: inline-block;
    width: 100%;
    direction: rtl;
    font-family: iranyekanx, tahoma !important;
}

.search-form {
    margin: 0;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #000;
    padding: 10px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
    cursor: pointer;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 28px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.search-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

#keyword {
    width: 92% !important;
    padding: 14px 16px 14px 50px;
    border: none;
    outline: none;
    font-size: 14px;
    color: #374151;
    background: transparent;
    text-align: right;
    font-family: inherit;
    font-weight: 500;
}

#keyword::placeholder {
    color: #9ca3af;
    text-align: right;
    font-weight: 400;
}

/* Results Box - High Z-Index for Headers */
.content-ajax-search {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    margin-top: 12px;
    z-index: 99999;
    max-height: 450px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    border-top: none;
    display: none;
    overflow-x: hidden;
}

.content-ajax-search.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Container */
.loading-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    margin-top: 12px;
    z-index: 99999;
    padding: 20px;
    backdrop-filter: blur(20px);
    border-top: none;
}

.loading-content {
    text-align: center;
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 20px;
}

.loading-subtext {
    font-size: 14px;
    color: #6b7280;
    margin-top: 15px;
}

.lottie-container {
    width: 100%;
    height: 200px;
    margin: 20px 0;
}

/* Search Results List */
.content-ajax-search ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.content-ajax-search li {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.content-ajax-search li:last-child {
    border-bottom: none;
}

.content-ajax-search li:hover {
    background: #f8fafc;
    transform: translateX(-4px);
}

.content-ajax-search a {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.content-ajax-search .main-img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    margin-left: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.content-ajax-search li:hover .main-img {
    transform: scale(1.05);
}

.content-ajax-search div {
    text-align: right;
}

.content-ajax-search h3 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

.search-price {
    font-size: 13px;
    color: #059669;
    font-weight: 700;
}

/* Search Attributes */
.search-attributes {
    margin-top: 4px;
}

.search-attributes small {
    color: #6b7280;
    font-size: 11px;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* Loading Spinner in Results Box */
.loading-item {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading-item p {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.loading-item .loading-subtext {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

/* Crawl Results */
.crawl-result {
    padding: 20px;
    margin: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.crawl-header {
    text-align: center;
    margin-bottom: 16px;
}

.crawl-header h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    line-height: 1.3;
}

.crawl-content {
    text-align: center;
    margin-bottom: 20px;
}

.crawl-price {
    font-size: 20px;
    color: #059669;
    font-weight: 800;
    margin: 0 0 8px 0;
}

.crawl-old-price {
    font-size: 14px;
    color: #dc2626;
    text-decoration: line-through;
    font-weight: 600;
}

/* Crawl Actions */
.crawl-actions {
    text-align: center;
    margin: 20px 0;
}

.add-to-cart-btn {
    background: linear-gradient(135deg, #623AC1 0%, #8B5CF6 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(98, 58, 193, 0.3);
}

.add-to-cart-btn:hover {
    background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(98, 58, 193, 0.4);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Crawl Images */
.crawl-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.crawl-image {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-img {
    width: 150px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.crawl-image:hover .product-img {
    transform: scale(1.05);
}

/* No Results */
.not-found-search {
    padding: 30px 20px;
    text-align: center;
    color: #6b7280;
}

.not-found-search p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .search-box {
        width: 100%;
    }
    
    .search-form input[type="text"] {
        padding: 12px 16px 12px 45px;
        font-size: 16px;
    }
    
    .search-icon {
        width: 32px;
        height: 32px;
        padding: 8px;
    }
}

/* Scrollbar */
.content-ajax-search::-webkit-scrollbar {
    width: 6px;
}

.content-ajax-search::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.content-ajax-search::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.content-ajax-search::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.row.header{
	padding-top: 12px;
}
#keyword:focus, #keyword:active{
	border: none !important;
}
.loading-item p{
	text-align: center;
}

/* New Crawler Layout - Swiper with Title Beside Image */
.crawl-product-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.crawl-image-section {
    flex: 0 0 auto;
}

/* Swiper Styles */
.crawl-swiper {
    width: 200px !important;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid red !important;
}

.crawl-swiper .swiper-slide {
    text-align: center;
    width: 200px !important;
    border: 1px solid blue !important;
}

.slide-content {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    min-height: 88px !important;
    background: #fbbf24 !important;
    border: 3px solid #92400e !important;
    border-radius: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    margin: 5px !important;
}

.slide-content:before {
    content: "Image Container";
    position: absolute;
    top: 5px;
    left: 5px;
    background: #92400e;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.slide-content .product-img {
    width: 100% !important;
    height: auto !important;
    max-width: 160px !important;
    max-height: 56px !important;
    object-fit: contain !important;
    border-radius: 4px !important;
    display: block !important;
    background: #ef4444 !important;
    min-height: 40px !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1 !important;
    border: 2px solid #000 !important;
}



.crawl-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Product Title */
.crawl-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #000;
    line-height: 1.3;
    text-align: right;
    word-wrap: break-word;
}

/* Minimal Add to Cart Button */
.add-to-cart-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.add-to-cart-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Responsive for new layout */
@media (max-width: 768px) {
    .crawl-product-layout {
        flex-direction: column;
        gap: 16px;
    }
    
    .crawl-image-section {
        flex: none;
        width: 100%;
    }
    
    .crawl-swiper {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .slide-content .product-img {
        max-width: 100%;
        max-height: 100%;
    }
}

/* Debug: Add fallback if image fails to load */
.slide-content .product-img:not([src]), 
.slide-content .product-img[src=""] {
    background: #fbbf24;
    position: relative;
}

.slide-content .product-img:not([src]):after, 
.slide-content .product-img[src=""]:after {
    content: "No Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
}

/* Simple Image Display (No Swiper) */
.crawl-main-image {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.crawl-main-image .product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

/* Show All Button Styling */
.show-all-container {
    margin-top: 15px;
    text-align: center;
    padding: 10px 0;
    border-top: 1px solid #e5e7eb;
}

.show-all-btn {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    border: none;
    cursor: pointer;
}

.show-all-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    color: white;
    text-decoration: none;
}

.show-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

/* Mobile Styles for Crawler Results */
@media (max-width: 768px) {
    .crawl-product-layout {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .crawl-image-section {
        flex-shrink: 0 !important;
        width: 80px !important;
        height: 80px !important;
    }
    
    .crawl-main-image {
        width: 80px !important;
        height: 80px !important;
    }
    
    .crawl-main-image .product-img {
        max-width: 80px !important;
        max-height: 80px !important;
    }
    
    .crawl-product-info {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        min-width: 0 !important;
    }
    
    .crawl-title h3 {
        font-size: 14px !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        word-wrap: break-word !important;
    }
    
    .crawl-price {
        font-size: 14px !important;
        font-weight: 600 !important;
        margin: 0 !important;
    }
    
    .crawl-old-price {
        font-size: 12px !important;
        margin: 0 !important;
    }
    
    .crawl-actions {
        margin-top: auto !important;
    }
    
    .add-to-cart-btn {
        padding: 8px 16px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    
    /* Ensure the layout doesn't break on very small screens */
    @media (max-width: 480px) {
        .crawl-product-layout {
            gap: 8px !important;
        }
        
        .crawl-image-section {
            width: 70px !important;
            height: 70px !important;
        }
        
        .crawl-main-image {
            width: 70px !important;
            height: 70px !important;
        }
        
        .crawl-main-image .product-img {
            max-width: 70px !important;
            max-height: 70px !important;
        }
        
        .crawl-title h3 {
            font-size: 13px !important;
        }
        
        .crawl-price {
            font-size: 13px !important;
        }
        
        .add-to-cart-btn {
            padding: 6px 12px !important;
            font-size: 11px !important;
        }
    }
}