/* Search Form Styles */
.search-form {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-group {
    display: flex;
    width: 100%;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: #ffffff;
}

.search-input-group:focus-within {
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
    border-color: #10b981;
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1.5;
    color: #2d3748;
    direction: rtl;
    outline: none;
    min-width: 0;
}

.search-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    border: none;
    background: #10b981;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 56px;
    position: relative;
    overflow: hidden;
}

.search-submit:hover {
    background: #0da271;
    transform: scale(1.05);
}

.search-submit:active {
    transform: scale(0.98);
}

.search-submit:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

.search-submit svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.search-submit:hover svg {
    transform: scale(1.1);
}

/* Live Search Results */
.live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    visibility: hidden;
}

.live-search-results[aria-expanded="true"] {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.live-search-results .search-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: #374151;
    transition: background-color 0.15s ease;
    cursor: pointer;
    gap: 12px;
}

.live-search-results .search-item:hover,
.live-search-results .search-item:focus {
    background-color: #f9fafb;
    outline: none;
}

.live-search-results .search-item:last-child {
    border-bottom: none;
}

.live-search-results .product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.live-search-results .product-info {
    flex: 1;
    min-width: 0;
}

.live-search-results .product-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.live-search-results .product-price {
    font-size: 0.875rem;
    color: #10b981;
    font-weight: 600;
}

.live-search-results .no-results {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 0.9375rem;
}

.live-search-results .search-category {
    padding: 10px 16px;
    background: #f8fafc;
    color: #4b5563;
    font-size: 0.8125rem;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
}

/* Loading State */
.search-input.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 20px;
    padding-left: 40px;
}

/* Dark Mode 
@media (prefers-color-scheme: dark) {
    .search-input-group {
        background: #1f2937;
        border-color: #374151;
    }
    
    .search-input {
        color: #e5e7eb;
        background: transparent;
    }
    
    .search-input::placeholder {
        color: #9ca3af;
    }
    
    .live-search-results {
        background: #1f2937;
        border-color: #374151;
    }
    
    .live-search-results .search-item {
        color: #d1d5db;
        border-bottom-color: #374151;
    }
    
    .live-search-results .search-item:hover,
    .live-search-results .search-item:focus {
        background-color: #374151;
    }
    
    .live-search-results .product-title {
        color: #f3f4f6;
    }
    
    .live-search-results .search-category {
        background: #111827;
        color: #9ca3af;
        border-bottom-color: #374151;
    }
    
    .live-search-results .no-results {
        color: #9ca3af;
    }
}*/

/* Mobile Responsive */
@media (max-width: 767.98px) {
    .search-form {
        max-width: 100%;
        margin: 0;
    }
    
    .search-input {
        padding: 0.45rem 1rem;
        font-size: 0.9375rem;
    }
    
    .search-submit {
        padding: 0 1rem;
        min-width: 48px;
    }
    
    .search-submit svg {
        width: 18px;
        height: 18px;
    }
    
    .live-search-results {
        position: fixed;
        top: 120px;
        left: 16px;
        right: 16px;
        max-height: 60vh;
        border-radius: 8px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .search-input-group,
    .search-submit,
    .search-submit svg,
    .live-search-results {
        transition: none;
    }
    
    .search-input-group:focus-within {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .search-input-group {
        border: 2px solid #000000;
    }
    
    .search-input {
        border: 1px solid #000000;
    }
    
    .live-search-results {
        border: 2px solid #000000;
    }
    
    .search-item {
        border-bottom: 2px solid #000000 !important;
    }
}

/* Print Styles */
@media print {
    .search-form {
        display: none !important;
    }
}

/* Focus Styles for Accessibility */
.search-input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-submit:focus-visible {
    outline: 3px solid #10b981;
    outline-offset: 2px;
}

/* Custom Scrollbar for Results */
.live-search-results::-webkit-scrollbar {
    width: 8px;
}

.live-search-results::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.live-search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.live-search-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading Animation */
@keyframes searchLoading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 50%;
    border-top-color: #10b981;
    animation: searchLoading 1s ease-in-out infinite;
}

/* Voice Search Support */
.search-input::-webkit-speech-button {
    display: none;
}