/* ========================================
   Smart Pi E-Commerce - Search Styles
   ======================================== */

/* Desktop Search Modal */
.search-modal {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    margin-top: 0.5rem;
    z-index: 50;
    max-height: 70vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
    min-width: 500px;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dark .search-modal {
    background: #374151;
    border-color: #4b5563;
}

/* Desktop Search Results */
.search-result-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.dark .search-result-card {
    background: #4b5563;
    border-color: #6b7280;
}

.dark .search-result-card:hover {
    border-color: #9ca3af;
}

.search-result-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-placeholder {
    width: 60px;
    height: 60px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dark .search-result-placeholder {
    background: #6b7280;
}

.search-result-title {
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.dark .search-result-title {
    color: #f9fafb;
}

.search-result-price {
    color: #059669;
    font-weight: 600;
    font-size: 0.875rem;
}

.dark .search-result-price {
    color: #10b981;
}

.search-result-description {
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.4;
    margin-top: 0.5rem;
}

.dark .search-result-description {
    color: #9ca3af;
}

/* Search Section Headers */
.search-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.dark .search-section-header {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

.search-section-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Mobile Search Modal */
.mobile_search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    padding: 1rem;
    padding-top: 6rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile_search-modal.active {
    opacity: 1;
    visibility: visible;
}

.mobile_search-modal > div:first-child {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.dark .mobile_search-modal > div:first-child {
    background: #374151;
}

/* Mobile Search Input Container */
.mobile-search-input-container {
    background: #f3f4f6;
    border-radius: 2rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.dark .mobile-search-input-container {
    background: #4b5563;
}

.mobile-search-input {
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    color: #374151;
    font-size: 1rem;
}

.dark .mobile-search-input {
    color: #d1d5db;
}

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

.dark .mobile-search-input::placeholder {
    color: #6b7280;
}

/* Mobile Search Results */
.mobile-search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    margin-bottom: 0.5rem;
}

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

.dark .mobile-search-result:hover {
    background: #4b5563;
}

.mobile-search-result-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.mobile-search-result-placeholder {
    width: 40px;
    height: 40px;
    background: #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dark .mobile-search-result-placeholder {
    background: #6b7280;
}

.mobile-search-result-content {
    flex: 1;
    min-width: 0;
}

.mobile-search-result-title {
    font-weight: 500;
    color: #111827;
    font-size: 0.875rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark .mobile-search-result-title {
    color: #f9fafb;
}

.mobile-search-result-price {
    color: #059669;
    font-weight: 600;
    font-size: 0.75rem;
}

.dark .mobile-search-result-price {
    color: #10b981;
}

/* Search Loading State */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.dark .search-loading {
    color: #9ca3af;
}

.search-loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

.dark .search-loading-spinner {
    border-color: #4b5563;
    border-top-color: #60a5fa;
}

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

/* Search No Results */
.search-no-results {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.dark .search-no-results {
    color: #9ca3af;
}

.search-no-results-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

.dark .search-no-results-icon {
    color: #6b7280;
}

/* Search Popular Items */
.search-popular-item {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 1rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin: 0.25rem;
    transition: all 0.2s ease;
}

.dark .search-popular-item {
    background: #4b5563;
    color: #d1d5db;
}

.search-popular-item:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

/* Search View All Link */
.search-view-all {
    display: block;
    text-align: center;
    padding: 1rem;
    color: #3b82f6;
    font-weight: 500;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
    margin-top: 1rem;
    transition: color 0.2s ease;
}

.dark .search-view-all {
    border-top-color: #4b5563;
    color: #60a5fa;
}

.search-view-all:hover {
    color: #1d4ed8;
}

.dark .search-view-all:hover {
    color: #3b82f6;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .search-modal {
        min-width: auto;
        left: -1rem;
        right: -1rem;
        margin-top: 0.25rem;
        border-radius: 8px;
    }
    
    .search-result-card {
        padding: 0.75rem;
    }
    
    .search-result-image,
    .search-result-placeholder {
        width: 50px;
        height: 50px;
    }
}

/* Exact Match Highlighting */
.search-exact-match {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.dark .search-exact-match {
    background: #064e3b;
    border-color: #065f46;
}

/* Search Input Focus States */
.search-btn-open input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mobile-search-input:focus {
    outline: none;
}

/* Smooth Scrollbar for Search Results */
.search-modal::-webkit-scrollbar {
    width: 6px;
}

.search-modal::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

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

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

.dark .search-modal::-webkit-scrollbar-track {
    background: #475569;
}

.dark .search-modal::-webkit-scrollbar-thumb {
    background: #64748b;
}

.dark .search-modal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
