/* NGO List Page Enhancements */

/* Responsive card adjustments */
@media (max-width: 768px) {
    .ngo-card-content {
        padding: 1rem;
    }
    
    .impact-metrics {
        justify-content: center;
    }
    
    .view-toggle {
        order: 2;
        margin-top: 1rem;
    }
    
    .list-view .ngo-card {
        flex-direction: column;
    }
    
    .list-view .ngo-card-image {
        width: 100%;
        height: 180px;
    }
    
    /* Adjust badge sizes on mobile */
    .featured-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .distance-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* View toggle buttons */
.view-toggle {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 1px solid var(--border-color);
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn.active {
    background: var(--btn-primary);
    color: white;
}

.view-toggle-btn:hover:not(.active) {
    background: var(--bg-secondary);
}


/* Impact metrics */
.impact-metrics {
    display: flex;
    gap: 0.6rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.impact-metric {
    background: var(--bg-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.3s ease;
}

.impact-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

/* Improved filter section */
.filter-section {
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

/* Category badges enhancement */
.category-badge {
    position: relative;
    overflow: hidden;
}

.category-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.category-badge:hover::before {
    left: 100%;
}


/* Smooth transitions for view changes */
.ngo-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px !important;
    overflow: hidden;
}

/* Ensure image container matches card radius */
.ngo-card .ngo-card-image {
    border-radius: 12px 12px 0 0;
    margin: -1px -1px 0 -1px; /* Compensate for card border */
}

/* NGO Card Image */
.ngo-card-image {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 11px 11px 0 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
}

/* NGO Card Content */
.ngo-card-content {
    padding: 1.25rem;
}

/* Fix for Bootstrap card class conflicts */
.ngo-card.card {
    border-radius: 12px !important;
}

/* Ensure images inside cards respect border radius */
.ngo-card img {
    border-radius: inherit;
}

/* Grid to list transition */
.list-view .ngo-card {
    transform: none !important;
}

/* Enhanced pagination */
.pagination .page-link {
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 2px;
}

.pagination .page-link:hover {
    transform: translateY(-2px);
}

/* Search input enhancements */
.form-control:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

/* Featured NGO badge - positioned on the image */
.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    animation: pulse 2s infinite;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ensure featured badge is visible on image container */
.ngo-card-image {
    position: relative;
}

.ngo-card-image .featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Distance badge for nearby NGOs */
.distance-badge {
    background: var(--btn-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

/* When both badges are present, adjust positioning */
.ngo-card.has-featured .distance-badge {
    top: 40px; /* Move distance badge down when featured badge is present */
}

/* For cards in modal (nearby NGOs) */
.modal .ngo-card .featured-badge {
    position: static;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.modal .ngo-card .distance-badge {
    position: static;
    display: inline-block;
    margin-left: auto;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* No results state */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
}

.no-results .display-1 {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Accessibility improvements */
.view-toggle-btn:focus {
    outline: 2px solid var(--btn-primary);
    outline-offset: 2px;
}

/* Clickable card styling */
.ngo-card {
    cursor: pointer;
}

a:has(.ngo-card) {
    color: inherit;
}

a:has(.ngo-card):hover {
    text-decoration: none;
}

/* Print styles */
@media print {
    .filter-section,
    .pagination,
    .view-toggle {
        display: none;
    }
    
    .ngo-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* Dark mode specific adjustments */
[data-theme="dark"] .loading-skeleton {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
}

[data-theme="dark"] .impact-metric {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .ngo-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
}