/**
 * Business Listing Template Styles
 * Optimized for performance and mobile-first design
 */

/* Mobile-first responsive design */
.business-listing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.listing-header {
    background: #fff;
    padding: 20px 0;
    text-align: center;
    margin-top: 40px;
}

.listing-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.2;
}

.listing-header p {
    font-size: 0.95rem;
    color: #6c757d;
    margin: 8px 0 0 0;
    font-weight: 400;
}

.breadcrumbs {
    background: #f8f9fa;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.page-title-section {
    margin-bottom: 30px;
    text-align: center;
    padding: 0 10px;
}

.page-title-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.business-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 30px;
    width: 100%;
    min-height: 600px; /* Prevent layout shift */
}

.business-listings {
    margin-bottom: 40px;
}

/* Skeleton loading styles for better perceived performance */
.loading-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.no-businesses-found {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.no-businesses-found h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.no-businesses-found p {
    color: #6c757d;
}

/* Pagination styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 30px 0;
    padding: 20px 0;
}

.pagination-btn {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #007bff;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-btn:hover {
    background: #007bff;
    color: #fff;
    transform: translateY(-1px);
}

.pagination-btn.current {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.pagination-btn:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Load more button */
.load-more-container {
    text-align: center;
    margin: 30px 0;
}

.btn-load-more {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-load-more:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-load-more:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Tablet styles */
@media (min-width: 768px) {
    .business-listing-container {
        padding: 0 30px;
    }
    
    .listing-header {
        padding: 30px 0;
        margin-top: 50px;
    }
    
    .listing-header h1 {
        font-size: 2.4rem;
    }
    
    .listing-header p {
        font-size: 1.1rem;
        margin: 12px 0 0 0;
    }
    
    .breadcrumbs {
        padding: 14px 24px;
        margin-bottom: 25px;
        font-size: 0.95rem;
    }
    
    .page-title-section {
        margin-bottom: 35px;
    }
    
    .page-title-section h2 {
        font-size: 1.8rem;
        margin: 0 0 14px 0;
    }
    
    .verified-badge {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .business-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 24px;
    }
    
    .business-grid .helpbix-listing-card {
        margin-bottom: 0 !important;
    }

    .pagination-container {
        gap: 15px;
    }

    .pagination-btn {
        padding: 12px 18px;
        font-size: 1rem;
    }
}

/* Desktop styles - SINGLE ROW */
@media (min-width: 1024px) {
    .business-listing-container {
        padding: 0 40px;
    }
    
    .listing-header {
        padding: 40px 0;
        margin-top: 60px;
    }
    
    .listing-header h1 {
        font-size: 2.8rem;
    }
    
    .listing-header p {
        font-size: 1.125rem;
        margin: 16px 0 0 0;
    }
    
    .breadcrumbs {
        padding: 16px 32px;
        margin-bottom: 32px;
        font-size: 1rem;
    }
    
    .page-title-section {
        margin-bottom: 40px;
    }
    
    .page-title-section h2 {
        font-size: 2.2rem;
        margin: 0 0 16px 0;
    }
    
    .verified-badge {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    /* FORCE SINGLE COLUMN ON DESKTOP - Override any existing grid layouts */
    .business-grid {
        display: block !important;
        gap: 24px;
        max-width: 100%;
    }
    
    /* Ensure each card takes full width and has proper spacing */
    .business-grid .helpbix-listing-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 24px !important;
        display: block !important;
    }
    
    /* Remove margin from last card */
    .business-grid .helpbix-listing-card:last-child {
        margin-bottom: 0 !important;
    }

    .pagination-container {
        gap: 20px;
    }

    .pagination-btn {
        padding: 14px 20px;
        font-size: 1.1rem;
    }
}

/* Performance optimizations - CLS Prevention */
.business-grid img {
    will-change: transform;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 60px;
    height: 60px;
}

/* Skeleton loading control */
.skeleton-grid {
    position: relative;
    z-index: 1;
}

#business-grid {
    position: relative;
    z-index: 2;
}

.skeleton-removed {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.helpbix-listing-card {
    contain: layout style;
    min-height: 180px; /* Prevent layout shift during loading */
}

/* Trust score circle - prevent layout shift */
.trust-score-circle {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trust-score-svg {
    position: absolute;
    top: 0;
    left: 0;
}

/* Business card layout stability */
.listing-card-header {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.listing-card-content {
    min-height: 100px;
}

.business-meta {
    min-height: 24px;
}

.business-highlights {
    min-height: 48px;
}

/* Critical CSS for above-the-fold content */
.listing-header,
.breadcrumbs,
.page-title-section {
    contain: layout style paint;
}

/* Reduce layout shifts */
.business-grid {
    min-height: 200px;
}

.business-listings {
    min-height: 400px;
}
