.wp-block-custom-team-section {
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.team-content {
    margin: 0 auto;
    text-align: center;
    padding-bottom: 50px;
    margin-left: 5px;
}

.team-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.team-description {
    font-size: 32px;
    margin: 0 auto;
    text-align: start;
}

/* Keeping the existing styles for grid layout for backward compatibility */
.team-images {
    display: flex; /* Changed to flex for scroll hijacking */
    gap: 24px;
    max-width: 100%; /* Allow for full width scrolling */
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    -ms-overflow-style: none;  /* Hide scrollbar IE and Edge */
    scrollbar-width: none;     /* Hide scrollbar Firefox */
    padding-bottom: 5px;       /* Prevent cut-off by hidden scrollbar */
    cursor: grab;
    scroll-behavior: smooth;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.team-images::-webkit-scrollbar {
    display: none;
}

.team-image {
    position: relative;
    flex: 0 0 auto;
    width: calc(40% - 12px); /* 40% width minus half the gap */
    min-width: 300px;
    user-select: none;
}

.team-image img {
    width: 100%;
    height: 500px;
    object-fit: cover;
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.team-carousel {
    width: 100%;
    margin: 20px auto;
    position: relative;
    padding-bottom: 30px; /* Make room for progress bar */
}

.team-carousel.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

/* Progress bar for scroll hijacking */
.carousel-progress-bg {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.carousel-progress {
    position: absolute;
    bottom: 10px;
    left: 0;
    height: 4px;
    background: #fff;
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 2px;
}

/* Editor specific styles */
.wp-admin .team-image {
    background: #f0f0f0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-admin .image-upload-container {
    margin-bottom: 1rem;
}

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.image-item {
    position: relative;
}

.image-item img {
    width: 100%;
    height: auto;
}

.remove-image {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    padding: 2px 6px;
    cursor: pointer;
}

/* Responsive design */
@media (max-width: 1024px) {
    .team-image {
        width: calc(50% - 12px);
    }
    
    .team-image img {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .wp-block-custom-team-section {
        padding: 3rem 1rem;
        overflow-x: hidden; /* Ensure overflow control on mobile */
    }

    .team-title {
        font-size: 2rem;
    }

    .team-description {
        font-size: 26px;
    }

    .team-image {
        width: calc(70% - 12px);
    }

    .team-image img {
        height: 350px;
    }

    .team-content {
        padding-bottom: 50px;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .team-image {
        width: calc(85% - 12px);
    }

    .team-image img {
        height: 280px;
    }
}