/* Reset and base styles */
.wrapper.carlink {
    background: #f8f9fa;
    padding: 40px 0;
}

.container.carlink {
    max-width: 1200px;
    margin: 100px auto 0;
    padding: 0 15px;
}

/* Grid layout */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* Card styles */
.car-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.car-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Image section */
.car-image {
    position: relative;
    overflow: hidden;
}

.main-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.car-item:hover .main-image {
    transform: scale(1.05);
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px;
    background: #f8f9fa;
}

.gallery-item {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 4px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-more {
    position: relative;
    cursor: pointer;
}

.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.gallery-more:hover .more-overlay {
    background: rgba(0, 0, 0, 0.75);
}

.more-overlay span {
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Info section */
.car-info {
    padding: 20px;
}

.car-info h3 {
    margin: 0 0 15px;
    font-size: 1.4em;
    color: #2c3e50;
}

.car-info h3 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.car-info h3 a:hover {
    color: #3498db;
}

.car-info-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.car-info-details-item {
    font-size: 0.9em;
}

.car-info-details-item h5 {
    margin: 0 0 5px;
    color: #7f8c8d;
    font-weight: 500;
}

.car-info-details-item p {
    margin: 0;
    color: #2c3e50;
    font-weight: 500;
}

.car-info-details-item span {
    color: #95a5a6;
    font-size: 0.9em;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 30px 0;
    gap: 25px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 10px;
    border-radius: 6px;
    background: #fff;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.pagination a:hover {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.pagination .active span {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .container.carlink {
        margin: 15px auto;
    }

    .cars-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .car-info-details {
        grid-template-columns: 1fr;
    }

    .main-image {
        height: 180px;
    }

    .image-gallery {
        grid-template-columns: repeat(4, 1fr);
    }

    .gallery-item:last-child {
        display: none;
    }
}

@media (max-width: 480px) {
    .wrapper.carlink {
        padding: 20px 0;
    }

    .car-info {
        padding: 15px;
    }

    .car-info h3 {
        font-size: 1.2em;
    }

    .image-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Стилі для курсору та анімації при наведенні */
.main-image-link, .gallery-item {
    cursor: zoom-in;
    display: block;
    overflow: hidden;
}

.main-image-link:hover .main-image,
.gallery-item:hover img {
    transform: scale(1.05);
}

/* Стилі для контейнера зображення */
.fancybox-slide--image .fancybox-content {
    background-color: transparent;
}

/* Покращення для thumbnails */
.fancybox-thumbs {
    background: rgba(0, 0, 0, 0.3);
}

.fancybox-thumbs__list a:before {
    border-color: #3498db;
}