.elementor-widget-department_heads .department-heads-container {
    display: flex;
    padding: 80px 144px 72px 144px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1512px;
    margin: 0 auto;
    background: #FBFBFB;
    background-color: #FBFBFB;
    opacity: 1;
    -webkit-background-clip: border-box;
    background-clip: border-box;
}
.elementor-widget-department_heads .section-title {
    color: #280071;
    font-family: 'Rubik', sans-serif;
    font-size: 50px;
    font-weight: 500;
    line-height: normal;
    text-align: center;
    margin: 0 0 15px 0 !important;
}

.elementor-widget-department_heads .section-subtitle {
    color: #280071;
    font-family: 'Rubik', sans-serif;
    font-size: 20px;
    font-weight: 400;
    line-height: normal;
    text-align: center;
    margin: 0 0 52px 0 !important;
    padding: 0;
}

/* Base grid layout */
.elementor-widget-department_heads .department-heads-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
    width: 1020px !important; /* Fixed width for 5 columns */
    justify-content: center !important;
}

/* Common card styles */
.elementor-widget-department_heads .department-head-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 180px !important;
    flex: 0 0 180px !important;
}

/* Image sizing for all items */
.elementor-widget-department_heads .head-image {
    width: 180px !important;
    height: 180px !important;
    border-radius: 12px !important;
    object-fit: cover !important;
    display: block;
    margin-bottom: 20px !important;
}

.elementor-widget-department_heads .head-name {
    color: #280071;
    font-family: 'Rubik', sans-serif;
    font-size: 22px;
    font-weight: 600;
    line-height: normal;
    text-align: center;
    margin: 0;
    width: 100%;
}

.elementor-widget-department_heads .head-title {
    color: rgba(40, 0, 113, 0.5);
    font-family: 'Rubik', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: normal;
    text-align: center;
    margin: 0;
    width: 100%;
}

/* Special handling for different numbers of items */
.elementor-widget-department_heads .department-heads-grid:has(.department-head-card:nth-child(1):last-child) {
    width: 180px !important;
    justify-content: center !important;
}

.elementor-widget-department_heads .department-heads-grid:has(.department-head-card:nth-child(2):last-child) {
    width: 390px !important;
    justify-content: center !important;
}

.elementor-widget-department_heads .department-heads-grid:has(.department-head-card:nth-child(3):last-child) {
    width: 600px !important;
    justify-content: center !important;
}

.elementor-widget-department_heads .department-heads-grid:has(.department-head-card:nth-child(4):last-child) {
    width: 810px !important;
    justify-content: center !important;
}

/* Handle 6+ items */
.elementor-widget-department_heads .department-heads-grid:has(.department-head-card:nth-child(6)) {
    justify-content: flex-start !important;
}

/* Media Queries */
@media (max-width: 1200px) {
    .elementor-widget-department_heads .department-heads-container {
        padding: 60px 80px;
    }

    .elementor-widget-department_heads .department-heads-grid {
        width: 100% !important;
        max-width: 1020px !important;
    }
}

@media (max-width: 1024px) {
    .elementor-widget-department_heads .department-heads-container {
        padding: 50px 40px;
    }

    .elementor-widget-department_heads .section-title {
        font-size: 40px;
    }

    .elementor-widget-department_heads .section-subtitle {
        font-size: 18px;
        margin-bottom: 40px !important;
    }
}

@media (max-width: 768px) {
    .elementor-widget-department_heads .department-heads-container {
        padding: 40px 20px;
    }

    .elementor-widget-department_heads .department-heads-grid {
        justify-content: center !important;
        gap: 24px !important;
    }

    .elementor-widget-department_heads .department-head-card {
        width: calc(50% - 12px) !important;
        flex: 0 0 calc(50% - 12px) !important;
    }

    .elementor-widget-department_heads .head-image {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1/1;
    }

    .elementor-widget-department_heads .section-title {
        font-size: 18px;
        margin-bottom: 10px !important;
    }

    .elementor-widget-department_heads .section-subtitle {
        font-size: 12px;
        margin-bottom: 30px !important;
    }

    .elementor-widget-department_heads .head-name {
        font-size: 12px;
    }

    .elementor-widget-department_heads .head-title {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .elementor-widget-department_heads .department-heads-container {
        padding: 30px 16px;
    }

    .elementor-widget-department_heads .department-heads-grid {
        gap: 16px !important;
    }

    .elementor-widget-department_heads .department-head-card {
        width: calc(50% - 8px) !important;
        flex: 0 0 calc(50% - 8px) !important;
    }
}