/**
 * Optimized CSS for archive pages
 * Mobile-first approach with minimal footprint
 */

/* Mobile-first Grid System */
.location-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    margin-bottom: 2rem;
}

/* Tablet and up */
@media (min-width: 768px) {
    .location-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .location-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* Optimized Card Styles */
.destination-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.destination-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Optimized Images */
.destination-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

@media (min-width: 768px) {
    .destination-image {
        height: 220px;
    }
}

.destination-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.destination-card:hover .destination-image img {
    transform: scale(1.05);
}

/* Placeholder for missing images */
.destination-image.no-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.destination-image.no-image::after {
    content: "📷";
    font-size: 2rem;
    opacity: 0.3;
}

/* Optimized Badge */
.destination-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--secondary-color, #ffc107);
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    backdrop-filter: blur(8px);
}

.destination-badge .dashicons {
    font-size: 0.9rem;
    width: 0.9rem;
    height: 0.9rem;
}

/* Optimized Content */
.destination-content {
    padding: 1.25rem;
}

.destination-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    color: var(--primary-color, #1a3c5e);
}

.destination-excerpt {
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9rem;
}

.destination-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
}

@media (min-width: 768px) {
    .destination-info {
        flex-direction: row;
        gap: 1rem;
    }
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.info-item .dashicons {
    font-size: 0.9rem;
    color: var(--secondary-color, #ffc107);
}

/* Optimized Filter Styles */
.location-filter-section {
    padding: 1.5rem 0;
    scroll-margin-top: 80px;
}

.filter-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.filter-btn {
    background: #f8f9fa;
    border: none;
    color: #495057;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-btn:hover {
    background: #e9ecef;
    color: #212529;
}

.filter-btn.active {
    background: var(--primary-color, #1a3c5e);
    color: white;
}

.filter-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.filter-btn.loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.4rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optimized Pagination */
.pagination-wrapper {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem 0;
}

.pagination-wrapper .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-wrapper .page-numbers a,
.pagination-wrapper .page-numbers span {
    display: inline-block;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
    font-size: 0.9rem;
}

.pagination-wrapper .page-numbers a:hover {
    background: var(--primary-color, #1a3c5e);
    color: white;
    transform: translateY(-1px);
}

.pagination-wrapper .page-numbers .current {
    background: var(--primary-color, #1a3c5e);
    color: white;
    font-weight: 600;
}

.pagination-wrapper .page-numbers .prev,
.pagination-wrapper .page-numbers .next {
    background: var(--secondary-color, #ffc107);
    color: white;
    font-weight: 600;
}

.pagination-wrapper .page-numbers .prev:hover,
.pagination-wrapper .page-numbers .next:hover {
    background: #e6ac00;
}

.pagination-wrapper .page-numbers .loading {
    opacity: 0.7;
    pointer-events: none;
}

.pagination-wrapper .page-numbers .loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.4rem;
}

/* Coordinates Copy */
.coordinates-copy {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.coordinates-copy:hover {
    background-color: var(--secondary-color, #ffc107);
    color: white;
}

.coordinates-copy.copied {
    background-color: #28a745;
    color: white;
    font-weight: 600;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .destination-content {
        padding: 1rem;
    }
    
    .destination-title {
        font-size: 1.1rem;
    }
    
    .filter-categories {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .pagination-wrapper .page-numbers a,
    .pagination-wrapper .page-numbers span {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Performance Optimizations */
.destination-card {
    will-change: transform;
}

.destination-image img {
    will-change: transform;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .destination-card,
    .destination-image img,
    .filter-btn,
    .pagination-wrapper .page-numbers a {
        transition: none;
    }
    
    .destination-card:hover {
        transform: none;
    }
    
    .destination-card:hover .destination-image img {
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .destination-card {
        border: 2px solid #000;
    }
    
    .filter-btn.active {
        border: 2px solid #fff;
    }
}

/* Print Styles */
@media print {
    .location-filter-section,
    .pagination-wrapper {
        display: none;
    }
    
    .destination-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
