/* Search Results Styling */
.search-header {
    margin-bottom: 2rem;
    text-align: center;
}

.search-header h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.search-results-list-sortbar {
    max-width: 800px;
    margin: auto;
}

#sort-dropdown {
    cursor: pointer;
}

.listing-card {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.listing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.listing-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.listing-image {
    flex-shrink: 0;
}

.listing-img-container {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.listing-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.listing-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.listing-info {
    min-width: 0; /* Allows text to truncate properly */
}

.listing-name {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.listing-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: 120px;
}

.site-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.site-display-with-logo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sold-by-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.shop-logo {
    max-height: 100px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.listing-price {
    text-align: right;
}

.price-text {
    color: #28a745;
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
}

/* No results styling */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-results h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Error message styling */
.error-message {
    text-align: center;
    padding: 2rem 1rem;
    color: #dc3545;
}

.error-message h3 {
    margin-bottom: 1rem;
}

/* Action buttons for search results */
.listing-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.listing-action-btn {
    background: linear-gradient(145deg, #ff6b00, #ff7d1a);
    color: white !important;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(255, 107, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    cursor: pointer;
    font-size: 1rem;
    outline: none;
}

.listing-action-btn:hover {
    background: linear-gradient(145deg, #ff7d1a, #ff8c2b);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.listing-action-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(255, 107, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.details-btn {
    /* Optionally, a different color for details */
}

.external-btn {
    /* Optionally, a different color for external, or keep same for consistency */
}

/* Responsive design */
@media (max-width: 768px) {
    .listing-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        text-align: left;
    }
    
    .listing-image {
        order: 1;
        width: 100%;
    }
    
    .listing-img-container {
        width: 100%;
        height: 0;
        padding-bottom: 75%; /* 4:3 aspect ratio */
        position: relative;
        background: #f8f9fa;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .listing-img-container img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    .listing-details {
        order: 2;
        width: 100%;
        gap: 0.75rem;
    }
    
    .listing-name {
        font-size: 1.25rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
    }
    
    .listing-right {
        order: 3;
        width: 100%;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        gap: 0.75rem;
    }
    
    .listing-price {
        text-align: left;
        order: 1;
    }
    
    .price-text {
        font-size: 1.4rem;
        font-weight: 700;
        color: #28a745;
    }
    
    .site-display-with-logo {
        justify-content: flex-end;
        order: 2;
        margin-bottom: 0;
        gap: 0.75rem;
    }
    
    .sold-by-label {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-secondary);
    }
    
    .shop-logo {
        max-height: 100px;
        max-width: 120px;
    }
    
    .listing-actions {
        order: 4;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .listing-action-btn {
        width: 100%;
        font-size: 1rem;
        padding: 12px 0;
        font-weight: 600;
    }
    
    .listing-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .listing-card {
        background: var(--background-primary);
        border-color: var(--border-color);
    }
    
    .listing-card:hover {
        border-color: #007bff;
    }
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-container button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        align-items: center;
    }
    
    .pagination-container button {
        min-width: 44px;
        height: 44px;
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .pagination-container .btn-outline-primary {
        padding: 0.5rem 0.75rem;
    }
}

#search-results-wrapper {
    min-height: 100vh;
    position: relative;
    width: 100%;
}

#spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 500px;
    z-index: 10;
    background: none;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

@media (max-width: 768px) {
    #spinner {
        min-height: 350px;
    }
}
